Skip to content

Commit 2ad4d33

Browse files
committed
Adjust system prompt
1 parent f531278 commit 2ad4d33

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

Core/Sources/ChatContextCollectors/SystemInfoChatContextCollector/SystemInfoChatContextCollector.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ public final class SystemInfoChatContextCollector: ChatContextCollector {
1919
) -> ChatContext {
2020
return .init(
2121
systemPrompt: """
22-
Current Time: \(
23-
Self.dateFormatter.string(from: Date())
24-
) (You can use it to calculate time in another time zone)
25-
""",
22+
## System Info
23+
24+
Current Time: \(
25+
Self.dateFormatter.string(from: Date())
26+
) (You can use it to calculate time in another time zone)
27+
""",
2628
retrievedContent: [],
2729
functions: []
2830
)

Core/Sources/ChatService/DynamicContextController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ final class DynamicContextController {
6969
let extraSystemPrompt = contexts
7070
.map(\.systemPrompt)
7171
.filter { !$0.isEmpty }
72-
.joined(separator: "\n")
72+
.joined(separator: "\n\n")
7373

7474
let contextPrompts = contexts
7575
.flatMap(\.retrievedContent)

Pro

Submodule Pro updated from 5f31b6c to c55315e

Tool/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/ActiveDocumentChatContextCollector.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
101101
: "When you don't known what I am asking, I am probably referring to the code."
102102
)
103103
104-
Editing Document Context: ###
104+
### Editing Document Context
105105
"""
106-
let end = "###"
107106
let relativePath = "Document Relative Path: \(context.relativePath)"
108107
let language = "Language: \(context.language.rawValue)"
109108

@@ -160,7 +159,6 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
160159
code,
161160
codeAnnotations,
162161
fileAnnotations,
163-
end,
164162
]
165163
.filter { !$0.isEmpty }
166164
.joined(separator: "\n\n")
@@ -180,10 +178,9 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
180178
language,
181179
lineAnnotations,
182180
selectionRange,
183-
end,
184181
]
185182
.filter { !$0.isEmpty }
186-
.joined(separator: "\n")
183+
.joined(separator: "\n\n")
187184
}
188185
}
189186

Tool/Sources/OpenAIService/Memory/AutoManagedChatGPTMemory.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,13 @@ public actor AutoManagedChatGPTMemory: ChatGPTMemory {
135135
for (index, content) in retrievedContent.filter({ !$0.isEmpty }).enumerated() {
136136
if index == 0 {
137137
if !appendToSystemPrompt("""
138-
138+
139+
140+
## Relevant Content
141+
139142
Below are information related to the conversation, separated by \(separator)
140143
144+
141145
""") { break }
142146
} else {
143147
if !appendToSystemPrompt("\n\(separator)\n") { break }

0 commit comments

Comments
 (0)