diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.ts index 4ef33a6bc6..8464d04425 100644 --- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts +++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts @@ -30,6 +30,9 @@ import { } from '@/app/components/base/file-uploader/utils' import type { FileEntity } from '@/app/components/base/file-uploader/types' import { getThreadMessages } from '@/app/components/base/chat/utils' +import { useInvalidAllLastRun } from '@/service/use-workflow' +import { useParams } from 'next/navigation' +import useSetWorkflowVarsWithValue from '@/app/components/workflow-app/hooks/use-fetch-workflow-inspect-vars' type GetAbortController = (abortController: AbortController) => void type SendCallback = { @@ -53,6 +56,9 @@ export const useChat = ( const taskIdRef = useRef('') const [isResponding, setIsResponding] = useState(false) const isRespondingRef = useRef(false) + const { appId } = useParams() + const invalidAllLastRun = useInvalidAllLastRun(appId as string) + const { fetchInspectVars } = useSetWorkflowVarsWithValue() const [suggestedQuestions, setSuggestQuestions] = useState([]) const suggestedQuestionsAbortControllerRef = useRef(null) const { @@ -288,6 +294,8 @@ export const useChat = ( }, async onCompleted(hasError?: boolean, errorMessage?: string) { handleResponding(false) + fetchInspectVars() + invalidAllLastRun() if (hasError) { if (errorMessage) { diff --git a/web/service/workflow.ts b/web/service/workflow.ts index b3243e3123..fed5456256 100644 --- a/web/service/workflow.ts +++ b/web/service/workflow.ts @@ -76,6 +76,7 @@ export const fetchCurrentValueOfConversationVariable: Fetcher => { // TODO: mock data. and need to get the rest data if has more data + console.log('fetchAllInspectVars', appId) await sleep(1000) const data = await Promise.resolve({ items: vars,