Feat: Make the agent dialog window exposed to the outside world fill in the begin form #3221 (#9124)

### What problem does this PR solve?
Feat: Make the agent dialog window exposed to the outside world fill in
the begin form #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-07-31 09:34:45 +08:00
committed by GitHub
parent d9fe279dde
commit 6a170b2f6e
12 changed files with 141 additions and 32 deletions

View File

@ -10,6 +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 { useGetSharedChatSearchParams } from '@/pages/chat/shared-hooks';
import agentService, {
fetchAgentLogsByCanvasId,
@ -46,6 +47,7 @@ export const enum AgentApiAction {
FetchVersionList = 'fetchVersionList',
FetchVersion = 'fetchVersion',
FetchAgentAvatar = 'fetchAgentAvatar',
FetchExternalAgentInputs = 'fetchExternalAgentInputs',
}
export const EmptyDsl = {
@ -584,3 +586,28 @@ export const useFetchAgentLog = (searchParams: IAgentLogsRequest) => {
return { data, loading };
};
export const useFetchExternalAgentInputs = () => {
const { sharedId } = useGetSharedChatSearchParams();
const {
data,
isFetching: loading,
refetch,
} = useQuery<Record<string, BeginQuery>>({
queryKey: [AgentApiAction.FetchExternalAgentInputs],
initialData: {} as Record<string, BeginQuery>,
refetchOnReconnect: false,
refetchOnMount: false,
refetchOnWindowFocus: false,
gcTime: 0,
enabled: !!sharedId,
queryFn: async () => {
const { data } = await agentService.fetchExternalAgentInputs(sharedId!);
return data?.data ?? {};
},
});
return { data, loading, refetch };
};