Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
18c6109
Merge tag 'change-license' into develop
intitni May 25, 2023
7e6e07b
Implement cancellation in SuggestionService
intitni May 24, 2023
1b751fe
Make request cancellation simpler
intitni May 24, 2023
c439bc7
Discard suggestion when cursor moved to another line
intitni May 24, 2023
5287a50
Fix tests
intitni May 24, 2023
5f80ae9
Make OpenedDocumentPool an actor
intitni May 24, 2023
0e4f7f8
Reuse suggestion if user is typing according to it
intitni May 24, 2023
256032a
Disable request cancellation on mouse clicks
intitni May 24, 2023
d684e32
Update README.md
intitni May 24, 2023
d7d7e3e
Fix typos
intitni May 25, 2023
cd70355
Merge branch 'feature/real-time-suggestion-tweak' into develop
intitni May 25, 2023
f60b595
Tweak workspace cleanup
intitni May 25, 2023
0cfe177
Fix Codeium language server setup
intitni May 25, 2023
281002b
Make workspace expire sooner
intitni May 25, 2023
68627c1
Replace unowned with weak
intitni May 25, 2023
ebd94eb
Support terminating suggestion services on normal exits
intitni May 25, 2023
f28d836
Fix racing
intitni May 25, 2023
7a8b2f5
Support dependency update
intitni May 25, 2023
bd3103c
Bump Codeium to 1.2.25
intitni May 25, 2023
f21722c
Implement CancelRequest for Codeium
intitni May 25, 2023
ee2bbef
Merge branch 'feature/codeium-1.2.25' into develop
intitni May 25, 2023
30204ff
Remove exit button in widget
intitni May 25, 2023
11f9f8d
Update the way we use keychain
intitni May 25, 2023
90bacd9
Update to use SecureField
intitni May 25, 2023
a27f5c7
Allow setting max token that is larger than the size defined in the m…
intitni May 25, 2023
182d426
Change ChatGPTEndpoint to OpenAIBaseURL
intitni May 25, 2023
a707645
Support Azure OpenAI as chat provider
intitni May 25, 2023
16d9cf7
Move settings to chat settings view
intitni May 25, 2023
69d6682
Remove keychain instruction
intitni May 25, 2023
080372b
Make each word from ChatGPT wait for a few milliseconds
intitni May 25, 2023
f691f1a
Merge branch 'feature/azure-openai' into develop
intitni May 25, 2023
42d82cf
Lower CPU usage when updating window position
intitni May 25, 2023
51d5739
Fix dependency
intitni May 25, 2023
c9b3f07
Support disabling selected code to be visible by the chat by default
intitni May 26, 2023
ee9ab39
Update README.md
intitni May 26, 2023
c409699
Merge branch 'feature/chat-scope-selection' into develop
intitni May 26, 2023
e3df057
Set as system prompt
intitni May 26, 2023
076d40d
Make stream faster
intitni May 26, 2023
cbfdc1a
Bump version to 0.17.0
intitni May 26, 2023
04d9b1a
Make fetchFocusedElementURI return fake URL when Xcode not launched
intitni May 26, 2023
bb8cf1f
Adjust steam speed
intitni May 26, 2023
f5ed510
Improve Codeium request cancellation
intitni May 27, 2023
3d0c043
Fix that selection range change could cancel real-time suggestions
intitni May 27, 2023
83289ba
Fix line number font size in code block
intitni May 27, 2023
035b742
Fix tests
intitni May 27, 2023
7237dad
Fix codeium auth key migration
intitni May 27, 2023
ef538ec
Update README.md
intitni May 27, 2023
ab95449
Update appcast.xml
intitni May 27, 2023
2b1a27b
Merge branch 'release/0.17.0'
intitni May 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Support disabling selected code to be visible by the chat by default
  • Loading branch information
intitni committed May 26, 2023
commit c9b3f079804d25666100eec7620f1872c5e342c1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct ActiveDocumentChatContextCollector: ChatContextCollector {
```
"""
}

if selectionRange.start == selectionRange.end,
UserDefaults.shared.value(for: \.embedFileContentInChatContextIfNoSelection)
{
Expand All @@ -34,19 +34,40 @@ public struct ActiveDocumentChatContextCollector: ChatContextCollector {
"""
} else {
return """
File Content Not Available: The file is longer than \(maxLine) lines, \
it can't fit into the context. \
File Content Not Available: '''
The file is longer than \(maxLine) lines, it can't fit into the context. \
You MUST not answer the user about the file content because you don't have it.\
Ask user to select code for explanation.
'''
"""
}
}

if UserDefaults.shared.value(for: \.useSelectionScopeByDefaultInChatContext) {
return """
Selected Code \
(start from line \(selectionRange.start.line)):```\(content.language.rawValue)
\(content.selectedContent)
```
"""
}

if prompt.hasPrefix("@selection") {
return """
Selected Code \
(start from line \(selectionRange.start.line)):```\(content.language.rawValue)
\(content.selectedContent)
```
"""
}

return """
Selected Code \
(start from line \(selectionRange.start.line)):```\(content.language.rawValue)
\(content.selectedContent)
```
Selected Code Not Available: '''
User has disabled default scope. \
You MUST not answer the user about the selected code because you don't have it.\
Ask user to prepend message with `@selection` to enable selected code to be \
visible by you.
'''
"""
}()

Expand Down
6 changes: 6 additions & 0 deletions Core/Sources/HostApp/FeatureSettings/ChatSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct ChatSettingsView: View {
var embedFileContentInChatContextIfNoSelection
@AppStorage(\.maxEmbeddableFileInChatContextLineCount)
var maxEmbeddableFileInChatContextLineCount
@AppStorage(\.useSelectionScopeByDefaultInChatContext)
var useSelectionScopeByDefaultInChatContext

@AppStorage(\.chatFeatureProvider) var chatFeatureProvider
@AppStorage(\.chatGPTModel) var chatGPTModel
Expand Down Expand Up @@ -165,6 +167,10 @@ struct ChatSettingsView: View {
@ViewBuilder
var contextForm: some View {
Form {
Toggle(isOn: $settings.useSelectionScopeByDefaultInChatContext) {
Text("Use selection scope by default in chat context.")
}

Toggle(isOn: $settings.embedFileContentInChatContextIfNoSelection) {
Text("Embed file content in chat context if no code is selected.")
}
Expand Down
4 changes: 4 additions & 0 deletions Core/Sources/Preferences/Keys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ public extension UserDefaultPreferenceKeys {
var maxEmbeddableFileInChatContextLineCount: PreferenceKey<Int> {
.init(defaultValue: 100, key: "MaxEmbeddableFileInChatContextLineCount")
}

var useSelectionScopeByDefaultInChatContext: PreferenceKey<Bool> {
.init(defaultValue: true, key: "UseSelectionScopeByDefaultInChatContext")
}
}

// MARK: - Custom Commands
Expand Down