forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatModelManagementView.swift
More file actions
84 lines (80 loc) · 3.12 KB
/
ChatModelManagementView.swift
File metadata and controls
84 lines (80 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import AIModel
import ComposableArchitecture
import SwiftUI
struct ChatModelManagementView: View {
let store: StoreOf<ChatModelManagement>
var body: some View {
AIModelManagementView<ChatModelManagement, _>(store: store)
.sheet(store: store.scope(
state: \.$editingModel,
action: ChatModelManagement.Action.chatModelItem
)) { store in
ChatModelEditView(store: store)
.frame(width: 800)
}
}
}
// MARK: - Previews
class ChatModelManagementView_Previews: PreviewProvider {
static var previews: some View {
ChatModelManagementView(
store: .init(
initialState: .init(
models: IdentifiedArray<String, ChatModel>(uniqueElements: [
ChatModel(
id: "1",
name: "Test Model",
format: .openAI,
info: .init(
apiKeyName: "key",
baseURL: "google.com",
maxTokens: 3000,
supportsFunctionCalling: true,
modelName: "gpt-3.5-turbo"
)
),
ChatModel(
id: "2",
name: "Test Model 2",
format: .azureOpenAI,
info: .init(
apiKeyName: "key",
baseURL: "apple.com",
maxTokens: 3000,
supportsFunctionCalling: false,
modelName: "gpt-3.5-turbo"
)
),
ChatModel(
id: "3",
name: "Test Model 3",
format: .openAICompatible,
info: .init(
apiKeyName: "key",
baseURL: "apple.com",
maxTokens: 3000,
supportsFunctionCalling: false,
modelName: "gpt-3.5-turbo"
)
),
]),
editingModel: .init(
model: ChatModel(
id: "3",
name: "Test Model 3",
format: .openAICompatible,
info: .init(
apiKeyName: "key",
baseURL: "apple.com",
maxTokens: 3000,
supportsFunctionCalling: false,
modelName: "gpt-3.5-turbo"
)
)
)
),
reducer: ChatModelManagement()
)
)
}
}