@@ -17,8 +17,8 @@ import {
1717 Card ,
1818 CardContent ,
1919 cn ,
20- useWorkflowTaskCreate ,
21- useWorkflowTask ,
20+ useWorkflowRun ,
21+ useWorkflowHandler ,
2222} from "@llamaindex/ui" ;
2323import { AGENT_NAME } from "../libs/config" ;
2424import { toHumanResponseRawEvent } from "@/libs/utils" ;
@@ -32,7 +32,7 @@ interface Message {
3232 error ?: boolean ;
3333}
3434export 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 } ) ;
0 commit comments