-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathChatExtension.swift
More file actions
26 lines (23 loc) · 959 Bytes
/
ChatExtension.swift
File metadata and controls
26 lines (23 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import ChatService
import ConversationServiceProvider
extension Chat.State {
func buildSkillSet(isCurrentEditorContextEnabled: Bool) -> [ConversationSkill] {
guard let currentFile = self.currentEditor, isCurrentEditorContextEnabled else {
return []
}
let fileReference = ConversationFileReference(
url: currentFile.url,
relativePath: currentFile.relativePath,
fileName: currentFile.fileName,
isCurrentEditor: currentFile.isCurrentEditor,
selection: currentFile.selection
)
return [CurrentEditorSkill(currentFile: fileReference), ProblemsInActiveDocumentSkill()]
}
func getChatContext(of mode: Chat.EditorMode) -> ChatContext {
return editor.context(for: mode)
}
func getSubsequentMessages(after messageId: String) -> [DisplayedChatMessage] {
conversation.subsequentMessages(after: messageId)
}
}