Add Start and Discuss buttons to lead suggestions

This commit is contained in:
Ian Gulliver
2026-10-17 08:10:55 -07:00
parent 62df39c5da
commit f5a495997f
16 changed files with 318 additions and 156 deletions
+28
View File
@@ -91,6 +91,34 @@ final class Store {
}
}
func startSuggestion(_ projectId: String, _ title: String, brief: String, _ overlays: Overlays) {
let key = "\(projectId)\n\(title)"
if todoStarting.contains(key) {
return
}
todoStarting.insert(key)
Task {
do {
_ = try await api.client.createTask(path: .init(projectId: projectId), body: .json(.init(title: title, prompt: brief, model: models[0]))).created
} catch {
overlays.showAlert(errorText(error))
}
todoStarting.remove(key)
}
}
func discussSuggestion(_ title: String, brief: String, _ overlays: Overlays) {
let lead = currentLead()
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
} catch {
overlays.showAlert(errorText(error))
}
}
}
var transcript: [ByreEvent] {
selectedFeed?.events ?? []
}