parent
22766c27c7
commit
e7dcc53b55
@ -209,7 +209,6 @@ const ModelLoadBalancingEntryModal: FC<ModelModalProps> = ({
|
|||||||
|
|
||||||
const res = await validateLoadBalancingCredentials(
|
const res = await validateLoadBalancingCredentials(
|
||||||
providerFormSchemaPredefined,
|
providerFormSchemaPredefined,
|
||||||
provider.plugin_id,
|
|
||||||
provider.provider,
|
provider.provider,
|
||||||
{
|
{
|
||||||
...value,
|
...value,
|
||||||
|
@ -33,10 +33,10 @@ const ModelListItem = ({ model, provider, isConfigurable, onConfig, onModifyLoad
|
|||||||
|
|
||||||
const toggleModelEnablingStatus = useCallback(async (enabled: boolean) => {
|
const toggleModelEnablingStatus = useCallback(async (enabled: boolean) => {
|
||||||
if (enabled)
|
if (enabled)
|
||||||
await enableModel(`/workspaces/current/model-providers/${provider.plugin_id}/${provider.provider}/models/enable`, { model: model.model, model_type: model.model_type })
|
await enableModel(`/workspaces/current/model-providers/${provider.provider}/models/enable`, { model: model.model, model_type: model.model_type })
|
||||||
else
|
else
|
||||||
await disableModel(`/workspaces/current/model-providers/${provider.plugin_id}/${provider.provider}/models/disable`, { model: model.model, model_type: model.model_type })
|
await disableModel(`/workspaces/current/model-providers/${provider.provider}/models/disable`, { model: model.model, model_type: model.model_type })
|
||||||
}, [model.model, model.model_type, provider.plugin_id, provider.provider])
|
}, [model.model, model.model_type, provider.provider])
|
||||||
|
|
||||||
const { run: debouncedToggleModelEnablingStatus } = useDebounceFn(toggleModelEnablingStatus, { wait: 500 })
|
const { run: debouncedToggleModelEnablingStatus } = useDebounceFn(toggleModelEnablingStatus, { wait: 500 })
|
||||||
|
|
||||||
|
@ -56,14 +56,14 @@ export const validateCredentials = async (predefined: boolean, provider: string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validateLoadBalancingCredentials = async (predefined: boolean, pluginID: string, provider: string, v: FormValue, id?: string): Promise<{
|
export const validateLoadBalancingCredentials = async (predefined: boolean, provider: string, v: FormValue, id?: string): Promise<{
|
||||||
status: ValidatedStatus
|
status: ValidatedStatus
|
||||||
message?: string
|
message?: string
|
||||||
}> => {
|
}> => {
|
||||||
const { __model_name, __model_type, ...credentials } = v
|
const { __model_name, __model_type, ...credentials } = v
|
||||||
try {
|
try {
|
||||||
const res = await validateModelLoadBalancingCredentials({
|
const res = await validateModelLoadBalancingCredentials({
|
||||||
url: `/workspaces/current/model-providers/${pluginID}/${provider}/models/load-balancing-configs/${id ? `${id}/` : ''}credentials-validate`,
|
url: `/workspaces/current/model-providers/${provider}/models/load-balancing-configs/${id ? `${id}/` : ''}credentials-validate`,
|
||||||
body: {
|
body: {
|
||||||
model: __model_name,
|
model: __model_name,
|
||||||
model_type: __model_type,
|
model_type: __model_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user