From 2b63266c4ab8260a2d02737f8b5ffc8ee58bab2e Mon Sep 17 00:00:00 2001 From: liuzhide <44251801+ch-liuzhide@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:48:57 +0800 Subject: [PATCH] [fix]: get chat bot detail (#347) * fix(icon): fix icon type error * fix(chat): fix bot id is new but still get config --- client/app/factory/edit/[id]/page.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/app/factory/edit/[id]/page.tsx b/client/app/factory/edit/[id]/page.tsx index a59d2a74..4a63efb6 100644 --- a/client/app/factory/edit/[id]/page.tsx +++ b/client/app/factory/edit/[id]/page.tsx @@ -106,6 +106,16 @@ export default function Edit({ params }: { params: { id: string } }) { [params?.id, botProfile?.id], ); + const botId = useMemo(() => { + if (!!params?.id && params?.id !== 'new') { + return params.id; + } else if (!!botProfile?.id) { + return botProfile.id; + } else { + return undefined; + } + }, [params?.id, botProfile?.id]); + const { data: config, isLoading } = useBotConfig( params?.id, !!params?.id && params?.id !== 'new', @@ -451,7 +461,7 @@ export default function Edit({ params }: { params: { id: string } }) { style={{ backgroundColor: '#FCFCFC', }} - token={params.id} + token={botId} apiDomain={API_HOST} apiUrl="/api/chat/stream_qa" prompt={botProfile?.prompt}