Skip to content

Commit f64f6b1

Browse files
committed
Move the check to ChatModel.init(state:)
1 parent fdf4467 commit f64f6b1

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

Core/Sources/HostApp/AccountSettings/ChatModelManagement/ChatModelEdit.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,12 @@ extension ChatModel {
186186
apiKeyName: state.apiKeyName,
187187
baseURL: state.baseURL.trimmingCharacters(in: .whitespacesAndNewlines),
188188
maxTokens: state.maxTokens,
189-
supportsFunctionCalling: state.supportsFunctionCalling,
189+
supportsFunctionCalling: {
190+
if case .googleAI = state.format {
191+
return false
192+
}
193+
return state.supportsFunctionCalling
194+
}(),
190195
modelName: state.modelName.trimmingCharacters(in: .whitespacesAndNewlines)
191196
)
192197
)

Tool/Sources/AIModel/ChatModel.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public struct ChatModel: Codable, Equatable, Identifiable {
1414
self.name = name
1515
self.format = format
1616
self.info = info
17-
18-
if format == .googleAI {
19-
self.info.supportsFunctionCalling = false
20-
}
2117
}
2218

2319
public enum Format: String, Codable, Equatable, CaseIterable {

0 commit comments

Comments
 (0)