Paste and drop images into every box that talks to an agent

This commit is contained in:
Ian Gulliver
2026-10-20 17:32:32 -07:00
parent 49f57b73fc
commit 15482473f7
9 changed files with 133 additions and 83 deletions
+3 -3
View File
@@ -347,12 +347,12 @@ final class Store {
sessions[taskId] = list
}
func messageTask(_ taskId: String, _ text: String) async throws {
func messageTask(_ taskId: String, _ text: String, images ids: [String]? = nil) async throws {
let sessions = try await api.client.listSessions(path: .init(taskId: taskId)).ok.body.json
if let live = sessions.last(where: { $0.state != .completed }) {
_ = try await api.client.sendMessage(path: .init(sessionId: live.id), body: .json(.init(text: text))).accepted
_ = try await api.client.sendMessage(path: .init(sessionId: live.id), body: .json(.init(text: text, images: ids))).accepted
} else {
_ = try await api.client.createSession(path: .init(taskId: taskId), body: .json(.init(prompt: text))).created
_ = try await api.client.createSession(path: .init(taskId: taskId), body: .json(.init(prompt: text, images: ids))).created
}
}