diff --git a/web/app/(shareLayout)/components/authenticated-layout.tsx b/web/app/(shareLayout)/components/authenticated-layout.tsx index 113f3b5680..c874990448 100644 --- a/web/app/(shareLayout)/components/authenticated-layout.tsx +++ b/web/app/(shareLayout)/components/authenticated-layout.tsx @@ -47,7 +47,7 @@ const AuthenticatedLayout = ({ children }: { children: React.ReactNode }) => { await webAppLogout(shareCode!) const url = getSigninUrl() router.replace(url) - }, [getSigninUrl, router, webAppLogout, shareCode]) + }, [getSigninUrl, router, shareCode]) if (appInfoError) { return ( diff --git a/web/app/(shareLayout)/components/splash.tsx b/web/app/(shareLayout)/components/splash.tsx index 9f89a03993..a2b847f74f 100644 --- a/web/app/(shareLayout)/components/splash.tsx +++ b/web/app/(shareLayout)/components/splash.tsx @@ -31,7 +31,7 @@ const Splash: FC = ({ children }) => { await webAppLogout(shareCode!) const url = getSigninUrl() router.replace(url) - }, [getSigninUrl, router, webAppLogout, shareCode]) + }, [getSigninUrl, router, shareCode]) const [isLoading, setIsLoading] = useState(true) useEffect(() => { diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx index 5ff8e61ff6..fc6bb7465c 100644 --- a/web/app/components/base/chat/chat-with-history/hooks.tsx +++ b/web/app/components/base/chat/chat-with-history/hooks.tsx @@ -1,3 +1,4 @@ +import type { ExtraContent } from '../chat/type' import type { Callback, ChatConfig, @@ -9,6 +10,7 @@ import type { AppData, ConversationItem, } from '@/models/share' +import type { HumanInputFilledFormData, HumanInputFormData } from '@/types/workflow' import { useLocalStorageState } from 'ahooks' import { noop } from 'es-toolkit/function' import { produce } from 'immer' @@ -56,6 +58,22 @@ function getFormattedChatList(messages: any[]) { parentMessageId: item.parent_message_id || undefined, }) const answerFiles = item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [] + const humanInputFormDataList: HumanInputFormData[] = [] + const humanInputFilledFormDataList: HumanInputFilledFormData[] = [] + if (item.status === 'paused') { + item.extra_contents?.forEach((content: ExtraContent) => { + if (content.type === 'human_input' && !content.submitted) { + humanInputFormDataList.push(content.form_definition) + } + }) + } + else if (item.status === 'normal') { + item.extra_contents?.forEach((content: ExtraContent) => { + if (content.type === 'human_input' && content.submitted) { + humanInputFilledFormDataList.push(content.form_submission_data) + } + }) + } newChatList.push({ id: item.id, content: item.answer, @@ -65,6 +83,8 @@ function getFormattedChatList(messages: any[]) { citation: item.retriever_resources, message_files: getProcessedFilesFromResponse(answerFiles.map((item: any) => ({ ...item, related_id: item.id, upload_file_id: item.upload_file_id }))), parentMessageId: `question-${item.id}`, + humanInputFormDataList, + humanInputFilledFormDataList, }) }) return newChatList diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx index 1d69b5f905..29e9a2d33c 100644 --- a/web/app/components/base/chat/chat/answer/index.tsx +++ b/web/app/components/base/chat/chat/answer/index.tsx @@ -144,7 +144,7 @@ const Answer: FC = ({ {hasHumanInputs && (
{/** Render workflow process */} { diff --git a/web/app/components/base/chat/chat/type.ts b/web/app/components/base/chat/chat/type.ts index 6292c35aca..185bdb0553 100644 --- a/web/app/components/base/chat/chat/type.ts +++ b/web/app/components/base/chat/chat/type.ts @@ -68,6 +68,18 @@ export type CitationItem = { word_count: number } +export type ExtraContent + = { + type: 'human_input' + submitted: false + form_definition: HumanInputFormData + } + | { + type: 'human_input' + submitted: true + form_submission_data: HumanInputFilledFormData + } + export type IChatItem = { id: string content: string @@ -111,6 +123,7 @@ export type IChatItem = { // for human input humanInputFormDataList?: HumanInputFormData[] humanInputFilledFormDataList?: HumanInputFilledFormData[] + extra_contents?: ExtraContent[] } export type Metadata = {