Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
b0a58b98
authored
Nov 29, 2025
by
Archer
Committed by
GitHub
Nov 29, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: toolcall stream response (#6009)
parent
a7929bd5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
72 additions
and
30 deletions
+72
-30
document/content/docs/toc.mdx
+1
-0
document/content/docs/upgrading/4-14/4144.mdx
+18
-0
document/content/docs/upgrading/4-14/meta.json
+1
-1
document/data/doc-last-modified.json
+1
-1
packages/global/core/chat/utils.ts
+2
-1
packages/global/core/workflow/template/system/agent.ts
+7
-0
packages/service/core/ai/llm/utils.ts
+5
-2
packages/service/core/workflow/dispatch/ai/tool/index.ts
+5
-2
packages/service/core/workflow/dispatch/ai/tool/toolCall.ts
+31
-23
packages/service/core/workflow/dispatch/ai/tool/type.d.ts
+1
-0
No files found.
document/content/docs/toc.mdx
View file @
b0a58b98
...
...
@@ -114,6 +114,7 @@ description: FastGPT 文档目录
- [/docs/upgrading/4-14/4141](/docs/upgrading/4-14/4141)
- [/docs/upgrading/4-14/4142](/docs/upgrading/4-14/4142)
- [/docs/upgrading/4-14/4143](/docs/upgrading/4-14/4143)
- [/docs/upgrading/4-14/4144](/docs/upgrading/4-14/4144)
- [/docs/upgrading/4-8/40](/docs/upgrading/4-8/40)
- [/docs/upgrading/4-8/41](/docs/upgrading/4-8/41)
- [/docs/upgrading/4-8/42](/docs/upgrading/4-8/42)
...
...
document/content/docs/upgrading/4-14/4144.mdx
0 → 100644
View file @
b0a58b98
---
title: 'V4.14.4(进行中)'
description: 'FastGPT V4.14.4 更新说明'
---
## 🚀 新增内容
1. 工具调用支持配置流输出
## ⚙️ 优化
## 🐛 修复
## 插件
document/content/docs/upgrading/4-14/meta.json
View file @
b0a58b98
{
"title"
:
"4.14.x"
,
"description"
:
""
,
"pages"
:
[
"4143"
,
"4142"
,
"4141"
,
"4140"
]
"pages"
:
[
"414
4"
,
"414
3"
,
"4142"
,
"4141"
,
"4140"
]
}
document/data/doc-last-modified.json
View file @
b0a58b98
...
...
@@ -117,7 +117,7 @@
"document/content/docs/upgrading/4-14/4140.mdx"
:
"2025-11-06T15:43:00+08:00"
,
"document/content/docs/upgrading/4-14/4141.mdx"
:
"2025-11-19T10:15:27+08:00"
,
"document/content/docs/upgrading/4-14/4142.mdx"
:
"2025-11-18T19:27:14+08:00"
,
"document/content/docs/upgrading/4-14/4143.mdx"
:
"2025-11-2
5T17:08:33
+08:00"
,
"document/content/docs/upgrading/4-14/4143.mdx"
:
"2025-11-2
6T20:52:05
+08:00"
,
"document/content/docs/upgrading/4-8/40.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/41.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/42.mdx"
:
"2025-08-02T19:38:37+08:00"
,
...
...
packages/global/core/chat/utils.ts
View file @
b0a58b98
...
...
@@ -70,7 +70,8 @@ export const getHistoryPreview = (
item
.
text
?.
content
||
item
?.
tools
?.
map
((
item
)
=>
item
.
toolName
).
join
(
','
)
||
''
);
})
.
join
(
''
)
||
''
.
join
(
''
)
.
trim
()
||
''
);
}
return
''
;
...
...
packages/global/core/workflow/template/system/agent.ts
View file @
b0a58b98
...
...
@@ -53,6 +53,13 @@ export const AgentNode: FlowNodeTemplateType = {
valueType
:
WorkflowIOValueTypeEnum
.
number
},
{
key
:
NodeInputKeyEnum
.
aiChatIsResponseText
,
renderTypeList
:
[
FlowNodeInputTypeEnum
.
hidden
],
label
:
''
,
value
:
true
,
valueType
:
WorkflowIOValueTypeEnum
.
boolean
},
{
key
:
NodeInputKeyEnum
.
aiChatVision
,
renderTypeList
:
[
FlowNodeInputTypeEnum
.
hidden
],
label
:
''
,
...
...
packages/service/core/ai/llm/utils.ts
View file @
b0a58b98
...
...
@@ -265,7 +265,7 @@ export const loadRequestMessages = async ({
|
undefined
)
=>
{
if
(
typeof
content
===
'string'
)
{
return
content
||
''
;
return
content
?.
trim
()
||
''
;
}
// 交互节点
if
(
!
content
)
return
''
;
...
...
@@ -273,7 +273,10 @@ export const loadRequestMessages = async ({
const
result
=
content
.
filter
((
item
)
=>
item
?.
type
===
'text'
);
if
(
result
.
length
===
0
)
return
''
;
return
result
.
map
((
item
)
=>
item
.
text
).
join
(
'\n'
);
return
result
.
map
((
item
)
=>
item
.
text
)
.
join
(
'\n'
)
.
trim
();
};
if
(
messages
.
length
===
0
)
{
...
...
packages/service/core/workflow/dispatch/ai/tool/index.ts
View file @
b0a58b98
...
...
@@ -57,7 +57,8 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
history
=
6
,
fileUrlList
:
fileLinks
,
aiChatVision
,
aiChatReasoning
aiChatReasoning
,
isResponseAnswerText
=
true
}
}
=
props
;
...
...
@@ -235,7 +236,9 @@ export const dispatchRunTools = async (props: DispatchToolModuleProps): Promise<
(
sum
,
item
)
=>
sum
+
item
.
runTimes
,
0
),
[
DispatchNodeResponseKeyEnum
.
assistantResponses
]:
previewAssistantResponses
,
[
DispatchNodeResponseKeyEnum
.
assistantResponses
]:
isResponseAnswerText
?
previewAssistantResponses
:
undefined
,
[
DispatchNodeResponseKeyEnum
.
nodeResponse
]:
{
// 展示的积分消耗
totalPoints
:
totalPointsUsage
,
...
...
packages/service/core/workflow/dispatch/ai/tool/toolCall.ts
View file @
b0a58b98
...
...
@@ -33,7 +33,8 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<RunTo
aiChatStopSign
,
aiChatResponseFormat
,
aiChatJsonSchema
,
aiChatReasoning
aiChatReasoning
,
isResponseAnswerText
=
true
}
}
=
workflowProps
;
...
...
@@ -141,6 +142,7 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<RunTo
});
},
onStreaming
({
text
})
{
if
(
!
isResponseAnswerText
)
return
;
workflowStreamResponse
?.({
write
,
event
:
SseResponseEventEnum
.
answer
,
...
...
@@ -150,6 +152,7 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<RunTo
});
},
onToolCall
({
call
})
{
if
(
!
isResponseAnswerText
)
return
;
const
toolNode
=
toolNodesMap
.
get
(
call
.
function
.
name
);
if
(
toolNode
)
{
workflowStreamResponse
?.({
...
...
@@ -168,6 +171,7 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<RunTo
}
},
onToolParam
({
tool
,
params
})
{
if
(
!
isResponseAnswerText
)
return
;
workflowStreamResponse
?.({
write
,
event
:
SseResponseEventEnum
.
toolParams
,
...
...
@@ -209,18 +213,20 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<RunTo
// Format tool response
const
stringToolResponse
=
formatToolResponse
(
toolRunResponse
.
toolResponses
);
workflowStreamResponse
?.({
event
:
SseResponseEventEnum
.
toolResponse
,
data
:
{
tool
:
{
id
:
call
.
id
,
toolName
:
''
,
toolAvatar
:
''
,
params
:
''
,
response
:
sliceStrStartEnd
(
stringToolResponse
,
5000
,
5000
)
if
(
isResponseAnswerText
)
{
workflowStreamResponse
?.({
event
:
SseResponseEventEnum
.
toolResponse
,
data
:
{
tool
:
{
id
:
call
.
id
,
toolName
:
''
,
toolAvatar
:
''
,
params
:
''
,
response
:
sliceStrStartEnd
(
stringToolResponse
,
5000
,
5000
)
}
}
}
}
);
}
);
}
toolRunResponses
.
push
(
toolRunResponse
);
...
...
@@ -258,18 +264,20 @@ export const runToolCall = async (props: DispatchToolModuleProps): Promise<RunTo
// console.dir(runtimeEdges, { depth: null });
const
stringToolResponse
=
formatToolResponse
(
toolRunResponse
.
toolResponses
);
workflowStreamResponse
?.({
event
:
SseResponseEventEnum
.
toolResponse
,
data
:
{
tool
:
{
id
:
toolParams
.
toolCallId
,
toolName
:
''
,
toolAvatar
:
''
,
params
:
''
,
response
:
sliceStrStartEnd
(
stringToolResponse
,
5000
,
5000
)
if
(
isResponseAnswerText
)
{
workflowStreamResponse
?.({
event
:
SseResponseEventEnum
.
toolResponse
,
data
:
{
tool
:
{
id
:
toolParams
.
toolCallId
,
toolName
:
''
,
toolAvatar
:
''
,
params
:
''
,
response
:
sliceStrStartEnd
(
stringToolResponse
,
5000
,
5000
)
}
}
}
}
);
}
);
}
toolRunResponses
.
push
(
toolRunResponse
);
const
assistantMessages
=
chats2GPTMessages
({
...
...
packages/service/core/workflow/dispatch/ai/tool/type.d.ts
View file @
b0a58b98
...
...
@@ -31,6 +31,7 @@ export type DispatchToolModuleProps = ModuleDispatchProps<{
[
NodeInputKeyEnum
.
aiSystemPrompt
]:
string
;
[
NodeInputKeyEnum
.
aiChatTemperature
]:
number
;
[
NodeInputKeyEnum
.
aiChatMaxToken
]:
number
;
[
NodeInputKeyEnum
.
aiChatIsResponseText
]:
boolean
;
[
NodeInputKeyEnum
.
aiChatVision
]?:
boolean
;
[
NodeInputKeyEnum
.
aiChatReasoning
]?:
boolean
;
[
NodeInputKeyEnum
.
aiChatTopP
]?:
number
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment