Add a per-user lead agent and make the right pane task-focused
This commit is contained in:
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
import { post } from "./api.js";
|
||||
import { h } from "./dom.js";
|
||||
import { currentLead, state } from "./state.js";
|
||||
import { compactButton, mountChat } from "./task.js";
|
||||
const leadSource = {
|
||||
key: () => "lead",
|
||||
events: () => state.leadTranscript,
|
||||
session: currentLead,
|
||||
root: () => "",
|
||||
taskId: () => undefined,
|
||||
resetTopics: [],
|
||||
refreshTopics: ["lead.sessions"],
|
||||
transcriptTopic: "lead.transcript",
|
||||
streamTopic: "lead.stream",
|
||||
empty: "",
|
||||
canSend: () => true,
|
||||
placeholder: (s) => (s === "running" ? "Message your lead; it gets this when its turn ends" : "Message your lead. Paste or drop images to attach them."),
|
||||
send: async ({ text, images, model, firstModel, sessionId }) => {
|
||||
await post("/api/me/lead/messages", { body: { text, images, model: sessionId ? model : firstModel } });
|
||||
},
|
||||
};
|
||||
function leadHead() {
|
||||
return {
|
||||
render: (usage) => {
|
||||
const sess = currentLead();
|
||||
const live = sess && sess.state !== "completed" ? sess : undefined;
|
||||
return [h("div", { class: "head-actions session-actions" }, compactButton(live?.id, live?.state, live && usage(live.id)))];
|
||||
},
|
||||
};
|
||||
}
|
||||
export function mountLead(root) {
|
||||
return mountChat(root, leadSource, leadHead);
|
||||
}
|
||||
//# sourceMappingURL=lead.js.map
|
||||
Reference in New Issue
Block a user