From 86610e6c435f778b4f45bf9e155f89e4300f4543 Mon Sep 17 00:00:00 2001 From: thucpn <thucsh2@gmail.com> Date: Fri, 14 Feb 2025 16:43:42 +0700 Subject: [PATCH] rename function in chat-ui --- .../app/components/ui/chat/custom/deep-research-card.tsx | 4 ++-- .../nextjs/app/components/ui/chat/tools/chat-tools.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/types/streaming/nextjs/app/components/ui/chat/custom/deep-research-card.tsx b/templates/types/streaming/nextjs/app/components/ui/chat/custom/deep-research-card.tsx index fc77cc70..bc6118e6 100644 --- a/templates/types/streaming/nextjs/app/components/ui/chat/custom/deep-research-card.tsx +++ b/templates/types/streaming/nextjs/app/components/ui/chat/custom/deep-research-card.tsx @@ -1,6 +1,6 @@ "use client"; -import { getCustomAnnotationData, useChatMessage } from "@llamaindex/chat-ui"; +import { getCustomAnnotation, useChatMessage } from "@llamaindex/chat-ui"; import { AlertCircle, CheckCircle2, @@ -146,7 +146,7 @@ export function DeepResearchCard({ className }: DeepResearchCardProps) { const { message } = useChatMessage(); const state = useMemo(() => { - const deepResearchEvents = getCustomAnnotationData<DeepResearchEvent>( + const deepResearchEvents = getCustomAnnotation<DeepResearchEvent>( message.annotations, (annotation) => annotation?.type === "deep_research_event", ); diff --git a/templates/types/streaming/nextjs/app/components/ui/chat/tools/chat-tools.tsx b/templates/types/streaming/nextjs/app/components/ui/chat/tools/chat-tools.tsx index 30606e5f..a7e4eb21 100644 --- a/templates/types/streaming/nextjs/app/components/ui/chat/tools/chat-tools.tsx +++ b/templates/types/streaming/nextjs/app/components/ui/chat/tools/chat-tools.tsx @@ -1,7 +1,7 @@ import { Message, MessageAnnotation, - getAnnotationData, + getChatUIAnnotation, useChatMessage, useChatUI, } from "@llamaindex/chat-ui"; @@ -22,7 +22,7 @@ export function ToolAnnotations() { // Get the tool data from the message annotations const annotations = message.annotations as MessageAnnotation[] | undefined; const toolData = annotations - ? (getAnnotationData(annotations, "tools") as unknown as ToolData[]) + ? (getChatUIAnnotation(annotations, "tools") as unknown as ToolData[]) : null; return toolData?.[0] ? ( <ChatTools data={toolData[0]} artifactVersion={artifactVersion} /> @@ -89,7 +89,7 @@ function getArtifactVersion( let versionIndex = 1; for (const m of messages) { const toolData = m.annotations - ? (getAnnotationData(m.annotations, "tools") as unknown as ToolData[]) + ? (getChatUIAnnotation(m.annotations, "tools") as unknown as ToolData[]) : null; if (toolData?.some((t) => t.toolCall.name === "artifact")) { -- GitLab