@@ -6,6 +6,8 @@ import cc.unitmesh.devti.gui.chat.ChatCodingService
6
6
import cc.unitmesh.devti.gui.chat.NormalChatCodingPanel
7
7
import cc.unitmesh.devti.gui.chat.message.ChatActionType
8
8
import cc.unitmesh.devti.inline.AutoDevInlineChatProvider
9
+ import cc.unitmesh.devti.llm2.GithubCopilotDetector
10
+ import cc.unitmesh.devti.llm2.GithubCopilotManager
9
11
import cc.unitmesh.devti.provider.observer.AgentObserver
10
12
import cc.unitmesh.devti.settings.locale.LanguageChangedCallback
11
13
import cc.unitmesh.devti.settings.locale.LanguageChangedCallback.componentStateChanged
@@ -22,6 +24,10 @@ import com.intellij.openapi.wm.ToolWindowFactory
22
24
import com.intellij.openapi.wm.ToolWindowManager
23
25
import com.intellij.ui.content.Content
24
26
import com.intellij.ui.content.ContentFactory
27
+ import kotlinx.coroutines.CoroutineScope
28
+ import kotlinx.coroutines.Dispatchers
29
+ import kotlinx.coroutines.SupervisorJob
30
+ import kotlinx.coroutines.launch
25
31
26
32
private const val NORMAL_CHAT = " AutoDev Chat"
27
33
private const val SKETCH_TITLE = " Sketch"
@@ -64,6 +70,25 @@ class AutoDevToolWindowFactory : ToolWindowFactory, DumbAware {
64
70
private fun initForIdea223 (project : Project ) {
65
71
AutoDevInlineChatProvider .addListener(project)
66
72
AgentObserver .register(project)
73
+ initializeGithubCopilotModelsForIdea223(project)
74
+ }
75
+
76
+ /* *
77
+ * Initialize GitHub Copilot models for IDEA 223 compatibility
78
+ */
79
+ private fun initializeGithubCopilotModelsForIdea223 (project : Project ) {
80
+ // 使用协程在后台线程执行初始化
81
+ val scope = CoroutineScope (SupervisorJob () + Dispatchers .IO )
82
+ scope.launch {
83
+ if (ApplicationManager .getApplication().isUnitTestMode) return @launch
84
+
85
+ // 只有当用户已配置 GitHub Copilot 时才进行初始化
86
+ if (GithubCopilotDetector .isGithubCopilotConfigured()) {
87
+ // 获取服务实例并初始化
88
+ val manager = GithubCopilotManager .getInstance()
89
+ manager.initialize()
90
+ }
91
+ }
67
92
}
68
93
69
94
override fun init (toolWindow : ToolWindow ) {
0 commit comments