Skip to content

Commit 4f1a60b

Browse files
committed
Add instructions to chat model settings
1 parent 5b3051d commit 4f1a60b

File tree

1 file changed

+49
-19
lines changed

1 file changed

+49
-19
lines changed

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

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ struct ChatModelEditView: View {
6363
.onAppear {
6464
store.send(.appear)
6565
}
66+
.fixedSize(horizontal: false, vertical: true)
6667
}
6768

6869
var nameTextField: some View {
@@ -224,6 +225,17 @@ struct ChatModelEditView: View {
224225

225226
maxTokensTextField
226227
supportsFunctionCallingToggle
228+
229+
VStack(alignment: .leading, spacing: 8) {
230+
Text(Image(systemName: "exclamationmark.triangle.fill")) + Text(
231+
" To get an API key, please visit [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)"
232+
)
233+
234+
Text(Image(systemName: "exclamationmark.triangle.fill")) + Text(
235+
" If you don't have access to GPT-4, you may need to visit [https://platform.openai.com/account/billing/overview](https://platform.openai.com/account/billing/overview) to buy some credits. A ChatGPT Plus subscription is not enough to access GPT-4 through API."
236+
)
237+
}
238+
.padding(.vertical)
227239
}
228240

229241
@ViewBuilder
@@ -259,25 +271,43 @@ struct ChatModelEditView: View {
259271
}
260272
}
261273

262-
class ChatModelManagementView_Editing_Previews: PreviewProvider {
263-
static var previews: some View {
264-
ChatModelEditView(
265-
store: .init(
266-
initialState: .init(model: ChatModel(
267-
id: "3",
268-
name: "Test Model 3",
269-
format: .openAICompatible,
270-
info: .init(
271-
apiKeyName: "key",
272-
baseURL: "apple.com",
273-
maxTokens: 3000,
274-
supportsFunctionCalling: false,
275-
modelName: "gpt-3.5-turbo"
276-
)
277-
)),
278-
reducer: ChatModelEdit()
279-
)
274+
#Preview("OpenAI") {
275+
ChatModelEditView(
276+
store: .init(
277+
initialState: .init(model: ChatModel(
278+
id: "3",
279+
name: "Test Model 3",
280+
format: .openAI,
281+
info: .init(
282+
apiKeyName: "key",
283+
baseURL: "apple.com",
284+
maxTokens: 3000,
285+
supportsFunctionCalling: false,
286+
modelName: "gpt-3.5-turbo"
287+
)
288+
)),
289+
reducer: ChatModelEdit()
280290
)
281-
}
291+
)
292+
}
293+
294+
#Preview("OpenAI Compatible") {
295+
ChatModelEditView(
296+
store: .init(
297+
initialState: .init(model: ChatModel(
298+
id: "3",
299+
name: "Test Model 3",
300+
format: .openAICompatible,
301+
info: .init(
302+
apiKeyName: "key",
303+
baseURL: "apple.com",
304+
maxTokens: 3000,
305+
supportsFunctionCalling: false,
306+
modelName: "gpt-3.5-turbo"
307+
)
308+
)),
309+
reducer: ChatModelEdit()
310+
)
311+
)
282312
}
283313

0 commit comments

Comments
 (0)