Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test-proj/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions test-proj/ui/src/components/ChatBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -32,7 +32,7 @@ interface Message {
error?: boolean;
}
export default function ChatBot() {
const { createTask } = useWorkflowTaskCreate();
const { runWorkflow } = useWorkflowRun();
const messagesEndRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLInputElement>(null);
const [messages, setMessages] = useState<Message[]>([]);
Expand Down Expand Up @@ -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,
});
Expand All @@ -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(() => {
Expand Down Expand Up @@ -180,7 +180,7 @@ export default function ChatBot() {

const startChatIfNeeded = async (): Promise<string> => {
if (handlerId) return handlerId;
const handler = await createTask("chat", {
const handler = await runWorkflow("chat", {
index_name: defaultIndexName,
session_id: sessionIdRef.current,
});
Expand Down
8 changes: 4 additions & 4 deletions test-proj/ui/src/libs/clients.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
ApiClients,
cloudApiClient,
createWorkflowClient,
createWorkflowConfig,
createWorkflowsClient,
createWorkflowsConfig,
} from "@llamaindex/ui";
import { AGENT_NAME } from "./config";

Expand All @@ -22,8 +22,8 @@ cloudApiClient.setConfig({
},
});

const workflowsClient = createWorkflowClient(
createWorkflowConfig({
const workflowsClient = createWorkflowsClient(
createWorkflowsConfig({
baseUrl: `/deployments/${AGENT_NAME}/`,
headers: {
...(platformToken && { authorization: `Bearer ${platformToken}` }),
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/ChatBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -32,7 +32,7 @@ interface Message {
error?: boolean;
}
export default function ChatBot() {
const { createTask } = useWorkflowTaskCreate();
const { runWorkflow } = useWorkflowRun();
const messagesEndRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLInputElement>(null);
const [messages, setMessages] = useState<Message[]>([]);
Expand Down Expand Up @@ -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,
});
Expand All @@ -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(() => {
Expand Down Expand Up @@ -180,7 +180,7 @@ export default function ChatBot() {

const startChatIfNeeded = async (): Promise<string> => {
if (handlerId) return handlerId;
const handler = await createTask("chat", {
const handler = await runWorkflow("chat", {
index_name: defaultIndexName,
session_id: sessionIdRef.current,
});
Expand Down
8 changes: 4 additions & 4 deletions ui/src/libs/clients.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
ApiClients,
cloudApiClient,
createWorkflowClient,
createWorkflowConfig,
createWorkflowsClient,
createWorkflowsConfig,
} from "@llamaindex/ui";
import { AGENT_NAME } from "./config";

Expand All @@ -22,8 +22,8 @@ cloudApiClient.setConfig({
},
});

const workflowsClient = createWorkflowClient(
createWorkflowConfig({
const workflowsClient = createWorkflowsClient(
createWorkflowsConfig({
baseUrl: `/deployments/${AGENT_NAME}/`,
headers: {
...(platformToken && { authorization: `Bearer ${platformToken}` }),
Expand Down