Skip to content

Commit 2d62073

Browse files
committed
Try to inject system prompt
1 parent 3e59129 commit 2d62073

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Tool/Sources/GitHubCopilotService/Services/GitHubCopilotChatService.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ extension GitHubCopilotChatService {
129129

130130
var currentTurn = Turn(request: "", response: nil)
131131
var turns: [Turn] = []
132+
let systemPrompt = history
133+
.filter { $0.role == .system }.compactMap(\.content)
134+
.joined(separator: "\n\n")
135+
136+
if !systemPrompt.isEmpty {
137+
turns.append(.init(request: "[System Prompt]\n\(systemPrompt)", response: "OK!"))
138+
}
139+
132140
for i in firstIndexOfUserMessage..<history.endIndex {
133141
let message = history[i]
134142
let text = message.content ?? ""

0 commit comments

Comments
 (0)