tell llm tool was cancelled

This commit is contained in:
Nate 2024-11-29 14:58:44 -08:00
parent dfb358aace
commit 98582d00e4
4 changed files with 12 additions and 7 deletions

View file

@ -4,4 +4,5 @@ export const INSTRUCTIONS_BASE_ITEM: ContextItem = {
name: "Instructions",
description: "Instructions",
content: "",
hidden: true,
};

1
core/index.d.ts vendored
View file

@ -364,6 +364,7 @@ export interface ContextItem {
editable?: boolean;
icon?: string;
uri?: ContextItemUri;
hidden?: boolean;
}
export interface ContextItemWithId extends ContextItem {

View file

@ -5,7 +5,6 @@ import {
} from "@heroicons/react/24/outline";
import { ContextItemWithId } from "core";
import { ctxItemToRifWithContents } from "core/commands/util";
import { INSTRUCTIONS_BASE_ITEM } from "core/context/providers/utils";
import { getBasename } from "core/util";
import { useContext, useMemo, useState } from "react";
import { useSelector } from "react-redux";
@ -136,11 +135,7 @@ function ContextItemsPeek({
const [open, setOpen] = useState(false);
const ctxItems = useMemo(() => {
return (
contextItems?.filter(
(ctxItem) => !ctxItem.name.includes(INSTRUCTIONS_BASE_ITEM.name),
) ?? []
);
return contextItems?.filter((ctxItem) => !ctxItem.hidden) ?? [];
}, [contextItems]);
const isGatheringContext = useSelector(

View file

@ -27,7 +27,15 @@ export const cancelTool = createAsyncThunk<void, undefined, ThunkApiType>(
dispatch(
streamResponseAfterToolCall({
toolCallId: toolCallState.toolCallId,
toolOutput: [],
toolOutput: [
{
name: "Tool Cancelled",
description: "Tool Cancelled",
content:
"The tool call was cancelled by the user. Please try something else or request further instructions.",
hidden: true,
},
],
}),
);
},