From 8043cd60428a859b47cc916d5b35fc55d9e685e5 Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Wed, 30 Oct 2024 20:10:14 +0800 Subject: [PATCH 1/4] Fix that a tab can be registered to an empty id --- .../Service/GUI/GraphicalUserInterfaceController.swift | 4 ++-- Tool/Sources/ChatTab/ChatTabPool.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift b/Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift index ff3fa4abf..4fefd1f1c 100644 --- a/Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift +++ b/Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift @@ -367,7 +367,7 @@ extension ChatTabPool { let id = id let info = ChatTabInfo(id: id, title: "") guard let chatTap = await builder.build(store: createStore(id)) else { return nil } - setTab(chatTap) + setTab(chatTap, forId: id) return (chatTap, info) } @@ -379,7 +379,7 @@ extension ChatTabPool { let info = ChatTabInfo(id: id, title: "") let builder = kind?.builder ?? ChatGPTChatTab.defaultBuilder() guard let chatTap = await builder.build(store: createStore(id)) else { return nil } - setTab(chatTap) + setTab(chatTap, forId: id) return (chatTap, info) } diff --git a/Tool/Sources/ChatTab/ChatTabPool.swift b/Tool/Sources/ChatTab/ChatTabPool.swift index fafa22cc8..5f5b1c2fc 100644 --- a/Tool/Sources/ChatTab/ChatTabPool.swift +++ b/Tool/Sources/ChatTab/ChatTabPool.swift @@ -22,8 +22,8 @@ public final class ChatTabPool { pool[id] } - public func setTab(_ tab: any ChatTab) { - pool[tab.id] = tab + public func setTab(_ tab: any ChatTab, forId id: String) { + pool[id] = tab } public func removeTab(of id: String) { From df2423ba3ac4e11e88dc6e3a152724330d8631ff Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Wed, 30 Oct 2024 20:32:14 +0800 Subject: [PATCH 2/4] Fix that command w is not closing a chat tab --- Core/Sources/SuggestionWidget/ChatPanelWindow.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Core/Sources/SuggestionWidget/ChatPanelWindow.swift b/Core/Sources/SuggestionWidget/ChatPanelWindow.swift index 65c99c592..cad0c7c06 100644 --- a/Core/Sources/SuggestionWidget/ChatPanelWindow.swift +++ b/Core/Sources/SuggestionWidget/ChatPanelWindow.swift @@ -12,9 +12,9 @@ final class ChatPanelWindow: WidgetWindow { private let store: StoreOf var minimizeWindow: () -> Void = {} - + var isDetached: Bool { - store.withState({$0.isDetached}) + store.withState { $0.isDetached } } override var defaultCollectionBehavior: NSWindow.CollectionBehavior { @@ -35,7 +35,7 @@ final class ChatPanelWindow: WidgetWindow { self.minimizeWindow = minimizeWindow super.init( contentRect: .init(x: 0, y: 0, width: 300, height: 400), - styleMask: [.resizable, .titled, .miniaturizable, .fullSizeContentView], + styleMask: [.resizable, .titled, .miniaturizable, .fullSizeContentView, .closable], backing: .buffered, defer: false ) @@ -121,5 +121,9 @@ final class ChatPanelWindow: WidgetWindow { override func miniaturize(_: Any?) { minimizeWindow() } + + override func close() { + store.send(.closeActiveTabClicked) + } } From 59cdc22361339d889ebaf0ef127d5f22603eea9e Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Wed, 30 Oct 2024 20:37:54 +0800 Subject: [PATCH 3/4] Update claude models to use -latest alias if possible --- .../OpenAIService/APIs/ClaudeChatCompletionsService.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tool/Sources/OpenAIService/APIs/ClaudeChatCompletionsService.swift b/Tool/Sources/OpenAIService/APIs/ClaudeChatCompletionsService.swift index 53c334107..2ac2c93c1 100644 --- a/Tool/Sources/OpenAIService/APIs/ClaudeChatCompletionsService.swift +++ b/Tool/Sources/OpenAIService/APIs/ClaudeChatCompletionsService.swift @@ -7,9 +7,10 @@ import Preferences /// https://docs.anthropic.com/claude/reference/messages_post public actor ClaudeChatCompletionsService: ChatCompletionsStreamAPI, ChatCompletionsAPI { + /// https://docs.anthropic.com/en/docs/about-claude/models public enum KnownModel: String, CaseIterable { - case claude35Sonnet = "claude-3-5-sonnet-20240620" - case claude3Opus = "claude-3-opus-20240229" + case claude35Sonnet = "claude-3-5-sonnet-latest" + case claude3Opus = "claude-3-opus-latest" case claude3Sonnet = "claude-3-sonnet-20240229" case claude3Haiku = "claude-3-haiku-20240307" From 42b1b8fb2a48b1a19212835261d726bd410c343b Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Wed, 30 Oct 2024 20:52:50 +0800 Subject: [PATCH 4/4] Bump version to 0.34.3 --- Version.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Version.xcconfig b/Version.xcconfig index 4b72dd9ea..35fd980ba 100644 --- a/Version.xcconfig +++ b/Version.xcconfig @@ -1,3 +1,3 @@ -APP_VERSION = 0.34.2 -APP_BUILD = 415 +APP_VERSION = 0.34.3 +APP_BUILD = 416