Save a default model per user, set from Settings

This commit is contained in:
Ian Gulliver
2026-10-18 00:57:51 -07:00
parent 17f09ecb7c
commit 10c6c84f74
10 changed files with 395 additions and 257 deletions
+7 -3
View File
@@ -92,7 +92,7 @@ final class Store {
todoBusy[key] = discuss ? "discuss" : "start"
Task {
do {
_ = try await api.client.startTodoItem(path: .init(projectId: projectId), body: .json(.init(title: title, model: models[0], discuss: discuss))).created
_ = try await api.client.startTodoItem(path: .init(projectId: projectId), body: .json(.init(title: title, model: defaultModel, discuss: discuss))).created
} catch {
overlays.showAlert(errorText(error))
}
@@ -108,7 +108,7 @@ final class Store {
todoBusy[key] = "start"
Task {
do {
_ = try await api.client.createTask(path: .init(projectId: projectId), body: .json(.init(title: title, prompt: brief, model: models[0]))).created
_ = try await api.client.createTask(path: .init(projectId: projectId), body: .json(.init(title: title, prompt: brief, model: defaultModel))).created
} catch {
overlays.showAlert(errorText(error))
}
@@ -126,7 +126,7 @@ final class Store {
let live = lead != nil && lead!.state != .completed
Task {
do {
_ = try await api.client.messageLead(body: .json(.init(text: "Let's discuss your suggestion \"\(title)\" before starting it:\n\n\(brief)", model: live ? nil : models[0]))).accepted
_ = try await api.client.messageLead(body: .json(.init(text: "Let's discuss your suggestion \"\(title)\" before starting it:\n\n\(brief)", model: live ? nil : defaultModel))).accepted
} catch {
overlays.showAlert(errorText(error))
}
@@ -208,6 +208,10 @@ final class Store {
focusTab(.reviews)
}
var defaultModel: String {
me!.defaultModel
}
func loadMe() async throws {
me = try await api.client.getMe().ok.body.json
}