forked from github/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopilotModelManager.swift
More file actions
29 lines (23 loc) · 925 Bytes
/
CopilotModelManager.swift
File metadata and controls
29 lines (23 loc) · 925 Bytes
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
import ConversationServiceProvider
import Foundation
public extension Notification.Name {
static let gitHubCopilotModelsDidChange = Notification
.Name("com.github.CopilotForXcode.CopilotModelsDidChange")
}
public class CopilotModelManager {
private static var availableLLMs: [CopilotModel] = []
public static func updateLLMs(_ models: [CopilotModel]) {
availableLLMs = models.sorted(by: { $0.modelName.lowercased() < $1.modelName.lowercased()})
NotificationCenter.default.post(name: .gitHubCopilotModelsDidChange, object: nil)
}
public static func getAvailableLLMs() -> [CopilotModel] {
return availableLLMs
}
public static func hasLLMs() -> Bool {
return !availableLLMs.isEmpty
}
public static func clearLLMs() {
availableLLMs = []
NotificationCenter.default.post(name: .gitHubCopilotModelsDidChange, object: nil)
}
}