Fix: Fix share-chat bugs (#9150)

### What problem does this PR solve?

Fix: Fix share-chat bugs #3221

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-08-01 12:38:29 +08:00
committed by GitHub
parent 5ccdb95008
commit ac53ef6216
10 changed files with 143 additions and 57 deletions

View File

@ -487,6 +487,10 @@ export const useSelectDerivedMessages = () => {
[setDerivedMessages],
);
const removeAllMessages = useCallback(() => {
setDerivedMessages([]);
}, [setDerivedMessages]);
return {
ref,
derivedMessages,
@ -498,6 +502,7 @@ export const useSelectDerivedMessages = () => {
addNewestOneQuestion,
addNewestOneAnswer,
removeMessagesAfterCurrentMessage,
removeAllMessages,
};
};

View File

@ -10,7 +10,7 @@ import { DSL, IFlow, IFlowTemplate } from '@/interfaces/database/flow';
import { IDebugSingleRequestBody } from '@/interfaces/request/agent';
import i18n from '@/locales/config';
import { BeginId } from '@/pages/agent/constant';
import { BeginQuery } from '@/pages/agent/interface';
import { IInputs } from '@/pages/agent/interface';
import { useGetSharedChatSearchParams } from '@/pages/chat/shared-hooks';
import agentService, {
fetchAgentLogsByCanvasId,
@ -596,9 +596,9 @@ export const useFetchExternalAgentInputs = () => {
data,
isFetching: loading,
refetch,
} = useQuery<Record<string, BeginQuery>>({
} = useQuery<IInputs>({
queryKey: [AgentApiAction.FetchExternalAgentInputs],
initialData: {} as Record<string, BeginQuery>,
initialData: {} as IInputs,
refetchOnReconnect: false,
refetchOnMount: false,
refetchOnWindowFocus: false,