This commit is contained in:
archer 2025-09-08 17:35:51 +08:00
parent 7a26cd8a7c
commit 38bf40d710
No known key found for this signature in database
GPG Key ID: 4446499B846D4A9E
4 changed files with 12 additions and 4 deletions

View File

@ -94,6 +94,7 @@ type Response = DispatchNodeResultType<{
export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise<Response> => {
let {
node: { nodeId, name, isEntry, version, inputs },
lang,
runtimeNodes,
runtimeEdges,
histories,
@ -160,7 +161,7 @@ export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise
};
};
const subAppList = await getSubApps({ subApps: runtimeSubApps, urls: fileLinks });
const subAppList = await getSubApps({ subApps: runtimeSubApps, urls: fileLinks, lang });
console.log(JSON.stringify(subAppList, null, 2));
// const combinedSystemPrompt = `${parseAgentSystem({ systemPrompt, toolNodesMap })}\n\n${getTopAgentConstantPrompt()}`;
@ -262,7 +263,11 @@ export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise
handleToolResponse: async ({ call, messages }) => {
const toolId = call.function.name;
const { response, usages, isEnd } = await (async () => {
const {
response,
usages = [],
isEnd
} = await (async () => {
if (toolId === SubAppIds.stop) {
return {
response: '',

View File

@ -16,12 +16,15 @@ import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/
import { MongoApp } from '../../../../../app/schema';
import { getMCPChildren } from '../../../../../app/mcp';
import { getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils';
import type { localeType } from '@fastgpt/global/common/i18n/type';
export const getSubApps = async ({
subApps,
lang,
urls
}: {
subApps: RuntimeNodeItemType[];
lang?: localeType;
urls?: string[];
}): Promise<ChatCompletionTool[]> => {
// System Tools: Plan Agent, stop sign, model agent.
@ -101,7 +104,7 @@ export const getSubApps = async ({
if (systemToolId) {
const children = await getSystemToolRunTimeNodeFromSystemToolset({
toolSetNode: node,
lang: 'en'
lang
});
return getToolNode(children);
} else if (mcpToolsetVal) {

View File

@ -15,5 +15,5 @@ export type DispatchSubAppProps<T> = {
};
export type DispatchSubAppResponse = {
response: string;
usages: ChatNodeUsageType[];
usages?: ChatNodeUsageType[];
};