fix: step-retry-error (#6829)

* step-retry-error

* error output

* doc

* lock

---------

Co-authored-by: archer <545436317@qq.com>
This commit is contained in:
YeYuheng
2026-04-28 17:10:36 +08:00
committed by GitHub
parent 423607ab5c
commit 83c02c979f
5 changed files with 2135 additions and 1364 deletions
@@ -15,9 +15,10 @@ description: 'FastGPT V4.15.0 更新说明'
## 🐛 修复
1. 修复 Agent v2 模式下,模型响应报错会导致 step 重复执行
## 代码优化
1. 重新调整代码结构,升级 nextjs 最新版,切换至 turbopack 构建,提高构建速度;升级容器默认 node 至 24。
2. 优化 Agent tool 声明和运行,统一所有 tool 的声明和运行方式。
3. 文件上传内容从 system prompt 中放到 user message 中,提高 cache 命中率
3. 文件上传内容从 system prompt 中放到 user message 中,提高 cache 命中率
+1 -1
View File
@@ -251,7 +251,7 @@
"content/self-host/upgrading/4-14/41481.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-14/4149.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-14/4149.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-15/4150.mdx": "2026-04-24T13:02:20+08:00",
"content/self-host/upgrading/4-15/4150.mdx": "2026-04-28T13:31:00+08:00",
"content/self-host/upgrading/outdated/40.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/outdated/40.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/outdated/41.en.mdx": "2026-04-26T21:08:47+08:00",
+2087 -1362
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -47,6 +47,7 @@
"postcss": "^8.5.10",
"tailwindcss": "^4.1.11",
"typescript": "^5.8.3",
"zhlint": "^0.8.2",
"zod": "^4.0.5"
}
}
@@ -3,6 +3,7 @@ import {
DispatchNodeResponseKeyEnum,
SseResponseEventEnum
} from '@fastgpt/global/core/workflow/runtime/constants';
import { textAdaptGptResponse } from '@fastgpt/global/core/workflow/runtime/utils';
import type {
DispatchNodeResultType,
ModuleDispatchProps
@@ -45,6 +46,7 @@ import type { AppFormEditFormType } from '@fastgpt/global/core/app/formEdit/type
import { getLogger, LogCategories } from '../../../../../common/logger';
import { env } from '../../../../../env';
import { dispatchPiAgent } from './piAgent';
import { i18nT } from '../../../../../../web/i18n/utils';
export type DispatchAgentModuleProps = ModuleDispatchProps<{
[NodeInputKeyEnum.history]?: ChatItemMiniType[];
@@ -477,8 +479,50 @@ export const dispatchRunAgent = async (props: DispatchAgentModuleProps): Promise
filesMap,
capabilityToolCallHandler
});
const stepCallErrorText =
result.nodeResponse.errorText?.trim() ||
(result.nodeResponse.finishReason === 'error'
? i18nT('chat:completion_finish_error')
: '');
nodeResponses.push(result.nodeResponse);
if (stepCallErrorText) {
assistantResponses.push({
text: { content: stepCallErrorText },
planId: agentPlan.planId,
stepId: step.id
});
workflowStreamResponse?.({
stepId: step.id,
event: SseResponseEventEnum.answer,
data: textAdaptGptResponse({ text: stepCallErrorText })
});
const answerText = assistantResponses
.filter((item) => item.text?.content)
.map((item) => item.text!.content)
.join('');
return {
data: {
[NodeOutputKeyEnum.answerText]: answerText
},
error: {
[NodeOutputKeyEnum.errorText]: stepCallErrorText
},
[DispatchNodeResponseKeyEnum.memories]: {
[masterMessagesKey]: undefined,
[agentPlanKey]: undefined,
[planMessagesKey]: undefined,
[planBufferKey]: undefined
},
[DispatchNodeResponseKeyEnum.assistantResponses]: assistantResponses,
[DispatchNodeResponseKeyEnum.nodeResponses]: nodeResponses,
[DispatchNodeResponseKeyEnum.toolResponses]: stepCallErrorText
};
}
// Merge response
const assistantResponse = GPTMessages2Chats({
messages: result.assistantMessages,