Skip to content

Commit 333a8a6

Browse files
authored
update llama ui (#7)
1 parent 3afa19e commit 333a8a6

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"react-router-dom": "^7.8.0"
2020
},
2121
"devDependencies": {
22-
"@llamaindex/ui": "^1.0.3",
22+
"@llamaindex/ui": "^2.1.1",
2323
"@tailwindcss/postcss": "^4",
2424
"@types/canvas-confetti": "^1.9.0",
2525
"@types/node": "^20",

ui/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Routes, Route } from "react-router-dom";
22
import Home from "./pages/Home";
3-
import { ApiProvider, ApiClients, createWorkflowClient } from "@llamaindex/ui";
3+
import { ApiProvider, ApiClients, createWorkflowsClient } from "@llamaindex/ui";
44

55
const deploymentName =
66
import.meta.env.VITE_LLAMA_DEPLOY_DEPLOYMENT_NAME || "default";
77
const api: ApiClients = {
8-
workflowsClient: createWorkflowClient({
8+
workflowsClient: createWorkflowsClient({
99
baseUrl: `/deployments/${deploymentName}`,
1010
}),
1111
};

ui/src/pages/Home.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useState } from "react";
2-
import { useWorkflowTask, useWorkflowTaskCreate } from "@llamaindex/ui";
2+
import { useWorkflowHandler, useWorkflowRun } from "@llamaindex/ui";
33

44
export default function Home() {
55
const [taskId, setTaskId] = useState<string | null>(null);
6-
const createHandler = useWorkflowTaskCreate();
6+
const createHandler = useWorkflowRun();
77
return (
88
<div className="aurora-container relative min-h-screen overflow-hidden bg-background text-foreground">
99
<main className="relative mx-auto flex min-h-screen max-w-2xl px-6 flex-col gap-4 items-center justify-center">
@@ -27,7 +27,7 @@ export default function Home() {
2727
disabled={createHandler.isCreating}
2828
onClick={() =>
2929
createHandler
30-
.createTask("default", {
30+
.runWorkflow("default", {
3131
message: `${new Date().toLocaleTimeString()} PING`,
3232
})
3333
.then((task) => setTaskId(task.handler_id))
@@ -73,13 +73,13 @@ function RunButton({
7373

7474
function HandlerOutput({ handlerId }: { handlerId: string }) {
7575
// stream events and result from the workflow
76-
const taskData = useWorkflowTask(handlerId);
76+
const handler = useWorkflowHandler(handlerId);
7777

7878
// read workflow events here
79-
const pongs = taskData.events.filter((event) =>
79+
const pongs = handler.events.filter((event) =>
8080
event.type.match(/PongEvent$/),
8181
) as { type: string; data: { message: string } }[];
82-
const completed = taskData.events.find((event) =>
82+
const completed = handler.events.find((event) =>
8383
event.type.match(/WorkflowCompletedEvent$/),
8484
) as { type: string; data: { timestamp: string } } | undefined;
8585

0 commit comments

Comments
 (0)