feat: add DYNAMIC_SELECT parameter type for dynamic options in parameter entities (#21425)

This commit is contained in:
Yeuoly
2025-06-26 17:44:14 +08:00
committed by GitHub
parent ae00ba44db
commit cea6522122
15 changed files with 293 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
import { useCallback, useEffect } from 'react'
import type {
FormOption,
ModelProvider,
} from '@/app/components/header/account-setting/model-provider-page/declarations'
import { fetchModelProviderModelList } from '@/service/common'
@@ -477,7 +478,7 @@ export const usePluginTaskList = (category?: PluginType) => {
refreshPluginList(category ? { category } as any : undefined, !category)
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isRefetching])
const handleRefetch = useCallback(() => {
@@ -571,3 +572,17 @@ export const usePluginInfo = (providerName?: string) => {
enabled: !!providerName,
})
}
export const useFetchDynamicOptions = (plugin_id: string, provider: string, action: string, parameter: string, provider_type: 'tool') => {
return useMutation({
mutationFn: () => get<{ options: FormOption[] }>('/workspaces/current/plugin/parameters/dynamic-options', {
params: {
plugin_id,
provider,
action,
parameter,
provider_type,
},
}),
})
}