Download web/app/components/header/account-setting/plugin-page/utils.ts from Severian/dify: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/Severian/dify/resolve/main/web/app/components/header/account-setting/plugin-page/utils.ts
- Command line
-
hf download hf://spaces/Severian/dify/web/app/components/header/account-setting/plugin-page/utils.ts
-
curl -L -o utils.ts https://huggingface.co/spaces/Severian/dify/resolve/main/web/app/components/header/account-setting/plugin-page/utils.ts
1.23 kB
| import { ValidatedStatus } from '../key-validator/declarations' | |
| import { updatePluginProviderAIKey, validatePluginProviderKey } from '@/service/common' | |
| export const validatePluginKey = async (pluginType: string, body: any) => { | |
| try { | |
| const res = await validatePluginProviderKey({ | |
| url: `/workspaces/current/tool-providers/${pluginType}/credentials-validate`, | |
| body, | |
| }) | |
| if (res.result === 'success') | |
| return Promise.resolve({ status: ValidatedStatus.Success }) | |
| else | |
| return Promise.resolve({ status: ValidatedStatus.Error, message: res.error }) | |
| } | |
| catch (e: any) { | |
| return Promise.resolve({ status: ValidatedStatus.Error, message: e.message }) | |
| } | |
| } | |
| export const updatePluginKey = async (pluginType: string, body: any) => { | |
| try { | |
| const res = await updatePluginProviderAIKey({ | |
| url: `/workspaces/current/tool-providers/${pluginType}/credentials`, | |
| body, | |
| }) | |
| if (res.result === 'success') | |
| return Promise.resolve({ status: ValidatedStatus.Success }) | |
| else | |
| return Promise.resolve({ status: ValidatedStatus.Error, message: res.error }) | |
| } | |
| catch (e: any) { | |
| return Promise.resolve({ status: ValidatedStatus.Error, message: e.message }) | |
| } | |
| } | |