This commit is contained in:
bracesproul
2025-03-10 14:58:51 -07:00
parent 09deba47a3
commit 12434ebd1a
2 changed files with 34 additions and 25 deletions

View File

@@ -80,21 +80,24 @@ export default function useInterruptedActions({
} }
}, [interrupt]); }, [interrupt]);
const resumeRun = ( const resumeRun = (response: HumanResponse[]): boolean => {
response: HumanResponse[],
): boolean => {
try { try {
thread.submit({}, { thread.submit(
command: { {},
resume: response, {
update: { command: {
messages: [{ resume: response,
type: "human", update: {
content: `Sending type '${response[0].type}' to interrupt...` messages: [
}] {
} type: "human",
content: `Sending type '${response[0].type}' to interrupt...`,
},
],
},
},
}, },
}) );
return true; return true;
} catch (e: any) { } catch (e: any) {
console.error("Error sending human response", e); console.error("Error sending human response", e);
@@ -258,17 +261,22 @@ export default function useInterruptedActions({
initialHumanInterruptEditValue.current = {}; initialHumanInterruptEditValue.current = {};
try { try {
thread.submit({}, { thread.submit(
command: { {},
goto: END, {
update: { command: {
messages: [{ goto: END,
type: "human", update: {
content: "Marking thread as resolved." messages: [
}] {
} type: "human",
} content: "Marking thread as resolved.",
}) },
],
},
},
},
);
toast("Success", { toast("Success", {
description: "Marked thread as resolved.", description: "Marked thread as resolved.",

View File

@@ -80,7 +80,8 @@ export function AssistantMessage({
const contentString = getContentString(message.content); const contentString = getContentString(message.content);
const thread = useStreamContext(); const thread = useStreamContext();
const isLastMessage = thread.messages[thread.messages.length - 1].id === message.id; const isLastMessage =
thread.messages[thread.messages.length - 1].id === message.id;
const meta = thread.getMessagesMetadata(message); const meta = thread.getMessagesMetadata(message);
const interrupt = thread.interrupt; const interrupt = thread.interrupt;
const parentCheckpoint = meta?.firstSeenState?.parent_checkpoint; const parentCheckpoint = meta?.firstSeenState?.parent_checkpoint;