Feat: Render agent setting dialog #3221 (#9312)

### What problem does this PR solve?

Feat: Render agent setting dialog #3221
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-08-08 11:00:55 +08:00
committed by GitHub
parent 1bd64dafcb
commit 58a64000ea
10 changed files with 339 additions and 25 deletions

View File

@ -48,6 +48,7 @@ export const enum AgentApiAction {
FetchVersion = 'fetchVersion',
FetchAgentAvatar = 'fetchAgentAvatar',
FetchExternalAgentInputs = 'fetchExternalAgentInputs',
SetAgentSetting = 'setAgentSetting',
}
export const EmptyDsl = {
@ -613,3 +614,30 @@ export const useFetchExternalAgentInputs = () => {
return { data, loading, refetch };
};
export const useSetAgentSetting = () => {
const { id } = useParams();
const queryClient = useQueryClient();
const {
data,
isPending: loading,
mutateAsync,
} = useMutation({
mutationKey: [AgentApiAction.SetAgentSetting],
mutationFn: async (params: any) => {
const ret = await agentService.settingCanvas({ id, ...params });
if (ret?.data?.code === 0) {
message.success('success');
queryClient.invalidateQueries({
queryKey: [AgentApiAction.FetchAgentDetail],
});
} else {
message.error(ret?.data?.data);
}
return ret?.data?.code;
},
});
return { data, loading, setAgentSetting: mutateAsync };
};