mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-26 12:52:48 +00:00
Some checks are pending
Document deploy / sync-images (push) Waiting to run
Document deploy / generate-timestamp (push) Blocked by required conditions
Document deploy / build-images (map[domain:https://fastgpt.cn suffix:cn]) (push) Blocked by required conditions
Document deploy / build-images (map[domain:https://fastgpt.io suffix:io]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.cn kube_config:KUBE_CONFIG_CN suffix:cn]) (push) Blocked by required conditions
Document deploy / update-images (map[deployment:fastgpt-docs domain:https://fastgpt.io kube_config:KUBE_CONFIG_IO suffix:io]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / get-vars (push) Waiting to run
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:amd64 runs-on:ubuntu-24.04]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / build-fastgpt-images (map[arch:arm64 runs-on:ubuntu-24.04-arm]) (push) Blocked by required conditions
Build FastGPT images in Personal warehouse / release-fastgpt-images (push) Blocked by required conditions
* refactor: remove ModelProviderIdType and update related types (#5549) * perf: model provider * fix eval create split (#5570) * git rebase --continuedoc * add more variable types (#5540) * variable types * password * time picker * internal var * file * fix-test * time select default value & range * password & type render * fix * fix build * fix * move method * split date select * icon * perf: variable code * prompt editor add markdown plugin (#5556) * editor markdown * fix build * pnpm lock * add props * update code * fix list * editor ui * fix variable reset (#5586) * perf: variables type code * customize lexical indent (#5588) * perf: multiple selector * perf: tab plugin * doc * refactor: update workflow constants to use ToolTypeEnum (#5491) * refactor: replace FlowNodeTemplateTypeEnum with string literals in workflow templates * perf: tool type --------- Co-authored-by: archer <545436317@qq.com> * update doc * fix: make table's row more natural while dragging it (#5596) * feat: add APIGetTemplate function and refactor template fetching logic (#5498) * feat: add APIGetTemplate function and refactor template fetching logic * chore: adjust the code * chore: update sdk --------- Co-authored-by: FinleyGe <m13203533462@163.com> * perf init system * doc * remove log * remove i18n * perf: variables render --------- Co-authored-by: Ctrlz <143257420+ctrlz526@users.noreply.github.com> Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: 伍闲犬 <whoeverimf5@gmail.com> Co-authored-by: FinleyGe <m13203533462@163.com>
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import type { I18nStringStrictType, ToolTypeEnum } from '@fastgpt/global/sdk/fastgpt-plugin';
|
|
import { RunToolWithStream } from '@fastgpt/global/sdk/fastgpt-plugin';
|
|
import { PluginSourceEnum } from '@fastgpt/global/core/app/plugin/constants';
|
|
import { pluginClient, BASE_URL, TOKEN } from '../../../thirdProvider/fastgptPlugin';
|
|
import { addLog } from '../../../common/system/log';
|
|
import { retryFn } from '@fastgpt/global/common/system/utils';
|
|
|
|
export async function APIGetSystemToolList() {
|
|
const res = await pluginClient.tool.list();
|
|
|
|
if (res.status === 200) {
|
|
return res.body.map((item) => {
|
|
return {
|
|
...item,
|
|
id: `${PluginSourceEnum.systemTool}-${item.id}`,
|
|
parentId: item.parentId ? `${PluginSourceEnum.systemTool}-${item.parentId}` : undefined,
|
|
avatar:
|
|
item.avatar && item.avatar.startsWith('/imgs/tools/')
|
|
? `/api/system/plugin/tools/${item.avatar.replace('/imgs/tools/', '')}`
|
|
: item.avatar
|
|
};
|
|
});
|
|
}
|
|
|
|
return Promise.reject(res.body);
|
|
}
|
|
|
|
const runToolInstance = new RunToolWithStream({
|
|
baseUrl: BASE_URL,
|
|
token: TOKEN
|
|
});
|
|
export const APIRunSystemTool = runToolInstance.run.bind(runToolInstance);
|
|
|
|
// Tool Types Cache
|
|
type SystemToolTypeItem = {
|
|
type: ToolTypeEnum;
|
|
name: I18nStringStrictType;
|
|
};
|
|
|
|
export const getSystemToolTypes = (): Promise<SystemToolTypeItem[]> => {
|
|
return retryFn(async () => {
|
|
const res = await pluginClient.tool.getType();
|
|
|
|
if (res.status === 200) {
|
|
const toolTypes = res.body || [];
|
|
|
|
return toolTypes;
|
|
}
|
|
|
|
addLog.error('Get system tool type error', res.body);
|
|
return [];
|
|
});
|
|
};
|