@copilotkit/react-core
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
19 lines (16 loc) • 589 B
text/typescript
import { useCopilotAction } from "./use-copilot-action";
import { FrontendAction } from "../types/frontend-action";
import { Parameter } from "@copilotkit/shared";
type UseToolCallArgs<T extends Parameter[] | [] = []> = {
available?: "disabled" | "enabled";
} & Pick<
FrontendAction<T>,
"name" | "description" | "parameters" | "handler" | "followUp" | "render"
>;
export function useFrontendTool<const T extends Parameter[] | [] = []>(
tool: UseToolCallArgs<T>,
dependencies?: any[],
) {
// Use the existing useCopilotAction hook
useCopilotAction<T>(tool, dependencies);
}