From 46812c088f20742897488c5a520cc188278941d3 Mon Sep 17 00:00:00 2001 From: Idddd <956020859@qq.com> Date: Thu, 4 Jun 2026 10:14:39 +0800 Subject: [PATCH] fix: default disable TLS verification, auto-pull on check update, strip prompt metadata before LLM use - Change httpDisableTlsVerification default from false to true to avoid PKIX SSL handshake errors - Check Update button now auto-pulls prompts/skills without confirmation dialog - Strip metadata lines (name/type/time/updatedAt/pulledAt) from prompt text before sending to LLM Co-Authored-By: Claude Opus 4.7 --- .../org/openprojectx/ai/plugin/llm/LlmSettings.kt | 2 +- .../openprojectx/ai/plugin/AiTestSettingsModel.kt | 2 +- .../ai/plugin/ContextBoxToolWindowFactory.kt | 10 +++------- .../openprojectx/ai/plugin/LlmSettingsLoader.kt | 15 +++++++++++++-- .../ai/plugin/PromptProfileResolver.kt | 3 ++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/llm-client/src/main/kotlin/org/openprojectx/ai/plugin/llm/LlmSettings.kt b/llm-client/src/main/kotlin/org/openprojectx/ai/plugin/llm/LlmSettings.kt index dd91f2e..a187fe4 100644 --- a/llm-client/src/main/kotlin/org/openprojectx/ai/plugin/llm/LlmSettings.kt +++ b/llm-client/src/main/kotlin/org/openprojectx/ai/plugin/llm/LlmSettings.kt @@ -8,7 +8,7 @@ data class LlmSettings( val endpoint: String? = null, val template: TemplateRequestConfig? = null, val auth: LlmAuthConfig? = null, - val httpDisableTlsVerification: Boolean = false, + val httpDisableTlsVerification: Boolean = true, val maxTokens: Int = 8192 ) diff --git a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/AiTestSettingsModel.kt b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/AiTestSettingsModel.kt index 45a139a..e61e340 100644 --- a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/AiTestSettingsModel.kt +++ b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/AiTestSettingsModel.kt @@ -7,7 +7,7 @@ data class AiTestSettingsModel( val llmTimeoutSeconds: String = "60", val llmApiKey: String = "", val llmApiKeyEnv: String = "", - val httpDisableTlsVerification: Boolean = false, + val httpDisableTlsVerification: Boolean = true, val showLogTab: Boolean = true, val llmTemplateEnabled: Boolean = false, val llmTemplateMethod: String = "POST", diff --git a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/ContextBoxToolWindowFactory.kt b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/ContextBoxToolWindowFactory.kt index 1be1efc..0182ad8 100644 --- a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/ContextBoxToolWindowFactory.kt +++ b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/ContextBoxToolWindowFactory.kt @@ -1060,12 +1060,10 @@ class ContextBoxToolWindowFactory : ToolWindowFactory, DumbAware { Notifications.error(project, "Prompt Manager", status.message) return } - val message = promptUpdateMessage(status) if (status.hasUpdates) { - val choice = Messages.showYesNoDialog(project, "$message\n\nUpdate prompts now?", "Prompt Manager", "Update", "Later", null) - if (choice == Messages.YES) performPullUpdate() else Notifications.info(project, "Prompt Manager", message) + performPullUpdate() } else { - Notifications.info(project, "Prompt Manager", message) + Notifications.info(project, "Prompt Manager", promptUpdateMessage(status)) } } @@ -1586,9 +1584,7 @@ class ContextBoxToolWindowFactory : ToolWindowFactory, DumbAware { return } if (status.hasUpdates) { - val choice = Messages.showYesNoDialog(project, - "${status.message}\n\nUpdate skills now?", "Skill Manager", "Update", "Later", null) - if (choice == Messages.YES) performPullSkillUpdate() else Notifications.info(project, "Skill Manager", status.message) + performPullSkillUpdate() } else { Notifications.info(project, "Skill Manager", status.message) } diff --git a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/LlmSettingsLoader.kt b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/LlmSettingsLoader.kt index ab95be6..6a13a12 100644 --- a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/LlmSettingsLoader.kt +++ b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/LlmSettingsLoader.kt @@ -505,7 +505,7 @@ object LlmSettingsLoader { llmTimeoutSeconds = llm.string("timeoutSeconds").ifBlank { "60" }, llmApiKey = llm.string("apiKey"), llmApiKeyEnv = llm.string("apiKeyEnv"), - httpDisableTlsVerification = http?.get("disableTlsVerification") as? Boolean ?: false, + httpDisableTlsVerification = http?.get("disableTlsVerification") as? Boolean ?: true, showLogTab = ui["showLogTab"] as? Boolean ?: true, llmTemplateEnabled = template != null, llmTemplateMethod = template.string("method").ifBlank { "POST" }, @@ -762,7 +762,7 @@ object LlmSettingsLoader { } val httpMap = llm["http"] as? Map<*, *> - val disableTlsVerification = httpMap?.get("disableTlsVerification") as? Boolean ?: false + val disableTlsVerification = httpMap?.get("disableTlsVerification") as? Boolean ?: true val maxTokens = when (val v = llm["maxTokens"]) { is Number -> v.toInt() @@ -1072,6 +1072,17 @@ object LlmSettingsLoader { } } + fun stripPromptMetadata(content: String): String { + val lines = content.trim().lines() + val metadataKeys = setOf("name", "type", "time", "updatedAt", "pulledAt") + val bodyStart = lines.indexOfFirst { line -> + val key = line.substringBefore(":").trim().lowercase() + key !in metadataKeys && line.isNotBlank() + } + if (bodyStart < 0) return content + return lines.drop(bodyStart).joinToString("\n").trim() + } + private fun extractSkillBody(content: String): String { val lines = content.trim().lines() val metadataKeys = setOf("name", "type", "time", "updatedAt", "pulledAt", "description") diff --git a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/PromptProfileResolver.kt b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/PromptProfileResolver.kt index 7c670b3..bb15b7a 100644 --- a/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/PromptProfileResolver.kt +++ b/plugin-idea/src/main/kotlin/org/openprojectx/ai/plugin/PromptProfileResolver.kt @@ -4,10 +4,11 @@ object PromptProfileResolver { fun resolve(profileSet: PromptProfileSet, fallbackTemplate: String): String { val selectedName = profileSet.selected.trim().ifBlank { PromptProfileSet.DEFAULT_NAME } - return profileSet.items[selectedName] + val raw = profileSet.items[selectedName] ?.takeIf { it.isNotBlank() } ?: profileSet.items[PromptProfileSet.DEFAULT_NAME] ?.takeIf { it.isNotBlank() } ?: fallbackTemplate + return LlmSettingsLoader.stripPromptMetadata(raw) } }