forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddingModelManagementView.swift
More file actions
80 lines (76 loc) · 2.94 KB
/
EmbeddingModelManagementView.swift
File metadata and controls
80 lines (76 loc) · 2.94 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
import AIModel
import ComposableArchitecture
import SwiftUI
struct EmbeddingModelManagementView: View {
let store: StoreOf<EmbeddingModelManagement>
var body: some View {
AIModelManagementView<EmbeddingModelManagement, _>(store: store)
.sheet(store: store.scope(
state: \.$editingModel,
action: EmbeddingModelManagement.Action.embeddingModelItem
)) { store in
EmbeddingModelEditView(store: store)
.frame(width: 800)
}
}
}
// MARK: - Previews
class EmbeddingModelManagementView_Previews: PreviewProvider {
static var previews: some View {
EmbeddingModelManagementView(
store: .init(
initialState: .init(
models: IdentifiedArray<String, EmbeddingModel>(uniqueElements: [
EmbeddingModel(
id: "1",
name: "Test Model",
format: .openAI,
info: .init(
apiKeyName: "key",
baseURL: "google.com",
maxTokens: 3000,
modelName: "gpt-3.5-turbo"
)
),
EmbeddingModel(
id: "2",
name: "Test Model 2",
format: .azureOpenAI,
info: .init(
apiKeyName: "key",
baseURL: "apple.com",
maxTokens: 3000,
modelName: "gpt-3.5-turbo"
)
),
EmbeddingModel(
id: "3",
name: "Test Model 3",
format: .openAICompatible,
info: .init(
apiKeyName: "key",
baseURL: "apple.com",
maxTokens: 3000,
modelName: "gpt-3.5-turbo"
)
),
]),
editingModel: .init(
model: EmbeddingModel(
id: "3",
name: "Test Model 3",
format: .openAICompatible,
info: .init(
apiKeyName: "key",
baseURL: "apple.com",
maxTokens: 3000,
modelName: "gpt-3.5-turbo"
)
)
)
),
reducer: EmbeddingModelManagement()
)
)
}
}