Feat: Allow users to select prompt word templates in agent operators. #9935 (#9936)

### What problem does this PR solve?

Feat: Allow users to select prompt word templates in agent operators.
#9935

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-09-05 15:48:57 +08:00
committed by GitHub
parent 6ff7cfe005
commit 79ca25ec7e
11 changed files with 108 additions and 18 deletions

View File

@ -51,6 +51,7 @@ export const enum AgentApiAction {
FetchAgentAvatar = 'fetchAgentAvatar',
FetchExternalAgentInputs = 'fetchExternalAgentInputs',
SetAgentSetting = 'setAgentSetting',
FetchPrompt = 'fetchPrompt',
}
export const EmptyDsl = {
@ -637,3 +638,24 @@ export const useSetAgentSetting = () => {
return { data, loading, setAgentSetting: mutateAsync };
};
export const useFetchPrompt = () => {
const {
data,
isFetching: loading,
refetch,
} = useQuery<Record<string, string>>({
queryKey: [AgentApiAction.FetchPrompt],
refetchOnReconnect: false,
refetchOnMount: false,
refetchOnWindowFocus: false,
gcTime: 0,
queryFn: async () => {
const { data } = await agentService.fetchPrompt();
return data?.data ?? {};
},
});
return { data, loading, refetch };
};