mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-08 16:38:01 +08:00
Fix: dataflow log sheet shows the previous run's log in Go mode (#17790)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import message from '@/components/ui/message';
|
||||
import { useSendMessageBySSE } from '@/hooks/use-send-message';
|
||||
import i18n from '@/locales/config';
|
||||
import api from '@/utils/api';
|
||||
import { get } from 'lodash';
|
||||
import { useCallback, useState } from 'react';
|
||||
@@ -25,6 +26,13 @@ export function useRunDataflow({
|
||||
const success = saveRet?.code === 0;
|
||||
if (!success) return;
|
||||
|
||||
// The Go backend runs the dataflow debug synchronously, so the new
|
||||
// message_id only arrives with the run response (seconds later).
|
||||
// Clear the previous polling key first so the log sheet renders the
|
||||
// loading state instead of replaying the previous run's log, which is
|
||||
// still within its Redis TTL and would otherwise look like the current
|
||||
// result.
|
||||
setMessageId('');
|
||||
showLogSheet();
|
||||
const res = await send({
|
||||
agent_id: id,
|
||||
@@ -34,7 +42,14 @@ export function useRunDataflow({
|
||||
files: [fileResponseData.file],
|
||||
});
|
||||
|
||||
if (res && res?.response.status === 200 && get(res, 'data.code') === 0) {
|
||||
if (!res) {
|
||||
// send() swallowed a network/parse failure; without a new message_id
|
||||
// the sheet would stay on the previous run's log, so surface it.
|
||||
message.error(i18n.t('message.requestError'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (res?.response.status === 200 && get(res, 'data.code') === 0) {
|
||||
// fetch canvas
|
||||
setUploadedFileData(fileResponseData.file[0]);
|
||||
const msgId = get(res, 'data.data.message_id');
|
||||
|
||||
Reference in New Issue
Block a user