Start a new task from a closed task
This commit is contained in:
@@ -134,7 +134,17 @@ final class ChatModel {
|
||||
member != nil
|
||||
}
|
||||
|
||||
var closed: Bool {
|
||||
guard let taskId, let task = store.findTask(taskId) else {
|
||||
return false
|
||||
}
|
||||
return task.status != .active
|
||||
}
|
||||
|
||||
var placeholder: String {
|
||||
if closed {
|
||||
return "Continue in a new task, started from main, whose agent picks up this conversation. Paste or drop images to attach them."
|
||||
}
|
||||
if team {
|
||||
return "Post to the team's board; every agent of the team gets it."
|
||||
}
|
||||
@@ -468,6 +478,14 @@ final class ChatModel {
|
||||
case .lead:
|
||||
_ = try await api.messageLead(body: .json(.init(text: text, images: images, model: sessionId != nil ? model : firstModel, sendId: sendID))).accepted
|
||||
case .task(let id):
|
||||
if closed {
|
||||
guard let sessionId else {
|
||||
throw ApiError(status: 0, message: "This task has no agent conversation to continue.")
|
||||
}
|
||||
let task = try await api.continueSession(path: .init(sessionId: sessionId), body: .json(.init(text: text, images: images, model: team ? nil : model, sendId: sendID))).created.body.json
|
||||
store.focusTask(task.id)
|
||||
return
|
||||
}
|
||||
if team {
|
||||
if images != nil {
|
||||
throw ApiError(status: 0, message: "The board takes text only; drop the images to post.")
|
||||
|
||||
Reference in New Issue
Block a user