Skip to content

Commit 947af97

Browse files
authored
Update llama ui (#5)
1 parent 9ad1e6a commit 947af97

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

test-proj/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"all-fix": "pnpm i && pnpm run lint && pnpm run format && pnpm run build"
1515
},
1616
"dependencies": {
17-
"@llamaindex/ui": "^1.0.2",
17+
"@llamaindex/ui": "^2.1.1",
1818
"@llamaindex/workflows-client": "^1.2.0",
1919
"@radix-ui/themes": "^3.2.1",
2020
"llama-cloud-services": "^0.3.6",

test-proj/ui/src/components/ChatBot.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
Card,
1818
CardContent,
1919
cn,
20-
useWorkflowTaskCreate,
21-
useWorkflowTask,
20+
useWorkflowRun,
21+
useWorkflowHandler,
2222
} from "@llamaindex/ui";
2323
import { AGENT_NAME } from "../libs/config";
2424
import { toHumanResponseRawEvent } from "@/libs/utils";
@@ -32,7 +32,7 @@ interface Message {
3232
error?: boolean;
3333
}
3434
export default function ChatBot() {
35-
const { createTask } = useWorkflowTaskCreate();
35+
const { runWorkflow } = useWorkflowRun();
3636
const messagesEndRef = useRef<HTMLDivElement>(null);
3737
const inputRef = useRef<HTMLInputElement>(null);
3838
const [messages, setMessages] = useState<Message[]>([]);
@@ -108,7 +108,7 @@ export default function ChatBot() {
108108
useEffect(() => {
109109
(async () => {
110110
if (!handlerId) {
111-
const handler = await createTask("chat", {
111+
const handler = await runWorkflow("chat", {
112112
index_name: defaultIndexName,
113113
session_id: sessionIdRef.current,
114114
});
@@ -118,7 +118,7 @@ export default function ChatBot() {
118118
}, []);
119119

120120
// Subscribe to task/events using hook (auto stream when handler exists)
121-
const { events } = useWorkflowTask(handlerId ?? "", Boolean(handlerId));
121+
const { events } = useWorkflowHandler(handlerId ?? "", Boolean(handlerId));
122122

123123
// Process streamed events into messages
124124
useEffect(() => {
@@ -180,7 +180,7 @@ export default function ChatBot() {
180180

181181
const startChatIfNeeded = async (): Promise<string> => {
182182
if (handlerId) return handlerId;
183-
const handler = await createTask("chat", {
183+
const handler = await runWorkflow("chat", {
184184
index_name: defaultIndexName,
185185
session_id: sessionIdRef.current,
186186
});

test-proj/ui/src/libs/clients.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
ApiClients,
33
cloudApiClient,
4-
createWorkflowClient,
5-
createWorkflowConfig,
4+
createWorkflowsClient,
5+
createWorkflowsConfig,
66
} from "@llamaindex/ui";
77
import { AGENT_NAME } from "./config";
88

@@ -22,8 +22,8 @@ cloudApiClient.setConfig({
2222
},
2323
});
2424

25-
const workflowsClient = createWorkflowClient(
26-
createWorkflowConfig({
25+
const workflowsClient = createWorkflowsClient(
26+
createWorkflowsConfig({
2727
baseUrl: `/deployments/${AGENT_NAME}/`,
2828
headers: {
2929
...(platformToken && { authorization: `Bearer ${platformToken}` }),

ui/package.json.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"all-fix": "pnpm i && pnpm run lint && pnpm run format && pnpm run build"
1515
},
1616
"dependencies": {
17-
"@llamaindex/ui": "^1.0.2",
17+
"@llamaindex/ui": "^2.1.1",
1818
"@llamaindex/workflows-client": "^1.2.0",
1919
"@radix-ui/themes": "^3.2.1",
2020
"llama-cloud-services": "^0.3.6",

ui/src/components/ChatBot.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import {
1717
Card,
1818
CardContent,
1919
cn,
20-
useWorkflowTaskCreate,
21-
useWorkflowTask,
20+
useWorkflowRun,
21+
useWorkflowHandler,
2222
} from "@llamaindex/ui";
2323
import { AGENT_NAME } from "../libs/config";
2424
import { toHumanResponseRawEvent } from "@/libs/utils";
@@ -32,7 +32,7 @@ interface Message {
3232
error?: boolean;
3333
}
3434
export default function ChatBot() {
35-
const { createTask } = useWorkflowTaskCreate();
35+
const { runWorkflow } = useWorkflowRun();
3636
const messagesEndRef = useRef<HTMLDivElement>(null);
3737
const inputRef = useRef<HTMLInputElement>(null);
3838
const [messages, setMessages] = useState<Message[]>([]);
@@ -108,7 +108,7 @@ export default function ChatBot() {
108108
useEffect(() => {
109109
(async () => {
110110
if (!handlerId) {
111-
const handler = await createTask("chat", {
111+
const handler = await runWorkflow("chat", {
112112
index_name: defaultIndexName,
113113
session_id: sessionIdRef.current,
114114
});
@@ -118,7 +118,7 @@ export default function ChatBot() {
118118
}, []);
119119

120120
// Subscribe to task/events using hook (auto stream when handler exists)
121-
const { events } = useWorkflowTask(handlerId ?? "", Boolean(handlerId));
121+
const { events } = useWorkflowHandler(handlerId ?? "", Boolean(handlerId));
122122

123123
// Process streamed events into messages
124124
useEffect(() => {
@@ -180,7 +180,7 @@ export default function ChatBot() {
180180

181181
const startChatIfNeeded = async (): Promise<string> => {
182182
if (handlerId) return handlerId;
183-
const handler = await createTask("chat", {
183+
const handler = await runWorkflow("chat", {
184184
index_name: defaultIndexName,
185185
session_id: sessionIdRef.current,
186186
});

ui/src/libs/clients.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
22
ApiClients,
33
cloudApiClient,
4-
createWorkflowClient,
5-
createWorkflowConfig,
4+
createWorkflowsClient,
5+
createWorkflowsConfig,
66
} from "@llamaindex/ui";
77
import { AGENT_NAME } from "./config";
88

@@ -22,8 +22,8 @@ cloudApiClient.setConfig({
2222
},
2323
});
2424

25-
const workflowsClient = createWorkflowClient(
26-
createWorkflowConfig({
25+
const workflowsClient = createWorkflowsClient(
26+
createWorkflowsConfig({
2727
baseUrl: `/deployments/${AGENT_NAME}/`,
2828
headers: {
2929
...(platformToken && { authorization: `Bearer ${platformToken}` }),

0 commit comments

Comments
 (0)