From a979675b5a4b0341ce8863a0f5fde06dfb2cc3f5 Mon Sep 17 00:00:00 2001 From: Adrian Lyjak Date: Fri, 19 Sep 2025 19:02:46 -0400 Subject: [PATCH] Update llama ui --- test-proj/ui/package.json | 2 +- test-proj/ui/src/components/ChatBot.tsx | 12 ++++++------ test-proj/ui/src/libs/clients.ts | 8 ++++---- ui/package.json.jinja | 2 +- ui/src/components/ChatBot.tsx | 12 ++++++------ ui/src/libs/clients.ts | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test-proj/ui/package.json b/test-proj/ui/package.json index cc20ce9..8cbfa1e 100644 --- a/test-proj/ui/package.json +++ b/test-proj/ui/package.json @@ -14,7 +14,7 @@ "all-fix": "pnpm i && pnpm run lint && pnpm run format && pnpm run build" }, "dependencies": { - "@llamaindex/ui": "^1.0.2", + "@llamaindex/ui": "^2.1.1", "@llamaindex/workflows-client": "^1.2.0", "@radix-ui/themes": "^3.2.1", "llama-cloud-services": "^0.3.6", diff --git a/test-proj/ui/src/components/ChatBot.tsx b/test-proj/ui/src/components/ChatBot.tsx index 979506f..e65f929 100644 --- a/test-proj/ui/src/components/ChatBot.tsx +++ b/test-proj/ui/src/components/ChatBot.tsx @@ -17,8 +17,8 @@ import { Card, CardContent, cn, - useWorkflowTaskCreate, - useWorkflowTask, + useWorkflowRun, + useWorkflowHandler, } from "@llamaindex/ui"; import { AGENT_NAME } from "../libs/config"; import { toHumanResponseRawEvent } from "@/libs/utils"; @@ -32,7 +32,7 @@ interface Message { error?: boolean; } export default function ChatBot() { - const { createTask } = useWorkflowTaskCreate(); + const { runWorkflow } = useWorkflowRun(); const messagesEndRef = useRef(null); const inputRef = useRef(null); const [messages, setMessages] = useState([]); @@ -108,7 +108,7 @@ export default function ChatBot() { useEffect(() => { (async () => { if (!handlerId) { - const handler = await createTask("chat", { + const handler = await runWorkflow("chat", { index_name: defaultIndexName, session_id: sessionIdRef.current, }); @@ -118,7 +118,7 @@ export default function ChatBot() { }, []); // Subscribe to task/events using hook (auto stream when handler exists) - const { events } = useWorkflowTask(handlerId ?? "", Boolean(handlerId)); + const { events } = useWorkflowHandler(handlerId ?? "", Boolean(handlerId)); // Process streamed events into messages useEffect(() => { @@ -180,7 +180,7 @@ export default function ChatBot() { const startChatIfNeeded = async (): Promise => { if (handlerId) return handlerId; - const handler = await createTask("chat", { + const handler = await runWorkflow("chat", { index_name: defaultIndexName, session_id: sessionIdRef.current, }); diff --git a/test-proj/ui/src/libs/clients.ts b/test-proj/ui/src/libs/clients.ts index f6d521c..96024ad 100644 --- a/test-proj/ui/src/libs/clients.ts +++ b/test-proj/ui/src/libs/clients.ts @@ -1,8 +1,8 @@ import { ApiClients, cloudApiClient, - createWorkflowClient, - createWorkflowConfig, + createWorkflowsClient, + createWorkflowsConfig, } from "@llamaindex/ui"; import { AGENT_NAME } from "./config"; @@ -22,8 +22,8 @@ cloudApiClient.setConfig({ }, }); -const workflowsClient = createWorkflowClient( - createWorkflowConfig({ +const workflowsClient = createWorkflowsClient( + createWorkflowsConfig({ baseUrl: `/deployments/${AGENT_NAME}/`, headers: { ...(platformToken && { authorization: `Bearer ${platformToken}` }), diff --git a/ui/package.json.jinja b/ui/package.json.jinja index 36904ec..2369ee0 100644 --- a/ui/package.json.jinja +++ b/ui/package.json.jinja @@ -14,7 +14,7 @@ "all-fix": "pnpm i && pnpm run lint && pnpm run format && pnpm run build" }, "dependencies": { - "@llamaindex/ui": "^1.0.2", + "@llamaindex/ui": "^2.1.1", "@llamaindex/workflows-client": "^1.2.0", "@radix-ui/themes": "^3.2.1", "llama-cloud-services": "^0.3.6", diff --git a/ui/src/components/ChatBot.tsx b/ui/src/components/ChatBot.tsx index 979506f..e65f929 100644 --- a/ui/src/components/ChatBot.tsx +++ b/ui/src/components/ChatBot.tsx @@ -17,8 +17,8 @@ import { Card, CardContent, cn, - useWorkflowTaskCreate, - useWorkflowTask, + useWorkflowRun, + useWorkflowHandler, } from "@llamaindex/ui"; import { AGENT_NAME } from "../libs/config"; import { toHumanResponseRawEvent } from "@/libs/utils"; @@ -32,7 +32,7 @@ interface Message { error?: boolean; } export default function ChatBot() { - const { createTask } = useWorkflowTaskCreate(); + const { runWorkflow } = useWorkflowRun(); const messagesEndRef = useRef(null); const inputRef = useRef(null); const [messages, setMessages] = useState([]); @@ -108,7 +108,7 @@ export default function ChatBot() { useEffect(() => { (async () => { if (!handlerId) { - const handler = await createTask("chat", { + const handler = await runWorkflow("chat", { index_name: defaultIndexName, session_id: sessionIdRef.current, }); @@ -118,7 +118,7 @@ export default function ChatBot() { }, []); // Subscribe to task/events using hook (auto stream when handler exists) - const { events } = useWorkflowTask(handlerId ?? "", Boolean(handlerId)); + const { events } = useWorkflowHandler(handlerId ?? "", Boolean(handlerId)); // Process streamed events into messages useEffect(() => { @@ -180,7 +180,7 @@ export default function ChatBot() { const startChatIfNeeded = async (): Promise => { if (handlerId) return handlerId; - const handler = await createTask("chat", { + const handler = await runWorkflow("chat", { index_name: defaultIndexName, session_id: sessionIdRef.current, }); diff --git a/ui/src/libs/clients.ts b/ui/src/libs/clients.ts index f6d521c..96024ad 100644 --- a/ui/src/libs/clients.ts +++ b/ui/src/libs/clients.ts @@ -1,8 +1,8 @@ import { ApiClients, cloudApiClient, - createWorkflowClient, - createWorkflowConfig, + createWorkflowsClient, + createWorkflowsConfig, } from "@llamaindex/ui"; import { AGENT_NAME } from "./config"; @@ -22,8 +22,8 @@ cloudApiClient.setConfig({ }, }); -const workflowsClient = createWorkflowClient( - createWorkflowConfig({ +const workflowsClient = createWorkflowsClient( + createWorkflowsConfig({ baseUrl: `/deployments/${AGENT_NAME}/`, headers: { ...(platformToken && { authorization: `Bearer ${platformToken}` }),