fix: node copy, debug variables, auto-execution (#5664)
* fix debug variables * auto execute condition * fix autoTTSResponse * node copy * memory debug nodes * doc * yuque doc * fix: debug * img * i18n --------- Co-authored-by: archer <545436317@qq.com>
@@ -9,6 +9,7 @@
|
||||
"configuration",
|
||||
"docker",
|
||||
"faq",
|
||||
"signoz",
|
||||
"modelConfig",
|
||||
"openapi",
|
||||
"custom-models",
|
||||
|
76
document/content/docs/introduction/development/signoz.mdx
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: 接入 Signoz 服务监控
|
||||
description: FastGPT 接入 Signoz 服务监控
|
||||
---
|
||||
|
||||
## 介绍
|
||||
|
||||
[SigNoz](https://signoz.io/) 是一款开源的应用性能监控(APM)和可观测性平台,为 FastGPT 提供全面的服务监控能力。它基于 OpenTelemetry 标准,能够收集、处理和可视化分布式系统的遥测数据,包括链路追踪(Tracing)、指标监控(Metrics)和日志分析(Logging)。
|
||||
|
||||
**主要功能:**
|
||||
|
||||
- **链路追踪**:跟踪用户请求在 FastGPT 各个服务间的完整调用链路
|
||||
- **性能监控**:监控 API 响应时间、吞吐量等关键性能指标
|
||||
- **错误追踪**:自动捕获和记录系统异常,便于问题排查
|
||||
- **日志聚合**:集中收集和管理应用日志,支持结构化查询
|
||||
- **实时告警**:基于指标阈值设置告警规则,及时发现系统异常
|
||||
|
||||
## 部署 Signoz
|
||||
|
||||
可以使用 [SigNoz](https://signoz.io/) 官方云服务,或者私有部署,下面介绍在 Sealos 上快速部署 Signoz。
|
||||
|
||||
1. 点击下方的卡片,即可一键部署 Signoz。
|
||||
|
||||
[](https://hzh.sealos.run/?uid=fnWRt09fZP&openapp=system-template%3FtemplateName%3Dsignoz)
|
||||
|
||||
2. 开启 Signoz 外网访问
|
||||
|
||||
部署后,可点击 P1 中的详情,进入应用详情页, 然后点击右上角的变更,并开启 4318 端口的外网地址(如果走内网服务,可忽略该步骤)。
|
||||
|
||||
| P1 | P2 | P3 |
|
||||
| --- | --- | --- |
|
||||
|  |  |  |
|
||||
|
||||
3. 获取 Signoz 访问地址
|
||||
|
||||
变更完成后,等待公网地址就绪,复制该地址,将其填入 FastGPT 中。如果是走内网服务,可以直接复制 4318 端口的内网地址。
|
||||
|
||||

|
||||
|
||||
## 配置 FastGPT
|
||||
|
||||
1. 修改 FastGPT 环境变量
|
||||
|
||||
```
|
||||
SIGNOZ_BASE_URL=上一步复制的地址
|
||||
SIGNOZ_SERVICE_NAME=fastgpt # 服务标识名,必须为英文
|
||||
SIGNOZ_STORE_LEVEL=warn # 日志等级,可选值: debug, info, warn, error
|
||||
```
|
||||
|
||||
2. 重启 FastGPT
|
||||
|
||||
## 查看效果
|
||||
|
||||
返回 Sealos 应用管理列表,点击进入 Signoz 前端项目,并访问其公网地址,进入管理台。
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|
||||
首次注册需要注册一个账号(数据是存储本地数据库),随便填写即可。
|
||||
|
||||

|
||||
|
||||
登录进去后,如果看到右侧 COMPLETED 的步骤条中,logs 和 traces 亮起,则说明配置成功。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## 注意事项
|
||||
|
||||
1. 调整日志存储时长
|
||||
|
||||
Signoz 监控是一个非常占用磁盘的服务,首先不要把 FastGPT debug 日志也存储进来,另外可以将日志存储时长调整为 7 天。如果突然发现 Signoz 数据不增加了,并且内存一直追加,则说明是磁盘满了,需要扩大容量。
|
||||
|
||||

|
@@ -74,7 +74,7 @@ description: FastGPT 批量运行节点介绍和使用
|
||||
|
||||
### 循环体配置
|
||||
|
||||

|
||||

|
||||
|
||||
1. 在循环体内部,可以添加任意类型的节点,如:
|
||||
- AI 对话节点
|
||||
|
@@ -17,10 +17,18 @@ FastGPT v4.8.16 版本开始,商业版用户支持语雀文件库导入,用
|
||||
|
||||
参考下图获取 Token 和 User ID,注意给 Token 赋值权限:
|
||||
|
||||
**个人版**:
|
||||
|
||||
| 获取 Token | 增加权限 | 获取 User ID |
|
||||
| --- | --- | --- |
|
||||
|  |  |  |
|
||||
|
||||
**企业版**:
|
||||
|
||||
| 获取 Token | 获取 User ID |
|
||||
| --- | --- |
|
||||
|  |  |
|
||||
|
||||
## 2. 创建知识库
|
||||
|
||||
使用上一步获取的 token 和 uid,创建知识库,选择语雀文件库类型,然后填入对应的参数,点击创建。
|
||||
|
@@ -42,6 +42,7 @@ description: FastGPT 文档目录
|
||||
- [/docs/introduction/development/proxy/http_proxy](/docs/introduction/development/proxy/http_proxy)
|
||||
- [/docs/introduction/development/proxy/nginx](/docs/introduction/development/proxy/nginx)
|
||||
- [/docs/introduction/development/sealos](/docs/introduction/development/sealos)
|
||||
- [/docs/introduction/development/signoz](/docs/introduction/development/signoz)
|
||||
- [/docs/introduction/guide/DialogBoxes/htmlRendering](/docs/introduction/guide/DialogBoxes/htmlRendering)
|
||||
- [/docs/introduction/guide/DialogBoxes/quoteList](/docs/introduction/guide/DialogBoxes/quoteList)
|
||||
- [/docs/introduction/guide/admin/sso](/docs/introduction/guide/admin/sso)
|
||||
|
@@ -47,7 +47,6 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4124' \
|
||||
|
||||
1. HTTP 工具空指针,导致无法编辑。
|
||||
2. python 代码运行,入参无法是 boolean 值。
|
||||
3. debug 模式下,全局变量未传递。
|
||||
|
||||
## 🔨 插件更新
|
||||
|
||||
|
@@ -12,7 +12,12 @@ description: 'FastGPT V4.12.5 更新说明'
|
||||
|
||||
## 🐛 修复
|
||||
|
||||
1. debug 模式下,全局变量未传递。
|
||||
2. debug 模式下,前方节点参数无法传递至后方节点
|
||||
3. 调试模式下,开启“自动执行”,会跳过外部变量的填写。
|
||||
4. 自动语音回复未生效
|
||||
5. 节点复制,报错捕获配置丢失
|
||||
|
||||
## 🔨 插件更新
|
||||
|
||||
1. 新增火山引擎融合信息搜索工具。
|
||||
1. 新增火山引擎融合信息搜索工具。
|
||||
|
@@ -16,6 +16,7 @@
|
||||
"document/content/docs/introduction/development/custom-models/chatglm2.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/custom-models/m3e.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/development/custom-models/marker.mdx": "2025-08-04T22:07:52+08:00",
|
||||
"document/content/docs/introduction/development/custom-models/mineru.mdx": "2025-09-17T18:33:31+08:00",
|
||||
"document/content/docs/introduction/development/custom-models/ollama.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/custom-models/xinference.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/development/design/dataset.mdx": "2025-07-23T21:35:03+08:00",
|
||||
@@ -75,11 +76,11 @@
|
||||
"document/content/docs/introduction/guide/knowledge_base/api_dataset.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/collection_tags.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/dataset_engine.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/lark_dataset.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/lark_dataset.mdx": "2025-09-17T17:40:47+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/template.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/third_dataset.mdx": "2025-07-24T13:00:27+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/websync.mdx": "2025-08-05T23:20:39+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/yuque_dataset.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/knowledge_base/yuque_dataset.mdx": "2025-09-17T19:04:12+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/bing_search_plugin.mdx": "2025-07-23T21:35:03+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/dev_system_tool.mdx": "2025-08-20T19:00:48+08:00",
|
||||
"document/content/docs/introduction/guide/plugins/doc2x_plugin_guide.mdx": "2025-07-23T21:35:03+08:00",
|
||||
@@ -97,7 +98,7 @@
|
||||
"document/content/docs/protocol/terms.en.mdx": "2025-08-03T22:37:45+08:00",
|
||||
"document/content/docs/protocol/terms.mdx": "2025-08-03T22:37:45+08:00",
|
||||
"document/content/docs/toc.en.mdx": "2025-08-04T13:42:36+08:00",
|
||||
"document/content/docs/toc.mdx": "2025-09-17T17:03:12+08:00",
|
||||
"document/content/docs/toc.mdx": "2025-09-17T18:33:31+08:00",
|
||||
"document/content/docs/upgrading/4-10/4100.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-10/4101.mdx": "2025-09-08T20:07:20+08:00",
|
||||
"document/content/docs/upgrading/4-11/4110.mdx": "2025-08-05T23:20:39+08:00",
|
||||
@@ -106,8 +107,8 @@
|
||||
"document/content/docs/upgrading/4-12/4121.mdx": "2025-09-07T14:41:48+08:00",
|
||||
"document/content/docs/upgrading/4-12/4122.mdx": "2025-09-07T14:41:48+08:00",
|
||||
"document/content/docs/upgrading/4-12/4123.mdx": "2025-09-07T20:55:14+08:00",
|
||||
"document/content/docs/upgrading/4-12/4124.mdx": "2025-09-16T10:46:55+08:00",
|
||||
"document/content/docs/upgrading/4-12/4125.mdx": "2025-09-17T17:03:12+08:00",
|
||||
"document/content/docs/upgrading/4-12/4124.mdx": "2025-09-17T18:36:54+08:00",
|
||||
"document/content/docs/upgrading/4-12/4125.mdx": "2025-09-17T21:22:47+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",
|
||||
|
8
document/public/imgs/Deploy-on-Sealos.svg
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 204 KiB |
Before Width: | Height: | Size: 208 KiB After Width: | Height: | Size: 207 KiB |
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 218 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 368 KiB |
BIN
document/public/imgs/fastgpt-loop-node-config.webp
Normal file
After Width: | Height: | Size: 153 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 287 KiB |
Before Width: | Height: | Size: 212 KiB After Width: | Height: | Size: 211 KiB |
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 241 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 65 KiB |
BIN
document/public/imgs/image-108.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
document/public/imgs/image-109.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
document/public/imgs/image-110.png
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
document/public/imgs/image-111.png
Normal file
After Width: | Height: | Size: 86 KiB |
BIN
document/public/imgs/image-112.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
document/public/imgs/image-113.png
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
document/public/imgs/image-114.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
document/public/imgs/image-115.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
document/public/imgs/image-116.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
document/public/imgs/image-117.png
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
document/public/imgs/image-118.png
Normal file
After Width: | Height: | Size: 163 KiB |
BIN
document/public/imgs/image-119.png
Normal file
After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 263 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 184 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 312 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 518 KiB After Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 666 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 443 KiB After Width: | Height: | Size: 140 KiB |
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 357 KiB |
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 419 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 206 KiB |
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 275 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 181 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 284 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 199 KiB After Width: | Height: | Size: 199 KiB |
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 206 KiB After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 282 KiB After Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 108 KiB |
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 304 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 444 KiB After Width: | Height: | Size: 192 KiB |
Before Width: | Height: | Size: 341 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 305 KiB After Width: | Height: | Size: 108 KiB |
@@ -141,6 +141,7 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
flowUsages: [],
|
||||
debugResponse: {
|
||||
memoryEdges: [],
|
||||
memoryNodes: [],
|
||||
entryNodeIds: [],
|
||||
nodeResponses: {},
|
||||
skipNodeQueue: []
|
||||
@@ -850,6 +851,7 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
...edge,
|
||||
status: entryNodeIds.includes(edge.target) ? 'active' : edge.status
|
||||
})),
|
||||
memoryNodes: Array.from(this.runtimeNodesMap.values()),
|
||||
entryNodeIds,
|
||||
nodeResponses: this.debugNodeResponses,
|
||||
skipNodeQueue: Array.from(this.skipNodeQueue.values()).map((item) => ({
|
||||
|
@@ -15,6 +15,7 @@ import type { ChatNodeUsageType } from '@fastgpt/global/support/wallet/bill/type
|
||||
|
||||
export type WorkflowDebugResponse = {
|
||||
memoryEdges: RuntimeEdgeItemType[];
|
||||
memoryNodes: RuntimeNodeItemType[];
|
||||
entryNodeIds: string[]; // Next step entry nodes
|
||||
nodeResponses: Record<
|
||||
string,
|
||||
|
@@ -707,7 +707,6 @@
|
||||
"core.workflow.Custom outputs": "Custom Outputs",
|
||||
"core.workflow.Dataset quote": "Dataset Quote",
|
||||
"core.workflow.Debug": "Debug",
|
||||
"core.workflow.Debug Node": "Debug Mode",
|
||||
"core.workflow.Failed": "Run Failed",
|
||||
"core.workflow.Not intro": "This Node Has No Introduction",
|
||||
"core.workflow.Run": "Run",
|
||||
|
@@ -46,6 +46,7 @@
|
||||
"dataset_quote_role_system_option_desc": "Historical records should be consistent first (recommended)",
|
||||
"dataset_quote_role_tip": "When set to System, the knowledge base reference content will be placed in the system message, which can ensure the continuity of the history record, but the constraint effect may not be good.\n\nWhen set to User, the knowledge base reference content will be placed in the user message, and the {{question}} variable location needs to be specified. \nIt will have a certain impact on the consistency of historical records, but usually the constraint effect is better.",
|
||||
"dataset_quote_role_user_option_desc": "Strong constraints take precedence",
|
||||
"debug_test": "Debug debugging",
|
||||
"dynamic_input_description": "Receive the output value of the previous node as a variable, which can be used by Laf request parameters.",
|
||||
"edit_input": "Edit Input",
|
||||
"edit_output": "Edit output",
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"AI_input_is_empty": "传入AI 节点的内容为空",
|
||||
"AI_input_is_empty": "传入 AI 节点的内容为空",
|
||||
"Delete_all": "清空词库",
|
||||
"LLM_model_response_empty": "模型流响应为空,请检查模型流输出是否正常",
|
||||
"ai_reasoning": "思考过程",
|
||||
|
@@ -707,7 +707,6 @@
|
||||
"core.workflow.Custom outputs": "自定义输出",
|
||||
"core.workflow.Dataset quote": "知识库引用",
|
||||
"core.workflow.Debug": "调试",
|
||||
"core.workflow.Debug Node": "Debug 模式",
|
||||
"core.workflow.Failed": "运行失败",
|
||||
"core.workflow.Not intro": "这个节点没有介绍~",
|
||||
"core.workflow.Run": "运行",
|
||||
|
@@ -46,6 +46,7 @@
|
||||
"dataset_quote_role_system_option_desc": "历史记录连贯优先(推荐)",
|
||||
"dataset_quote_role_tip": "设置为 System 时,将会把知识库引用内容放置到 system 消息中,可以确保历史记录的连贯性,但约束效果可能不佳,需要多调试。\n设置为 User 时,将会把知识库引用内容放置到 user 消息中,并且需要指定 {{question}} 变量位置。会对历史记录连贯性有一定影响,但通常约束效果更优。",
|
||||
"dataset_quote_role_user_option_desc": "强约束优先",
|
||||
"debug_test": "Debug 调试",
|
||||
"dynamic_input_description": "接收前方节点的输出值作为变量,这些变量可以被 Laf 请求参数使用。",
|
||||
"edit_input": "编辑输入",
|
||||
"edit_output": "编辑输出",
|
||||
|
@@ -706,7 +706,6 @@
|
||||
"core.workflow.Custom outputs": "自訂輸出",
|
||||
"core.workflow.Dataset quote": "知識庫引用",
|
||||
"core.workflow.Debug": "除錯",
|
||||
"core.workflow.Debug Node": "除錯模式",
|
||||
"core.workflow.Failed": "執行失敗",
|
||||
"core.workflow.Not intro": "此節點沒有介紹",
|
||||
"core.workflow.Run": "執行",
|
||||
|
@@ -46,6 +46,7 @@
|
||||
"dataset_quote_role_system_option_desc": "歷史紀錄連貫優先(建議)",
|
||||
"dataset_quote_role_tip": "設定為 System 時,會將知識庫引用內容放置到系統訊息中,可以確保歷史紀錄的連貫性,但約束效果可能不佳。\n設定為 User 時,會將知識庫引用內容放置到使用者訊息中,並且需要指定 {{question}} 變數位置。會對歷史紀錄連貫性有一定影響,但通常約束效果較佳。",
|
||||
"dataset_quote_role_user_option_desc": "強約束優先",
|
||||
"debug_test": "Debug 調試",
|
||||
"dynamic_input_description": "接收前一個節點的輸出值作為變數,這些變數可以被 Laf 請求參數使用。",
|
||||
"edit_input": "編輯輸入",
|
||||
"edit_output": "編輯輸出",
|
||||
|
@@ -53,7 +53,7 @@ const LabelAndFormRender = ({
|
||||
return (
|
||||
<Box _notLast={{ mb: 4 }}>
|
||||
<Flex alignItems={'center'} mb={1}>
|
||||
{typeof label === 'string' ? <FormLabel required={required}>{label}</FormLabel> : label}
|
||||
{typeof label === 'string' ? <FormLabel required={required}>{t(label)}</FormLabel> : label}
|
||||
{placeholder && <QuestionTip ml={1} label={placeholder} />}
|
||||
</Flex>
|
||||
|
||||
|
@@ -64,6 +64,7 @@ const ChatInput = ({
|
||||
const chatInputGuide = useContextSelector(ChatBoxContext, (v) => v.chatInputGuide);
|
||||
const fileSelectConfig = useContextSelector(ChatBoxContext, (v) => v.fileSelectConfig);
|
||||
const dialogTips = useContextSelector(ChatBoxContext, (v) => v.dialogTips);
|
||||
const autoTTSResponse = useContextSelector(ChatBoxContext, (v) => v.autoTTSResponse);
|
||||
|
||||
const fileCtrl = useFieldArray({
|
||||
control,
|
||||
@@ -448,7 +449,8 @@ const ChatInput = ({
|
||||
handleSend={(text) => {
|
||||
onSendMessage({
|
||||
text: text.trim(),
|
||||
files: fileList
|
||||
files: fileList,
|
||||
autoTTSResponse
|
||||
});
|
||||
replaceFiles([]);
|
||||
}}
|
||||
|
@@ -46,7 +46,6 @@ export type ChatProviderProps = {
|
||||
type useChatStoreType = ChatProviderProps & {
|
||||
welcomeText: string;
|
||||
variableList: VariableItemType[];
|
||||
allVariableList: VariableItemType[];
|
||||
questionGuide: AppQGConfigType;
|
||||
ttsConfig: AppTTSConfigType;
|
||||
whisperConfig: AppWhisperConfigType;
|
||||
@@ -238,10 +237,7 @@ const Provider = ({
|
||||
const value: useChatStoreType = {
|
||||
...props,
|
||||
welcomeText,
|
||||
variableList: variables.filter(
|
||||
(item) => item.type !== VariableInputEnum.custom && item.type !== VariableInputEnum.internal
|
||||
),
|
||||
allVariableList: variables,
|
||||
variableList: variables,
|
||||
questionGuide,
|
||||
ttsConfig,
|
||||
fileSelectConfig,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { type UseFormReturn } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { Box, Button, Card, Flex } from '@chakra-ui/react';
|
||||
@@ -152,6 +152,19 @@ const VariableInput = ({
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{!chatStarted && commonVariableList.length === 0 && (
|
||||
<Button
|
||||
leftIcon={<MyIcon name={'core/chat/chatFill'} w={'16px'} />}
|
||||
size={'sm'}
|
||||
maxW={'100px'}
|
||||
mt={4}
|
||||
onClick={variablesForm.handleSubmit(() => {
|
||||
chatForm.setValue('chatStarted', true);
|
||||
})}
|
||||
>
|
||||
{t('chat:start_chat')}
|
||||
</Button>
|
||||
)}
|
||||
</Card>
|
||||
</Box>
|
||||
)}
|
||||
|
@@ -20,7 +20,12 @@ const ChatHomeVariablesForm = ({ chatForm }: Props) => {
|
||||
const variablesForm = useContextSelector(ChatItemContext, (v) => v.variablesForm);
|
||||
|
||||
const variableList = useContextSelector(ChatBoxContext, (v) => v.variableList);
|
||||
const allVariableList = useContextSelector(ChatBoxContext, (v) => v.allVariableList);
|
||||
const externalVariableList = variableList.filter(
|
||||
(item) => item.type === VariableInputEnum.custom
|
||||
);
|
||||
const commonVariableList = variableList.filter(
|
||||
(item) => item.type !== VariableInputEnum.custom && item.type !== VariableInputEnum.internal
|
||||
);
|
||||
|
||||
return (
|
||||
<Card
|
||||
@@ -31,27 +36,25 @@ const ChatHomeVariablesForm = ({ chatForm }: Props) => {
|
||||
>
|
||||
<Box p={3}>
|
||||
{/* custom variables */}
|
||||
{allVariableList.filter((i) => i.type === VariableInputEnum.custom).length > 0 && (
|
||||
{externalVariableList.length > 0 && (
|
||||
<>
|
||||
{allVariableList
|
||||
.filter((i) => i.type === VariableInputEnum.custom)
|
||||
.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
fieldName={`variables.${item.key}`}
|
||||
placeholder={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type, item.valueType)}
|
||||
form={variablesForm}
|
||||
bg={'myGray.50'}
|
||||
/>
|
||||
))}
|
||||
{externalVariableList.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
fieldName={`variables.${item.key}`}
|
||||
placeholder={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type, item.valueType)}
|
||||
form={variablesForm}
|
||||
bg={'myGray.50'}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
{/* normal variables */}
|
||||
{variableList.length > 0 && (
|
||||
{commonVariableList.length > 0 && (
|
||||
<>
|
||||
{variableList.map((item) => (
|
||||
{commonVariableList.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
|
@@ -144,7 +144,6 @@ const ChatBox = ({
|
||||
const outLinkAuthData = useContextSelector(ChatBoxContext, (v) => v.outLinkAuthData);
|
||||
const welcomeText = useContextSelector(ChatBoxContext, (v) => v.welcomeText);
|
||||
const variableList = useContextSelector(ChatBoxContext, (v) => v.variableList);
|
||||
const allVariableList = useContextSelector(ChatBoxContext, (v) => v.allVariableList);
|
||||
const questionGuide = useContextSelector(ChatBoxContext, (v) => v.questionGuide);
|
||||
const startSegmentedAudio = useContextSelector(ChatBoxContext, (v) => v.startSegmentedAudio);
|
||||
const finishSegmentedAudio = useContextSelector(ChatBoxContext, (v) => v.finishSegmentedAudio);
|
||||
@@ -156,11 +155,14 @@ const ChatBox = ({
|
||||
const isInteractive = useMemo(() => checkIsInteractiveByHistories(chatRecords), [chatRecords]);
|
||||
|
||||
const showExternalVariable = useMemo(() => {
|
||||
return (
|
||||
[ChatTypeEnum.log, ChatTypeEnum.test, ChatTypeEnum.chat].includes(chatType) &&
|
||||
allVariableList.some((item) => item.type === VariableInputEnum.custom)
|
||||
);
|
||||
}, [allVariableList, chatType]);
|
||||
const map: Record<string, boolean> = {
|
||||
[ChatTypeEnum.log]: true,
|
||||
[ChatTypeEnum.test]: true,
|
||||
[ChatTypeEnum.chat]: true,
|
||||
[ChatTypeEnum.home]: true
|
||||
};
|
||||
return map[chatType] && variableList.some((item) => item.type === VariableInputEnum.custom);
|
||||
}, [variableList, chatType]);
|
||||
|
||||
// compute variable input is finish.
|
||||
const chatForm = useForm<ChatBoxInputFormType>({
|
||||
@@ -173,10 +175,20 @@ const ChatBox = ({
|
||||
const { setValue, watch } = chatForm;
|
||||
const chatStartedWatch = watch('chatStarted');
|
||||
|
||||
// 可以进入对话框对话
|
||||
const commonVariableList = variableList.filter(
|
||||
(item) => item.type !== VariableInputEnum.custom && item.type !== VariableInputEnum.internal
|
||||
);
|
||||
|
||||
/*
|
||||
对话已经开始的标记:
|
||||
1. 保证 appId 一致。
|
||||
2. 有对话记录/手动点了开始/默认没有需要填写的变量。
|
||||
*/
|
||||
const chatStarted =
|
||||
chatBoxData?.appId === appId &&
|
||||
(chatRecords.length > 0 || chatStartedWatch || variableList.length === 0);
|
||||
(chatRecords.length > 0 ||
|
||||
chatStartedWatch ||
|
||||
(commonVariableList.length === 0 && !showExternalVariable));
|
||||
|
||||
// 滚动到底部
|
||||
const scrollToBottom = useMemoizedFn((behavior: 'smooth' | 'auto' = 'smooth', delay = 0) => {
|
||||
@@ -449,7 +461,7 @@ const ChatBox = ({
|
||||
|
||||
// Only declared variables are kept
|
||||
const requestVariables: Record<string, any> = {};
|
||||
allVariableList?.forEach((item) => {
|
||||
variableList?.forEach((item) => {
|
||||
const val =
|
||||
variables[item.key] === '' ||
|
||||
variables[item.key] === undefined ||
|
||||
@@ -827,7 +839,7 @@ const ChatBox = ({
|
||||
feConfigs?.show_emptyChat &&
|
||||
showEmptyIntro &&
|
||||
chatRecords.length === 0 &&
|
||||
!variableList?.length &&
|
||||
!commonVariableList?.length &&
|
||||
!showExternalVariable &&
|
||||
!welcomeText,
|
||||
[
|
||||
@@ -835,7 +847,7 @@ const ChatBox = ({
|
||||
feConfigs?.show_emptyChat,
|
||||
showEmptyIntro,
|
||||
chatRecords.length,
|
||||
variableList?.length,
|
||||
commonVariableList?.length,
|
||||
showExternalVariable,
|
||||
welcomeText
|
||||
]
|
||||
@@ -1126,8 +1138,7 @@ const ChatBox = ({
|
||||
>
|
||||
<Flex h={'100%'} flexDir={'column'} justifyContent={'center'} w={'100%'}>
|
||||
{HomeChatRenderBox}
|
||||
{allVariableList.filter((item) => item.type !== VariableInputEnum.internal).length >
|
||||
0 ? (
|
||||
{variableList.filter((item) => item.type !== VariableInputEnum.internal).length > 0 ? (
|
||||
<Box w={'100%'}>
|
||||
<ChatHomeVariablesForm chatForm={chatForm} />
|
||||
</Box>
|
||||
|
@@ -30,6 +30,7 @@ import {
|
||||
nodeInputTypeToInputType,
|
||||
variableInputTypeToInputType
|
||||
} from '@/components/core/app/formRender/utils';
|
||||
import { useSafeTranslation } from '@fastgpt/web/hooks/useSafeTranslation';
|
||||
|
||||
const MyRightDrawer = dynamic(
|
||||
() => import('@fastgpt/web/components/common/MyDrawer/MyRightDrawer')
|
||||
@@ -41,7 +42,7 @@ enum TabEnum {
|
||||
}
|
||||
|
||||
export const useDebug = () => {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useSafeTranslation();
|
||||
const { toast } = useToast();
|
||||
|
||||
const setNodes = useContextSelector(WorkflowNodeEdgeContext, (v) => v.setNodes);
|
||||
@@ -241,8 +242,8 @@ export const useDebug = () => {
|
||||
<MyRightDrawer
|
||||
onClose={onClose}
|
||||
iconSrc="core/workflow/debugBlue"
|
||||
title={t('common:core.workflow.Debug Node')}
|
||||
maxW={['90vw', '35vw']}
|
||||
title={t('workflow:debug_test')}
|
||||
maxW={['90vw', '40vw']}
|
||||
px={0}
|
||||
>
|
||||
<Box flex={'1 0 0'} overflow={'auto'} px={6}>
|
||||
@@ -260,12 +261,27 @@ export const useDebug = () => {
|
||||
onChange={setCurrentTab}
|
||||
/>
|
||||
)}
|
||||
<Box display={currentTab === TabEnum.node ? 'block' : 'none'}>
|
||||
{renderInputs.map((item) => (
|
||||
<LabelAndFormRender
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={t(item.placeholder || item.description)}
|
||||
inputType={nodeInputTypeToInputType(item.renderTypeList)}
|
||||
form={variablesForm}
|
||||
fieldName={`nodeVariables.${item.key}`}
|
||||
bg={'myGray.50'}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
<Box display={currentTab === TabEnum.global ? 'block' : 'none'}>
|
||||
{customVar.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={t(item.description)}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -274,9 +290,10 @@ export const useDebug = () => {
|
||||
))}
|
||||
{internalVar.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
placeholder={item.description}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={t(item.description)}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
fieldName={`variables.${item.key}`}
|
||||
@@ -285,8 +302,9 @@ export const useDebug = () => {
|
||||
))}
|
||||
{filteredVar.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
required={item.required}
|
||||
placeholder={item.description}
|
||||
inputType={variableInputTypeToInputType(item.type)}
|
||||
form={variablesForm}
|
||||
@@ -295,19 +313,6 @@ export const useDebug = () => {
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
<Box display={currentTab === TabEnum.node ? 'block' : 'none'}>
|
||||
{renderInputs.map((item) => (
|
||||
<LabelAndFormRender
|
||||
{...item}
|
||||
key={item.key}
|
||||
placeholder={item.placeholder || item.description}
|
||||
inputType={nodeInputTypeToInputType(item.renderTypeList)}
|
||||
form={variablesForm}
|
||||
fieldName={`nodeVariables.${item.key}`}
|
||||
bg={'myGray.50'}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
<Flex py={2} justifyContent={'flex-end'} px={6}>
|
||||
<Button onClick={handleSubmit(onClickRun, onCheckRunError)}>{t('common:Run')}</Button>
|
||||
|
@@ -514,7 +514,8 @@ const MenuRender = React.memo(function MenuRender({
|
||||
version: template.version,
|
||||
versionLabel: template.versionLabel,
|
||||
isLatestVersion: template.isLatestVersion,
|
||||
toolConfig: template.toolConfig
|
||||
toolConfig: template.toolConfig,
|
||||
catchError: template.catchError
|
||||
},
|
||||
selected: true,
|
||||
parentNodeId: undefined,
|
||||
|
@@ -707,25 +707,31 @@ const WorkflowContextProvider = ({
|
||||
|
||||
try {
|
||||
// 3. Run one step
|
||||
const { memoryEdges, entryNodeIds, skipNodeQueue, nodeResponses, newVariables } =
|
||||
await postWorkflowDebug({
|
||||
nodes: runtimeNodes,
|
||||
edges: debugData.runtimeEdges,
|
||||
skipNodeQueue: debugData.skipNodeQueue,
|
||||
variables: {
|
||||
appId,
|
||||
cTime: formatTime2YMDHMW(),
|
||||
...debugData.variables
|
||||
},
|
||||
query: debugData.query, // 添加 query 参数
|
||||
history: debugData.history,
|
||||
const {
|
||||
memoryEdges,
|
||||
memoryNodes,
|
||||
entryNodeIds,
|
||||
skipNodeQueue,
|
||||
nodeResponses,
|
||||
newVariables
|
||||
} = await postWorkflowDebug({
|
||||
nodes: runtimeNodes,
|
||||
edges: debugData.runtimeEdges,
|
||||
skipNodeQueue: debugData.skipNodeQueue,
|
||||
variables: {
|
||||
appId,
|
||||
chatConfig: appDetail.chatConfig
|
||||
});
|
||||
cTime: formatTime2YMDHMW(),
|
||||
...debugData.variables
|
||||
},
|
||||
query: debugData.query, // 添加 query 参数
|
||||
history: debugData.history,
|
||||
appId,
|
||||
chatConfig: appDetail.chatConfig
|
||||
});
|
||||
|
||||
// 4. Store debug result
|
||||
setWorkflowDebugData({
|
||||
runtimeNodes: debugData.runtimeNodes,
|
||||
runtimeNodes: memoryNodes,
|
||||
runtimeEdges: memoryEdges,
|
||||
entryNodeIds,
|
||||
skipNodeQueue,
|
||||
@@ -776,7 +782,7 @@ const WorkflowContextProvider = ({
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
[appId, onChangeNode, setNodes]
|
||||
[appId, onChangeNode, setNodes, appDetail.chatConfig]
|
||||
);
|
||||
const onStopNodeDebug = useMemoizedFn(() => {
|
||||
setWorkflowDebugData(undefined);
|
||||
|