Skip to content

Commit 27151c9

Browse files
committed
Update to always create a tab from builder
1 parent fdfea5e commit 27151c9

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

Core/Sources/ChatGPTChatTab/ChatGPTChatTab.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ public class ChatGPTChatTab: ChatTab {
104104

105105
return [Builder(title: "New Chat", customCommand: nil)] + customCommands
106106
}
107+
108+
public static func defaultBuilder() -> ChatTabBuilder {
109+
Builder(title: "New Chat", customCommand: nil)
110+
}
107111

108112
@MainActor
109113
public init(service: ChatService = .init(), store: StoreOf<ChatTabItem>) {

Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,7 @@ extension ChatTabPool {
388388
) async -> (any ChatTab, ChatTabInfo)? {
389389
let id = UUID().uuidString
390390
let info = ChatTabInfo(id: id, title: "")
391-
guard let builder = kind?.builder else {
392-
let chatTap = ChatGPTChatTab(store: createStore(id))
393-
setTab(chatTap)
394-
return (chatTap, info)
395-
}
396-
391+
let builder = kind?.builder ?? ChatGPTChatTab.defaultBuilder()
397392
guard let chatTap = await builder.build(store: createStore(id)) else { return nil }
398393
setTab(chatTap)
399394
return (chatTap, info)

0 commit comments

Comments
 (0)