@@ -26,21 +26,22 @@ public final class GitHubCopilotChatService: BuiltinExtensionChatServiceType {
2626 let editorContent = await XcodeInspector . shared. getFocusedEditorContent ( )
2727 let workDoneToken = UUID ( ) . uuidString
2828 let turns = convertHistory ( history: history, message: message)
29+ let doc = GitHubCopilotDoc (
30+ source: editorContent? . editorContent? . content ?? " " ,
31+ tabSize: 1 ,
32+ indentSize: 4 ,
33+ insertSpaces: true ,
34+ path: editorContent? . documentURL. path ?? " " ,
35+ uri: editorContent? . documentURL. path ?? " " ,
36+ relativePath: editorContent? . relativePath ?? " " ,
37+ languageId: editorContent? . language ?? . plaintext,
38+ position: editorContent? . editorContent? . cursorPosition ?? . zero
39+ )
2940 let request = GitHubCopilotRequest . ConversationCreate ( requestBody: . init(
3041 workDoneToken: workDoneToken,
3142 turns: turns,
3243 capabilities: . init( allSkills: true , skills: [ ] ) ,
33- doc: . init(
34- source: editorContent? . editorContent? . content ?? " " ,
35- tabSize: 1 ,
36- indentSize: 4 ,
37- insertSpaces: true ,
38- path: editorContent? . documentURL. path ?? " " ,
39- uri: editorContent? . documentURL. path ?? " " ,
40- relativePath: editorContent? . relativePath ?? " " ,
41- languageId: editorContent? . language ?? . plaintext,
42- position: editorContent? . editorContent? . cursorPosition ?? . zero
43- ) ,
44+ doc: doc,
4445 source: . panel,
4546 workspaceFolder: workspace. projectURL. path
4647 ) )
@@ -132,11 +133,11 @@ extension GitHubCopilotChatService {
132133 let systemPrompt = history
133134 . filter { $0. role == . system } . compactMap ( \. content)
134135 . joined ( separator: " \n \n " )
135-
136+
136137 if !systemPrompt. isEmpty {
137138 turns. append ( . init( request: " [System Prompt] \n \( systemPrompt) " , response: " OK! " ) )
138139 }
139-
140+
140141 for i in firstIndexOfUserMessage..< history. endIndex {
141142 let message = history [ i]
142143 let text = message. content ?? " "
0 commit comments