Skip to content

Commit fe04f9d

Browse files
committed
Use I instead of the user when talking to the bot
1 parent 6a24743 commit fe04f9d

File tree

9 files changed

+23
-20
lines changed

9 files changed

+23
-20
lines changed

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/ActiveDocumentChatContextCollector.swift

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
8989
let start = """
9090
## File and Code Scope
9191
92-
You can use the following context to answer user's questions about the editing document or code. The context shows only a part of the code in the editing document, and will change during the conversation, so it may not match our conversation.
92+
You can use the following context to answer my questions about the editing document or code. The context shows only a part of the code in the editing document, and will change during the conversation, so it may not match our conversation.
9393
94-
User Editing Document Context: ###
94+
\(
95+
context.focusedContext == nil
96+
? ""
97+
: "When you don't known what I am asking, I am probably referring to the code."
98+
)
99+
100+
Editing Document Context: ###
95101
"""
96102
let end = "###"
97103
let relativePath = "Document Relative Path: \(context.relativePath)"
@@ -110,10 +116,7 @@ public final class ActiveDocumentChatContextCollector: ChatContextCollector {
110116
let codeRange = "Focused Range [line, character]: \(focusedContext.codeRange)"
111117

112118
let code = """
113-
Focused Code (start from line \(
114-
focusedContext.codeRange.start
115-
.line
116-
)):
119+
Focused Code (start from line \(focusedContext.codeRange.start.line + 1)):
117120
```\(context.language.rawValue)
118121
\(focusedContext.code)
119122
```
@@ -282,7 +285,7 @@ struct ActiveDocumentContext {
282285
selectionRange = info.editorContent?.selections.first ?? .zero
283286
lineAnnotations = info.editorContent?.lineAnnotations ?? []
284287
imports = []
285-
288+
286289
if changed {
287290
moveToFocusedCode()
288291
}

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/ExpandFocusRangeFunction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
1010
var range: CursorRange
1111

1212
var botReadableContent: String {
13-
"User Editing Document Context is updated to display code at \(range)."
13+
"Editing Document Context is updated to display code at \(range)."
1414
}
1515
}
1616

@@ -25,7 +25,7 @@ struct ExpandFocusRangeFunction: ChatGPTFunction {
2525
}
2626

2727
var description: String {
28-
"Call when User Editing Document Context provides too little context to answer a question."
28+
"Call when Editing Document Context provides too little context to answer a question."
2929
}
3030

3131
var argumentSchema: JSONSchemaValue { [

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToCodeAroundLineFunction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct MoveToCodeAroundLineFunction: ChatGPTFunction {
1212
var range: CursorRange
1313

1414
var botReadableContent: String {
15-
"User Editing Document Context is updated to display code at \(range)."
15+
"Editing Document Context is updated to display code at \(range)."
1616
}
1717
}
1818

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/Functions/MoveToFocusedCodeFunction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct MoveToFocusedCodeFunction: ChatGPTFunction {
1010
var range: CursorRange
1111

1212
var botReadableContent: String {
13-
"User Editing Document Context is updated to display code at \(range)."
13+
"Editing Document Context is updated to display code at \(range)."
1414
}
1515
}
1616

@@ -25,7 +25,7 @@ struct MoveToFocusedCodeFunction: ChatGPTFunction {
2525
}
2626

2727
var description: String {
28-
"Move user editing document context to the selected or focused code"
28+
"Move editing document context to the selected or focused code"
2929
}
3030

3131
var argumentSchema: JSONSchemaValue { [

Core/Sources/ChatContextCollectors/ActiveDocumentChatContextCollector/LegacyActiveDocumentChatContextCollector.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public struct LegacyActiveDocumentChatContextCollector: ChatContextCollector {
6868

6969
return """
7070
Selected Code Not Available: '''
71-
User has disabled default scope. \
72-
You MUST not answer the user about the selected code because you don't have it.\
73-
Ask user to prepend message with `@selection` to enable selected code to be \
71+
I have disabled default scope. \
72+
You MUST not answer about the selected code because you don't have it.\
73+
Ask me to prepend message with `@selection` to enable selected code to be \
7474
visible by you.
7575
'''
7676
"""

Core/Sources/ChatContextCollectors/WebChatContextCollector/SearchFunction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct SearchFunction: ChatGPTFunction {
5151
"freshness": [
5252
.type: "string",
5353
.description: .string(
54-
"limit the search result to a specific range, use only when user ask the question about current events. Today is \(today). Format: yyyy-MM-dd..yyyy-MM-dd"
54+
"limit the search result to a specific range, use only when I ask the question about current events. Today is \(today). Format: yyyy-MM-dd..yyyy-MM-dd"
5555
),
5656
.examples: ["1919-10-20..1988-10-20"],
5757
],

Tool/Sources/BingSearchService/BingSearchService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ enum BingSearchError: Error, LocalizedError {
3737
case let .searchURLFormatIncorrect(url):
3838
return "The search URL format is incorrect: \(url)"
3939
case .subscriptionKeyNotAvailable:
40-
return "The user doesn't provide a subscription key to use Bing search."
40+
return "The I didn't provide a subscription key to use Bing search."
4141
}
4242
}
4343
}

Tool/Sources/LangChain/Chains/RefineDocumentChain.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public final class RefineDocumentChain: Chain {
102102
content: {
103103
if let previousAnswer = input.previousAnswer {
104104
return """
105-
The user will send you a question about a document, you must refine your previous answer to it only according to the document.
105+
I will send you a question about a document, you must refine your previous answer to it only according to the document.
106106
Previous answer:###
107107
\(previousAnswer)
108108
###
@@ -112,7 +112,7 @@ public final class RefineDocumentChain: Chain {
112112
"""
113113
} else {
114114
return """
115-
The user will send you a question about a document, you must answer it only according to the document.
115+
I will send you a question about a document, you must answer it only according to the document.
116116
Page \(input.index) of \(input.totalCount) of the document:###
117117
\(input.document)
118118
###

Tool/Sources/SuggestionModel/ExportedFromLSP.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public extension CursorPosition {
77
static var outOfScope: CursorPosition { .init(line: -1, character: -1) }
88

99
var readableText: String {
10-
return "[\(line), \(character)]"
10+
return "[\(line + 1), \(character)]"
1111
}
1212
}
1313

0 commit comments

Comments
 (0)