diff --git a/core/index.d.ts b/core/index.d.ts index a4f76ead0..46454c603 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -403,6 +403,7 @@ interface ToolCallState { toolCallId: string; toolCall: ToolCall; status: ToolStatus; + parsedArgs: any; } export interface ChatHistoryItem { diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index 3af1b1a4f..b9e196b02 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -74,6 +74,9 @@ function constructSystemPrompt(model: string): string | null { return null; } +const CANCELED_TOOL_CALL_MESSAGE = + "This tool call was cancelled by the user. You should clarify next steps, as they don't wish for you to use this tool."; + export function constructMessages( history: ChatHistory, model: string, @@ -104,6 +107,12 @@ export function constructMessages( ...historyItem.message, content, }); + } else if (historyItem.toolCallState?.status === "canceled") { + // Canceled tool call + msgs.push({ + ...historyItem.message, + content: CANCELED_TOOL_CALL_MESSAGE, + }); } else { msgs.push(historyItem.message); } diff --git a/gui/src/components/StepContainer/ResponseActions.tsx b/gui/src/components/StepContainer/ResponseActions.tsx index 3769907ef..af8623939 100644 --- a/gui/src/components/StepContainer/ResponseActions.tsx +++ b/gui/src/components/StepContainer/ResponseActions.tsx @@ -37,7 +37,7 @@ export default function ResponseActions({ } return ( -