Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
257c025
Update to activate extension app when using hotkey to show widgets
intitni Nov 17, 2023
4d6b46a
Move GlobalShortcutManager to its own file
intitni Nov 17, 2023
d81a5fb
Add an action toggleWIdgets to GUI
intitni Nov 17, 2023
bc57cf1
Update to change key window when toggling widget with hotkey
intitni Nov 17, 2023
4b1271a
Fix activation logic
intitni Nov 17, 2023
5a3db20
Support activating selecting chat tab in various situations
intitni Nov 17, 2023
72bc2f2
Auto focus on text field in chat in various situations
intitni Nov 17, 2023
ebce401
Unify implementation of app activation
intitni Nov 17, 2023
a0d46ca
Activate extension app when prompt to code is activated
intitni Nov 17, 2023
22bf255
Update to control prompt to code focus state in reducer
intitni Nov 17, 2023
80acb92
Add missing weak self
intitni Nov 17, 2023
aa0fe32
Adjust timing issue of prompt to code
intitni Nov 17, 2023
fa2775a
Re activate extension after accepting prompt to code when continuous
intitni Nov 17, 2023
33f4b04
Merge branch 'hotfix/active-extension-when-using-hotkey-to-show-widge…
intitni Nov 17, 2023
ca98d1b
Ignore chunk id
intitni Nov 17, 2023
52fe8af
Merge branch 'hotfix/random-message-id-in-one-llm-round' into hotfix/…
intitni Nov 17, 2023
0f3f3e6
Fix cancellation
intitni Nov 17, 2023
15c8ba8
Add shouldEndTextWindow to configuration
intitni Nov 17, 2023
1ca4993
Bump version to 0.27.1
intitni Nov 17, 2023
ef1f42a
Workaround cooperative app activation
intitni Nov 18, 2023
93ce520
Update appcast.xml
intitni Nov 18, 2023
45a78f4
Merge branch 'hotfix/0.27.1'
intitni Nov 18, 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
Add shouldEndTextWindow to configuration
  • Loading branch information
intitni committed Nov 17, 2023
commit 15c8ba869931be3eb01428442f3be73dd2962e9a
4 changes: 4 additions & 0 deletions Core/Sources/ChatService/ChatService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public final class ChatService: ObservableObject {
let configuration = UserPreferenceChatGPTConfiguration().overriding()
/// Used by context collector
let extraConfiguration = configuration.overriding()
extraConfiguration.textWindowTerminator = {
guard let last = $0.last else { return false }
return last.isNewline || last.isPunctuation
}
let memory = ContextAwareAutoManagedChatGPTMemory(
configuration: extraConfiguration,
functionProvider: ChatFunctionProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public protocol ChatGPTConfiguration {
var maxTokens: Int { get }
var minimumReplyTokens: Int { get }
var runFunctionsAutomatically: Bool { get }
var shouldEndTextWindow: (String) -> Bool { get }
}

public extension ChatGPTConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public struct UserPreferenceChatGPTConfiguration: ChatGPTConfiguration {
public var runFunctionsAutomatically: Bool {
true
}

public var shouldEndTextWindow: (String) -> Bool {
{ _ in true }
}

public init(chatModelKey: KeyPath<UserDefaultPreferenceKeys, PreferenceKey<String>>? = nil) {
self.chatModelKey = chatModelKey
Expand All @@ -56,7 +60,7 @@ public class OverridingChatGPTConfiguration: ChatGPTConfiguration {
public var minimumReplyTokens: Int?
public var runFunctionsAutomatically: Bool?
public var apiKey: String?

public init(
temperature: Double? = nil,
modelId: String? = nil,
Expand All @@ -80,6 +84,7 @@ public class OverridingChatGPTConfiguration: ChatGPTConfiguration {

private let configuration: ChatGPTConfiguration
public var overriding = Overriding()
public var textWindowTerminator: ((String) -> Bool)?

public init(
overriding configuration: any ChatGPTConfiguration,
Expand Down Expand Up @@ -126,5 +131,9 @@ public class OverridingChatGPTConfiguration: ChatGPTConfiguration {
guard let name = model?.info.apiKeyName else { return configuration.apiKey }
return (try? Keychain.apiKey.get(name)) ?? configuration.apiKey
}

public var shouldEndTextWindow: (String) -> Bool {
textWindowTerminator ?? configuration.shouldEndTextWindow
}
}