Skip to content

Commit b9029ca

Browse files
committedMar 6, 2025·
Pre-release 0.31.105
1 parent 090e1e6 commit b9029ca

File tree

49 files changed

+1285
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1285
-362
lines changed
 

‎Core/Package.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ let package = Package(
191191
.product(name: "Cache", package: "Tool"),
192192
.product(name: "MarkdownUI", package: "swift-markdown-ui"),
193193
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
194-
.product(name: "SwiftUIFlowLayout", package: "swiftui-flow-layout")
194+
.product(name: "SwiftUIFlowLayout", package: "swiftui-flow-layout"),
195+
.product(name: "Persist", package: "Tool")
195196
]
196197
),
197198
.testTarget(

‎Core/Sources/ChatService/ChatService.swift

+19-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Status
1010

1111
public protocol ChatServiceType {
1212
var memory: ContextAwareAutoManagedChatMemory { get set }
13-
func send(_ id: String, content: String, skillSet: [ConversationSkill], references: [FileReference]) async throws
13+
func send(_ id: String, content: String, skillSet: [ConversationSkill], references: [FileReference], model: String?) async throws
1414
func stopReceivingMessage() async
1515
func upvote(_ id: String, _ rating: ConversationRating) async
1616
func downvote(_ id: String, _ rating: ConversationRating) async
@@ -82,7 +82,7 @@ public final class ChatService: ChatServiceType, ObservableObject {
8282
return ChatService(provider: provider)
8383
}
8484

85-
public func send(_ id: String, content: String, skillSet: Array<ConversationSkill>, references: Array<FileReference>) async throws {
85+
public func send(_ id: String, content: String, skillSet: Array<ConversationSkill>, references: Array<FileReference>, model: String? = nil) async throws {
8686
guard activeRequestId == nil else { return }
8787
let workDoneToken = UUID().uuidString
8888
activeRequestId = workDoneToken
@@ -115,7 +115,8 @@ public final class ChatService: ChatServiceType, ObservableObject {
115115
workspaceFolder: "",
116116
skills: skillCapabilities,
117117
ignoredSkills: ignoredSkills,
118-
references: references)
118+
references: references,
119+
model: model)
119120
self.skillSet = skillSet
120121
try await send(request)
121122
}
@@ -258,6 +259,11 @@ public final class ChatService: ChatServiceType, ObservableObject {
258259
return nil
259260
}
260261

262+
public func copilotModels() async -> [CopilotModel] {
263+
guard let models = try? await conversationProvider?.models() else { return [] }
264+
return models
265+
}
266+
261267
public func handleSingleRoundDialogCommand(
262268
systemPrompt: String?,
263269
overwriteSystemPrompt: Bool,
@@ -334,6 +340,16 @@ public final class ChatService: ChatServiceType, ObservableObject {
334340
await memory.removeMessage(progress.turnId)
335341
await memory.appendMessage(errorMessage)
336342
}
343+
} else if CLSError.code == 400 && CLSError.message.contains("model is not supported") {
344+
Task {
345+
let errorMessage = ChatMessage(
346+
id: progress.turnId,
347+
role: .assistant,
348+
content: "",
349+
errorMessage: "Oops, the model is not supported. Please enable it first in [GitHub Copilot settings](https://github.com/settings/copilot)."
350+
)
351+
await memory.appendMessage(errorMessage)
352+
}
337353
} else {
338354
Task {
339355
let errorMessage = ChatMessage(

0 commit comments

Comments
 (0)
Please sign in to comment.