Compare commits

..

7 Commits

Author SHA1 Message Date
Archer
58fbf78c6e perf: ai param config (#3451)
* perf: ai param config

* pacakge import

* perf: ai config doc
2024-12-23 10:31:15 +08:00
Archer
ae149069bf fix: pc check (#3447)
* fix: pc check

* fix: pc check
2024-12-21 12:28:32 +08:00
Archer
e5b8dea9ae perf: schema indexes (#3446) 2024-12-21 00:01:14 +08:00
imgbot[bot]
b48eff4212 [ImgBot] Optimize images (#3444)
*Total -- 8,930.88kb -> 6,422.90kb (28.08%)

/docSite/assets/imgs/dingtalk-bot-3.png -- 150.74kb -> 80.43kb (46.64%)
/docSite/assets/imgs/image-45.png -- 241.12kb -> 139.12kb (42.3%)
/docSite/assets/imgs/dingtalk-bot-7.png -- 157.98kb -> 93.12kb (41.05%)
/docSite/assets/imgs/image-22.png -- 85.17kb -> 50.65kb (40.52%)
/docSite/assets/imgs/image-21.png -- 166.09kb -> 105.67kb (36.37%)
/docSite/assets/imgs/image-30.png -- 949.57kb -> 610.28kb (35.73%)
/docSite/assets/imgs/image-39.png -- 157.46kb -> 103.23kb (34.44%)
/docSite/assets/imgs/image-31.png -- 152.24kb -> 100.19kb (34.19%)
/docSite/assets/imgs/image-32.png -- 202.03kb -> 133.60kb (33.87%)
/docSite/assets/imgs/image-40.png -- 190.04kb -> 125.73kb (33.84%)
/docSite/assets/imgs/image-20.png -- 156.46kb -> 103.55kb (33.82%)
/docSite/assets/imgs/image-48.png -- 310.79kb -> 207.13kb (33.35%)
/docSite/assets/imgs/image-42.png -- 281.93kb -> 188.72kb (33.06%)
/docSite/assets/imgs/image-25.png -- 320.31kb -> 216.69kb (32.35%)
/docSite/assets/imgs/image-29.png -- 366.64kb -> 251.01kb (31.54%)
/docSite/assets/imgs/image-37.png -- 195.95kb -> 134.56kb (31.33%)
/docSite/assets/imgs/image-44.png -- 197.77kb -> 136.19kb (31.13%)
/docSite/assets/imgs/image-28.png -- 320.12kb -> 221.57kb (30.79%)
/docSite/assets/imgs/image-26.png -- 357.81kb -> 251.20kb (29.79%)
/docSite/assets/imgs/image-38.png -- 205.90kb -> 144.59kb (29.77%)
/docSite/assets/imgs/image-49.png -- 118.70kb -> 83.41kb (29.73%)
/docSite/assets/imgs/image-47.png -- 250.87kb -> 177.99kb (29.05%)
/docSite/assets/imgs/image-50.png -- 248.29kb -> 176.23kb (29.02%)
/docSite/assets/imgs/image-41.png -- 351.94kb -> 250.54kb (28.81%)
/docSite/assets/imgs/image-34.png -- 60.95kb -> 43.46kb (28.71%)
/docSite/assets/imgs/image-43.png -- 190.00kb -> 135.54kb (28.66%)
/docSite/assets/imgs/image-46.png -- 249.17kb -> 177.94kb (28.59%)
/docSite/assets/imgs/image-36.png -- 153.27kb -> 113.29kb (26.08%)
/docSite/assets/imgs/image-27.png -- 488.49kb -> 367.54kb (24.76%)
/docSite/assets/imgs/image-24.png -- 72.54kb -> 57.77kb (20.35%)
/docSite/assets/imgs/image-23.png -- 113.25kb -> 91.34kb (19.34%)
/docSite/assets/imgs/image-35.png -- 78.37kb -> 63.56kb (18.9%)
/docSite/assets/imgs/image-33.png -- 79.92kb -> 65.38kb (18.2%)
/docSite/assets/imgs/dingtalk-bot-8.png -- 129.33kb -> 112.41kb (13.08%)
/docSite/assets/imgs/dingtalk-bot-2.png -- 158.93kb -> 141.03kb (11.26%)
/docSite/assets/imgs/dingtalk-bot-6.png -- 108.22kb -> 96.11kb (11.19%)
/docSite/assets/imgs/dingtalk-bot-5.png -- 168.14kb -> 152.32kb (9.41%)
/docSite/assets/imgs/dingtalk-bot-1.png -- 91.40kb -> 82.86kb (9.35%)
/docSite/assets/imgs/searxng_plugin_guide1.png -- 338.63kb -> 323.95kb (4.33%)
/docSite/assets/imgs/dingtalk-bot-4.png -- 314.37kb -> 313.01kb (0.43%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2024-12-20 19:40:04 +08:00
Archer
87e7c23da4 4.8.16 test (#3445)
* perf: model selector ux

* perf: model selector ux
2024-12-20 19:38:20 +08:00
Archer
e6d53e3daa 4.8.16 test (#3442)
* perf: simple app save

* fix: notify config i18n

* perf: service side props render

* perf: model selector

* update doc
2024-12-20 18:58:40 +08:00
Archer
922cb433d3 perf: pay ui;update version doc (#3439)
* perf: pay ui

* update doc
2024-12-19 17:54:56 +08:00
138 changed files with 1232 additions and 539 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 KiB

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 KiB

After

Width:  |  Height:  |  Size: 610 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 352 KiB

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 KiB

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 KiB

After

Width:  |  Height:  |  Size: 324 KiB

View File

@@ -21,16 +21,16 @@ weight: 708
"lafEnv": "https://laf.dev" // laf环境。 https://laf.run (杭州阿里云) ,或者私有化的laf环境。如果使用 Laf openapi 功能,需要最新版的 laf 。
},
"systemEnv": {
"vectorMaxProcess": 15,
"qaMaxProcess": 15,
"vectorMaxProcess": 15, // 向量处理线程数量
"qaMaxProcess": 15, // 问答拆分线程数量
"tokenWorkers": 50, // Token 计算线程保持数,会持续占用内存,不能设置太大。
"pgHNSWEfSearch": 100 // 向量搜索参数。越大搜索越精确但是速度越慢。设置为100有99%+精度。
},
"llmModels": [
{
"provider": "OpenAI", // 模型提供商主要用于分类展示目前已经内置提供商包括https://github.com/labring/FastGPT/blob/main/packages/global/core/ai/provider.ts, 可 pr 提供新的提供商,或直接填写 Other
"model": "gpt-4o-mini", // 模型名(对应OneAPI中渠道的模型名)
"name": "gpt-4o-mini", // 模型别名
"avatar": "/imgs/model/openai.svg", // 模型的logo
"maxContext": 125000, // 最大上下文
"maxResponse": 16000, // 最大回复
"quoteMaxToken": 120000, // 最大引用内容
@@ -38,7 +38,7 @@ weight: 708
"charsPointsPrice": 0, // n积分/1k token商业版
"censor": false, // 是否开启敏感校验(商业版)
"vision": true, // 是否支持图片输入
"datasetProcess": true, // 是否设置为知识库处理模型QA务必保证至少有一个为true否则知识库会报错
"datasetProcess": true, // 是否设置为文本理解模型QA务必保证至少有一个为true否则知识库会报错
"usedInClassify": true, // 是否用于问题分类务必保证至少有一个为true
"usedInExtractFields": true, // 是否用于内容提取务必保证至少有一个为true
"usedInToolCall": true, // 是否用于工具调用务必保证至少有一个为true
@@ -48,12 +48,13 @@ weight: 708
"customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型
"customExtractPrompt": "", // 自定义内容提取提示词
"defaultSystemChatPrompt": "", // 对话默认携带的系统提示词
"defaultConfig": {} // 请求API时挟带一些默认配置比如 GLM4 的 top_p
"defaultConfig": {}, // 请求API时挟带一些默认配置比如 GLM4 的 top_p
"fieldMap": {} // 字段映射o1 模型需要把 max_tokens 映射为 max_completion_tokens
},
{
"provider": "OpenAI",
"model": "gpt-4o",
"name": "gpt-4o",
"avatar": "/imgs/model/openai.svg",
"maxContext": 125000,
"maxResponse": 4000,
"quoteMaxToken": 120000,
@@ -71,14 +72,15 @@ weight: 708
"customCQPrompt": "",
"customExtractPrompt": "",
"defaultSystemChatPrompt": "",
"defaultConfig": {}
"defaultConfig": {},
"fieldMap": {}
},
{
"provider": "OpenAI",
"model": "o1-mini",
"name": "o1-mini",
"avatar": "/imgs/model/openai.svg",
"maxContext": 125000,
"maxResponse": 4000,
"maxResponse": 65000,
"quoteMaxToken": 120000,
"maxTemperature": 1.2,
"charsPointsPrice": 0,
@@ -99,11 +101,11 @@ weight: 708
}
},
{
"provider": "OpenAI",
"model": "o1-preview",
"name": "o1-preview",
"avatar": "/imgs/model/openai.svg",
"maxContext": 125000,
"maxResponse": 4000,
"maxResponse": 32000,
"quoteMaxToken": 120000,
"maxTemperature": 1.2,
"charsPointsPrice": 0,
@@ -126,21 +128,18 @@ weight: 708
],
"vectorModels": [
{
"model": "text-embedding-ada-002", // 模型名与OneAPI对应
"name": "Embedding-2", // 模型展示名
"avatar": "/imgs/model/openai.svg", // logo
"charsPointsPrice": 0, // n积分/1k token
"defaultToken": 700, // 默认文本分割时候的 token
"maxToken": 3000, // 最大 token
"weight": 100, // 优先训练权重
"defaultConfig": {}, // 自定义额外参数。例如,如果希望使用 embedding3-large 的话,可以传入 dimensions:1024来返回1024维度的向量。目前必须小于1536维度
"dbConfig": {}, // 存储时的额外参数(非对称向量模型时候需要用到)
"queryConfig": {} // 参训时的额外参数
"provider": "OpenAI",
"model": "text-embedding-3-small",
"name": "text-embedding-3-small",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
"weight": 100
},
{
"provider": "OpenAI",
"model": "text-embedding-3-large",
"name": "text-embedding-3-large",
"avatar": "/imgs/model/openai.svg",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
@@ -150,13 +149,16 @@ weight: 708
}
},
{
"model": "text-embedding-3-small",
"name": "text-embedding-3-small",
"avatar": "/imgs/model/openai.svg",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
"weight": 100
"provider": "OpenAI",
"model": "text-embedding-ada-002", // 模型名与OneAPI对应
"name": "Embedding-2", // 模型展示名
"charsPointsPrice": 0, // n积分/1k token
"defaultToken": 700, // 默认文本分割时候的 token
"maxToken": 3000, // 最大 token
"weight": 100, // 优先训练权重
"defaultConfig": {}, // 自定义额外参数。例如,如果希望使用 embedding3-large 的话,可以传入 dimensions:1024来返回1024维度的向量。目前必须小于1536维度
"dbConfig": {}, // 存储时的额外参数(非对称向量模型时候需要用到)
"queryConfig": {} // 参训时的额外参数
}
],
"reRankModels": [],
@@ -183,25 +185,33 @@ weight: 708
}
```
## 关于模型 logo
## 模型提供商
统一放置在项目的`public/imgs/model/xxx`目录中目前内置了以下几种如果有需要可以PR增加。默认logo为 Hugging face 的 logo~
为了方便模型分类展示FastGPT 内置了部分模型提供商的名字和 Logo。如果你期望补充提供商可[提交 Issue](https://github.com/labring/FastGPT/issues),并提供几个信息:
1. 厂商官网地址
2. 厂商 SVG logo建议是正方形图片。
目前已支持的提供商, 复制 "-" 之前的字符串,作为 provider 的值。
- OpenAI
- Claude
- Gemini
- MistralAI
- Qwen - 通义千问
- Doubao - 豆包
- ChatGLM - 智谱
- DeepSeek - 深度求索
- Moonshot - 月之暗面
- MiniMax
- SparkDesk - 讯飞星火
- Hunyuan - 腾讯混元
- Baichuan - 百川
- Yi - 零一万物
- Ernie - 文心一言
- Ollama
- Other - 其他
- /imgs/model/baichuan.svg - 百川智能
- /imgs/model/chatglm.svg - 智谱清言
- /imgs/model/claude.svg - claude
- /imgs/model/deepseek.svg - deepseek
- /imgs/model/doubao.svg - 火山豆包
- /imgs/model/ernie.svg - 文心一言
- /imgs/model/gemini.svg - gemini
- /imgs/model/huggingface.svg - Hugging face【默认logo】
- /imgs/model/minimax.svg - minimax
- /imgs/model/moonshot.svg - 月之暗面
- /imgs/model/openai.svg - OpenAI GPT
- /imgs/model/qwen.svg - 通义千问
- /imgs/model/sparkDesk.svg - 讯飞星火
- /imgs/model/yi.svg - 零一万物
- /imgs/model/hunyuan.svg - 腾讯混元
## 特殊模型

View File

@@ -7,6 +7,46 @@ toc: true
weight: 808
---
## 更新指南
### 1. 更新镜像:
- 更新 fastgpt 镜像 tag: v4.8.16-beta
- 更新 fastgpt-pro 商业版镜像 tag: v4.8.16-beta
- Sandbox 镜像 tag: v4.8.16-beta
### 2. 更新配置文件
参考最新的[配置文件](/docs/development/configuration/),更新 `config.json` 或 admin 中模型文件配置。给 LLMModel 和 VectorModel 增加 `provider` 字段,以便进行模型分类。例如:
```json
{
"provider": "OpenAI", // 这是新增的
"model": "gpt-4o",
"name": "gpt-4o",
"maxContext": 125000,
"maxResponse": 4000,
"quoteMaxToken": 120000,
"maxTemperature": 1.2,
"charsPointsPrice": 0,
"censor": false,
"vision": true,
"datasetProcess": true,
"usedInClassify": true,
"usedInExtractFields": true,
"usedInToolCall": true,
"usedInQueryExtension": true,
"toolChoice": true,
"functionCall": false,
"customCQPrompt": "",
"customExtractPrompt": "",
"defaultSystemChatPrompt": "",
"defaultConfig": {},
"fieldMap": {}
}
```
## 完整更新内容
@@ -17,13 +57,15 @@ weight: 808
5. 新增 - 商业版支持钉钉 SSO 登录配置。[点击查看教程](/docs/guide/admin/sso_dingtalk/)
6. 新增 - 商业版支持飞书和语雀知识库导入。[点击查看教程](/docs/guide/knowledge_base/lark_dataset/)
7. 新增 - sandbox 新增 createHmac 加密全局方法。
8. 新增 - 工作流右键支持
9. 优化 - 工作流/简易模式变量初始化代码,去除监听初始化,避免因渲染顺序不一致导致的失败
10. 优化 - 工作流获取数据类型不一致数据时,增加类型转化,避免 undefined
11. 修复 - 无法自动切换默认语言。增加分享链接,强制执行一次切换默认语言
12. 修复 - 数组选择器自动兼容 4.8.13 以前的数据
13. 修复 - 站点同步知识库,链接同步时未使用选择器
14. 修复 - 简易模式转工作流,没有把系统配置项转化
15. 修复 - 插件独立运行,变量初始值未赋上
16. 修复 - 工作流使用弹窗组件时,关闭弹窗后,有时候会出现页面偏移
17. 修复 - 插件调试时,日志未保存插件输入参数。
8. 新增 - 工作流右键支持全部折叠。
9. 优化 - 模型选择器
10. 优化 - SSR 渲染,预判断是移动端还是 pc 端,减少页面抖动
11. 优化 - 工作流/简易模式变量初始化代码,去除监听初始化,避免因渲染顺序不一致导致的失败
12. 优化 - 工作流获取数据类型不一致数据时,增加类型转化,避免 undefined
13. 修复 - 无法自动切换默认语言。增加分享链接,强制执行一次切换默认语言
14. 修复 - 数组选择器自动兼容 4.8.13 以前的数据
15. 修复 - 站点同步知识库,链接同步时未使用选择器
16. 修复 - 简易模式转工作流,没有把系统配置项转化
17. 修复 - 插件独立运行,变量初始值未赋上。
18. 修复 - 工作流使用弹窗组件时,关闭弹窗后,有时候会出现页面偏移。
19. 修复 - 插件调试时,日志未保存插件输入参数。

View File

@@ -11,11 +11,14 @@ weight: 104
| | | |
| --- | --- | --- |
| ![](/imgs/aichat0.png) | ![](/imgs/aichat02.png) | ![](/imgs/aichat2.png) |
| ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) |
## 返回AI内容高级编排特有)
## 流响应(高级编排 AI 对话 特有)
这是一个开关,打开的时候,当 AI 对话模块运行时会将其输出的内容返回到浏览器API响应如果关闭AI 输出的内容不会返回到浏览器但是生成的内容仍可以通过【AI回复】进行输出。你可以将【AI回复】连接到其他模块中
旧版名字叫做:返回 AI 内容;新版改名:流响应
这是一个开关,打开的时候,当 AI 对话模块运行时会将其输出的内容返回到浏览器API响应
如果关闭,会强制使用非流模式调用模型,并且 AI 输出的内容不会返回到浏览器但是生成的内容仍可以通过【AI回复】进行输出。你可以将【AI回复】连接到其他模块中进行二次使用。
### 最大上下文
@@ -33,13 +36,25 @@ weight: 104
最大回复 token 数量。注意是回复的Tokens不是上下文 tokens。
通常,回复上限=min(模型允许的最大回复上限, 最大上下文-已用上下文)
所以,一般配置模型时,不会把最大上下文配置成模型实际最大上下文,而是预留预定空间给回答,例如 128k 模型,可以配置 max_context=115000
### 系统提示词
被放置在上下文数组的最前面role 为 system用于引导模型。
### 最大对话轮数(仅简易模式)
可以配置模型支持的最大对话轮数,如果模型的超出上下文,系统会自动截断,尽可能保证不超模型上下文。
所以尽管配置 30 轮对话,实际运行时候,不一定会达到 30 轮。
## 引用模板 & 引用提示词
这两个参数与知识库问答场景相关,可以控制知识库相关的提示词
进行知识库搜索后,你可以自定义组织检索结果构成的提示词,这个配置,仅工作流中 AI 对话节点可用。并且,只会在有引用知识库内容时才会生效
![alt text](/imgs/image-54.png)
### AI 对话消息组成

View File

@@ -2,3 +2,5 @@ export const HUMAN_ICON = `/icon/human.svg`;
export const LOGO_ICON = `/icon/logo.svg`;
export const HUGGING_FACE_ICON = `/imgs/model/huggingface.svg`;
export const DEFAULT_TEAM_AVATAR = `/imgs/avatar/defaultTeamAvatar.svg`;
export const isProduction = process.env.NODE_ENV === 'production';

View File

@@ -1,7 +1,10 @@
import type { ModelProviderIdType } from './provider';
export type LLMModelItemType = {
provider: ModelProviderIdType;
model: string;
name: string;
avatar?: string;
avatar?: string; // model icon, from provider
maxContext: number;
maxResponse: number;
quoteMaxToken: number;
@@ -31,6 +34,7 @@ export type LLMModelItemType = {
};
export type VectorModelItemType = {
provider: ModelProviderIdType;
model: string; // model name
name: string; // show name
avatar?: string;

View File

@@ -1,7 +1,9 @@
import type { LLMModelItemType, VectorModelItemType } from './model.d';
import { getModelProvider, ModelProviderIdType } from './provider';
export const defaultQAModels: LLMModelItemType[] = [
{
provider: 'OpenAI',
model: 'gpt-4o-mini',
name: 'gpt-4o-mini',
maxContext: 16000,
@@ -23,6 +25,7 @@ export const defaultQAModels: LLMModelItemType[] = [
export const defaultVectorModels: VectorModelItemType[] = [
{
provider: 'OpenAI',
model: 'text-embedding-3-small',
name: 'Embedding-2',
charsPointsPrice: 0,
@@ -31,3 +34,15 @@ export const defaultVectorModels: VectorModelItemType[] = [
weight: 100
}
];
export const getModelFromList = (
modelList: { provider: ModelProviderIdType; name: string; model: string }[],
model: string
) => {
const modelData = modelList.find((item) => item.model === model) ?? modelList[0];
const provider = getModelProvider(modelData.provider);
return {
...modelData,
avatar: provider.avatar
};
};

View File

@@ -0,0 +1,121 @@
import { i18nT } from '../../../web/i18n/utils';
export type ModelProviderIdType =
| 'OpenAI'
| 'Claude'
| 'Gemini'
| 'MistralAI'
| 'Qwen'
| 'Doubao'
| 'ChatGLM'
| 'DeepSeek'
| 'Moonshot'
| 'MiniMax'
| 'SparkDesk'
| 'Hunyuan'
| 'Baichuan'
| 'Yi'
| 'Ernie'
| 'Ollama'
| 'Other';
export type ModelProviderType = {
id: ModelProviderIdType;
name: string;
avatar: string;
};
export const ModelProviderList: ModelProviderType[] = [
{
id: 'OpenAI',
name: 'OpenAI',
avatar: 'model/openai'
},
{
id: 'Claude',
name: 'Claude',
avatar: 'model/claude'
},
{
id: 'Gemini',
name: 'Gemini',
avatar: 'model/gemini'
},
{
id: 'MistralAI',
name: 'MistralAI',
avatar: 'model/huggingface'
},
{
id: 'Qwen',
name: i18nT('common:model_qwen'),
avatar: 'model/qwen'
},
{
id: 'Doubao',
name: i18nT('common:model_doubao'),
avatar: 'model/doubao'
},
{
id: 'ChatGLM',
name: i18nT('common:model_chatglm'),
avatar: 'model/chatglm'
},
{
id: 'DeepSeek',
name: 'DeepSeek',
avatar: 'model/deepseek'
},
{
id: 'Moonshot',
name: i18nT('common:model_moonshot'),
avatar: 'model/moonshot'
},
{
id: 'MiniMax',
name: 'MiniMax',
avatar: 'model/minimax'
},
{
id: 'SparkDesk',
name: i18nT('common:model_sparkdesk'),
avatar: 'model/sparkDesk'
},
{
id: 'Hunyuan',
name: i18nT('common:model_hunyuan'),
avatar: 'model/hunyuan'
},
{
id: 'Baichuan',
name: i18nT('common:model_baichuan'),
avatar: 'model/baichuan'
},
{
id: 'Yi',
name: i18nT('common:model_yi'),
avatar: 'model/yi'
},
{
id: 'Ernie',
name: i18nT('common:model_ernie'),
avatar: 'model/ernie'
},
{
id: 'Ollama',
name: 'Ollama',
avatar: 'model/ollama'
},
{
id: 'Other',
name: i18nT('common:model_other'),
avatar: 'model/huggingface'
}
];
export const ModelProviderMap = Object.fromEntries(
ModelProviderList.map((item) => [item.id, item])
);
export const getModelProvider = (provider: ModelProviderIdType) => {
return ModelProviderMap[provider] ?? ModelProviderMap.Other;
};

View File

@@ -1,6 +1,6 @@
import path from 'path';
import { isProduction } from '@fastgpt/global/common/system/constants';
export const tmpFileDirPath =
process.env.NODE_ENV === 'production' ? '/app/tmp' : path.join(process.cwd(), 'tmp');
export const tmpFileDirPath = isProduction ? '/app/tmp' : path.join(process.cwd(), 'tmp');
export const previewMaxCharCount = 3000;

View File

@@ -1,4 +1,4 @@
import { isProduction } from '../system/constants';
import { isProduction } from '@fastgpt/global/common/system/constants';
import fs from 'fs';
import path from 'path';

View File

@@ -1,3 +1 @@
export const FastGPTProUrl = process.env.PRO_URL ? `${process.env.PRO_URL}/api` : '';
export const isProduction = process.env.NODE_ENV === 'production';

View File

@@ -98,6 +98,12 @@ try {
ChatItemSchema.index({ time: -1, obj: 1 }, { background: true });
// timer, clear history
ChatItemSchema.index({ teamId: 1, time: -1 }, { background: true });
// Admin charts
ChatItemSchema.index(
{ obj: 1, time: -1 },
{ background: true, partialFilterExpression: { obj: 'Human' } }
);
} catch (error) {
console.log(error);
}

View File

@@ -79,8 +79,10 @@ const UserSchema = new Schema({
try {
// login
UserSchema.index({ username: 1, password: 1 });
UserSchema.index({ createTime: -1 });
UserSchema.index({ username: 1, password: 1 }, { background: true });
// Admin charts
UserSchema.index({ createTime: -1 }, { background: true });
} catch (error) {
console.log(error);
}

View File

@@ -65,7 +65,7 @@ try {
// timer task. clear dead team
// UsageSchema.index({ teamId: 1, time: -1 }, { background: true });
UsageSchema.index({ time: 1 }, { expireAfterSeconds: 180 * 24 * 60 * 60 });
UsageSchema.index({ time: 1 }, { background: true, expireAfterSeconds: 720 * 24 * 60 * 60 });
} catch (error) {
console.log(error);
}

View File

@@ -0,0 +1,15 @@
import { I18nNsType } from '../../types/i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
export const serviceSideProps = async (content: any, ns: I18nNsType = []) => {
const lang = content.req?.cookies?.NEXT_LOCALE || content.locale;
const extraLng = content.req?.cookies?.NEXT_LOCALE ? undefined : content.locales;
// Device size
const deviceSize = content.req?.cookies?.NEXT_DEVICE_SIZE || null;
return {
...(await serverSideTranslations(lang, ['common', ...ns], null, extraLng)),
deviceSize
};
};

View File

@@ -29,6 +29,7 @@ export const iconPaths = {
'common/courseLight': () => import('./icons/common/courseLight.svg'),
'common/customTitleLight': () => import('./icons/common/customTitleLight.svg'),
'common/data': () => import('./icons/common/data.svg'),
'common/dingtalkFill': () => import('./icons/common/dingtalkFill.svg'),
'common/editor/resizer': () => import('./icons/common/editor/resizer.svg'),
'common/errorFill': () => import('./icons/common/errorFill.svg'),
'common/file/move': () => import('./icons/common/file/move.svg'),
@@ -91,7 +92,6 @@ export const iconPaths = {
'common/voiceLight': () => import('./icons/common/voiceLight.svg'),
'common/warn': () => import('./icons/common/warn.svg'),
'common/wechatFill': () => import('./icons/common/wechatFill.svg'),
'common/dingtalkFill': () => import('./icons/common/dingtalkFill.svg'),
configmap: () => import('./icons/configmap.svg'),
copy: () => import('./icons/copy.svg'),
'core/app/aiFill': () => import('./icons/core/app/aiFill.svg'),
@@ -256,7 +256,6 @@ export const iconPaths = {
'core/workflow/template/formInput': () => import('./icons/core/workflow/template/formInput.svg'),
'core/workflow/template/getTime': () => import('./icons/core/workflow/template/getTime.svg'),
'core/workflow/template/google': () => import('./icons/core/workflow/template/google.svg'),
'core/workflow/template/searxng': () => import('./icons/core/workflow/template/searxng.svg'),
'core/workflow/template/httpRequest': () =>
import('./icons/core/workflow/template/httpRequest.svg'),
'core/workflow/template/ifelse': () => import('./icons/core/workflow/template/ifelse.svg'),
@@ -275,6 +274,7 @@ export const iconPaths = {
'core/workflow/template/readFiles': () => import('./icons/core/workflow/template/readFiles.svg'),
'core/workflow/template/reply': () => import('./icons/core/workflow/template/reply.svg'),
'core/workflow/template/runApp': () => import('./icons/core/workflow/template/runApp.svg'),
'core/workflow/template/searxng': () => import('./icons/core/workflow/template/searxng.svg'),
'core/workflow/template/stopTool': () => import('./icons/core/workflow/template/stopTool.svg'),
'core/workflow/template/systemConfig': () =>
import('./icons/core/workflow/template/systemConfig.svg'),
@@ -341,6 +341,22 @@ export const iconPaths = {
'modal/selectSource': () => import('./icons/modal/selectSource.svg'),
'modal/setting': () => import('./icons/modal/setting.svg'),
'modal/teamPlans': () => import('./icons/modal/teamPlans.svg'),
'model/baichuan': () => import('./icons/model/baichuan.svg'),
'model/chatglm': () => import('./icons/model/chatglm.svg'),
'model/claude': () => import('./icons/model/claude.svg'),
'model/deepseek': () => import('./icons/model/deepseek.svg'),
'model/doubao': () => import('./icons/model/doubao.svg'),
'model/ernie': () => import('./icons/model/ernie.svg'),
'model/gemini': () => import('./icons/model/gemini.svg'),
'model/huggingface': () => import('./icons/model/huggingface.svg'),
'model/hunyuan': () => import('./icons/model/hunyuan.svg'),
'model/minimax': () => import('./icons/model/minimax.svg'),
'model/moonshot': () => import('./icons/model/moonshot.svg'),
'model/ollama': () => import('./icons/model/ollama.svg'),
'model/openai': () => import('./icons/model/openai.svg'),
'model/qwen': () => import('./icons/model/qwen.svg'),
'model/sparkDesk': () => import('./icons/model/sparkDesk.svg'),
'model/yi': () => import('./icons/model/yi.svg'),
more: () => import('./icons/more.svg'),
moreLine: () => import('./icons/moreLine.svg'),
out: () => import('./icons/out.svg'),

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 619 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1 @@
<svg t="1734679654271" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7734" width="64" height="64"><path d="M604.814264 81.402675a1319.065676 1319.065676 0 0 1 36.517088 237.361069c-88.649795-11.49071-173.856333 0.427554-255.619614 35.756315a427.093207 427.093207 0 0 0-59.340267 34.23477 450.161355 450.161355 0 0 0-66.947994 49.450223C170.040297 521.839834 103.600499 620.994377 60.10104 735.667162c-0.715126-140.51471 0.045646-281.003554 2.282318-421.468054C76.803043 215.078039 122.195305 133.675364 198.561664 69.991085c95.178746-71.853456 199.150502-87.575584 311.916791-47.167905 35.223774 13.789765 66.669551 33.315756 94.335809 58.579495z" fill="#A569FF" p-id="7735"></path><path d="M604.814264 81.402675a56768.782835 56768.782835 0 0 0 346.912333 352.998514c-94.145617-61.14482-197.102502-99.183453-308.8737-114.115899-1.014871 0-1.521545-0.506675-1.521545-1.521546a1319.065676 1319.065676 0 0 0-36.517088-237.361069z" fill="#2038FB" p-id="7736"></path><path d="M641.331352 318.763744c0 1.014871 0.506675 1.521545 1.521545 1.521546 7.105617 102.384785 3.301753 204.328321-11.411589 305.830609-13.789765 84.228184-40.416808 163.855215-79.88113 238.882615a499.523328 499.523328 0 0 1-103.465081 35.756315c-131.312404 17.313664-206.122223-39.744285-224.427935-171.173848-8.108315-103.991536 14.20819-200.863762 66.947994-290.615156a679.070241 679.070241 0 0 1 35.756315-50.210996 427.093207 427.093207 0 0 1 59.340267-34.23477c81.763281-35.328761 166.969819-47.247025 255.619614-35.756315z" fill="#FEFEFE" p-id="7737"></path><path d="M642.852897 320.28529c111.771198 14.932446 214.728083 52.971079 308.8737 114.115899 1.240059 2.034306 3.015703 3.555851 5.325409 4.564636 6.883471 14.958312 10.18066 30.681961 9.890045 47.167905-3.882984 72.767905-26.95874 138.70255-69.230313 197.800891-44.500636 59.716089-96.993949 111.196053-157.47994 154.43685-86.741777 63.043709-180.570912 113.508802-281.485884 151.393759 36.800095-37.296119 67.739198-78.886039 92.814264-124.766716 39.464321-75.0274 66.091364-154.654431 79.88113-238.882615 14.713343-101.502288 18.517207-203.445825 11.411589-305.830609z" fill="#37E0BE" p-id="7738"></path><path d="M326.371471 388.754829a679.070241 679.070241 0 0 0-35.756315 50.210996c-52.739804 89.751394-75.056309 186.62362-66.947994 290.615156 18.305712 131.429563 93.11553 188.487513 224.427935 171.173848a499.523328 499.523328 0 0 0 103.465081-35.756315c-25.075067 45.880678-56.014169 87.470597-92.814264 124.766716-39.120452 18.194639-80.202175 29.099554-123.245171 32.713225-87.99553 4.042746-161.790478-26.134062-221.384844-90.531947-45.209676-57.563103-63.215643-122.989551-54.014859-196.279346 43.499459-114.672785 109.939257-213.827328 199.322437-297.46211a450.161355 450.161355 0 0 1 66.947994-49.450223z" fill="#1F37FB" p-id="7739"></path></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="181px" height="256px" viewBox="0 0 181 256" enable-background="new 0 0 181 256" xml:space="preserve"> <image id="image0" width="181" height="256" x="0" y="0"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALUAAAEACAQAAABfKv9QAAAAIGNIUk0AAHomAACAhAAA+gAAAIDo
AAB1MAAA6mAAADqYAAAXcJy6UTwAAAACYktHRAD/h4/MvwAAAAlwSFlzAAALEwAACxMBAJqcGAAA
AAd0SU1FB+gMFAcXBsXnKaAAABhJSURBVHja7Z17fBRVlse/3QkQQJ4RSAjhTVBEYUUGQUXkAyKC
z2EFnXUVnPm4M6vI7meQGcZR/IyP8THjOOPIfFSQnUUdJSwsKoMLIuiAAoq830hUQkAJhEdCyKN7
/+h00o+qc291V3d1J/WrfyB1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qsT3LeGNAG3FHdouZWL7Yfcx02qoUxUyxC+luLHSfIHTOliyi
jRHZnBN4C0kJG9pXjxIqfN9SsummhFLeF+6OMv5zkfB0JPe/po4pAm9FRgKdBYHqpIaASzd0iMoD
GXp1DhZr6ECkBNWbOem0PSmMk6J3ej2vDVRLDpAfO21NikPip57XBqqldHzxpRVr/JD4qee1gWop
ud/nTtuS4pD4MeD1uGnHfto946WAFGr9eEOhAFoKU5QDcaQ1bRrwCeeZs4PJkoNUdxMq2uu0JWkA
iaM6boNUS3GHkh/tN/0gcVTHbZDqtkJR5+Oipj4kjuq4DVItBcM54bQdaQCJozpudcYW6RFn11lo
cBSkup1Qxh1/qCFxVMdtkGppOcntQNSQOKrjVqcDOa1RpqlDg6Mg1VJYQ/f8ixoSR3XcBqmWYu1J
A0EXAUgc1XEbpFoKQevulKshOUPWcavTgbhxUdWQUrFFdCBSWEM3WKca3YV7ddzq9NV9nLYjDSBx
FNFXS3N4NxaIGhJHEdx6KDNd3K5x98sV6CAEQigL+kE2fBZ3m1aUwVinbUlxjBUCeOyO/Cxi7soH
rsONAhI/W6L/JJ3EO+NYtrd0QAshPb3hKc+eogf8IKftSWEMEpnrGSzW0IEUiUFoWzptTwpD4mZX
g9de6MqeedSxWsfyLqYDDggpjt9p+Of/Awvt5JDOeiscAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0
LTEyLTIwVDA3OjIzOjAyKzAwOjAwzGVNMQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0yMFQw
NzoyMzowMiswMDowML049Y0AAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMjBUMDc6MjM6
MDYrMDA6MDAeYvBBAAAAAElFTkSuQmCC" />
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1734679619961" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4292" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M955 607.2L843.6 412.1l47.8-91.6c6.6-8.7 8.3-21.5 5.6-31.8L835.7 178c-4.7-7.3-12.8-11.8-21.5-12H586.3l-51-89.2c-3.6-7-10.5-11.8-18.3-12.7H396.7c-8.9 0.2-15.2 6.7-19.6 14.4l-1.9 3.1-113.8 195.1H152.2c-9-0.2-17.5 4.3-22.3 12L67 400.1c-4 8-4 17.5 0 25.5l113.1 196.7-51 89.2c-4 8-4 17.4 0 25.5l58.1 102c4.7 7.8 13.2 12.7 22.3 12.7h227.8l54.9 95.5c4.2 7.2 11.6 11.9 19.9 12.8h129c8.9-0.2 17.1-5 21.5-12.7L775 750.5h100.4c8.9-0.8 16.9-5.8 21.5-13.5L955 634.3c5.4-8.3 5.4-18.9 0-27.1zM814.1 620L756 512.5 517 933.7l-65.3-107.5H212.8l57.4-104.3H392L153 302.2h125L396.7 90.3l59.7 104.3-61.3 107.5H873l-60.5 106.8 120.3 211H814.1z" fill="#605BEC" p-id="4293"></path><path d="M511.4 660.5l149-238.9H361.7l149.7 238.9z m0 0" fill="#605BEC" p-id="4294"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -1,4 +1,4 @@
<svg width="600" height="600" viewBox="0 0 600 600" fill="none" xmlns="http://www.w3.org/2000/svg">
<svg viewBox="0 0 600 600" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="300" cy="300" r="300" fill="white" />
<rect x="409.733" y="340.032" width="42.3862" height="151.648" rx="21.1931" fill="#003425" />
<path fill-rule="evenodd" clip-rule="evenodd"

Before

Width:  |  Height:  |  Size: 917 B

After

Width:  |  Height:  |  Size: 892 B

View File

@@ -6,8 +6,9 @@ import { useSystem } from '../../../hooks/useSystem';
import Loading from '../MyLoading';
import MyImage from './MyImage';
const MyPhotoView = ({ ...props }: ImageProps) => {
const MyPhotoView = (props: ImageProps) => {
const { isPc } = useSystem();
return (
<PhotoProvider
maskOpacity={0.6}

View File

@@ -8,9 +8,17 @@ const LightTip = ({
text: string;
} & StackProps) => {
return (
<HStack px="3" py="1" color="primary.600" bgColor="primary.50" borderRadius="md" {...props}>
<HStack
px="3"
py="1"
color="primary.600"
bgColor="primary.50"
borderRadius="md"
fontSize={'sm'}
{...props}
>
<Icon name="common/info" w="1rem" />
<Box fontSize={'sm'}>{text}</Box>
<Box>{text}</Box>
</HStack>
);
};

View File

@@ -1,5 +1,16 @@
import React, { useRef, useCallback, useState, useMemo } from 'react';
import { Button, useDisclosure, Box, Flex, useOutsideClick, Checkbox } from '@chakra-ui/react';
import React, { useRef, useCallback, useState, useMemo, useEffect } from 'react';
import {
Button,
useDisclosure,
Box,
Flex,
useOutsideClick,
Checkbox,
css,
Menu,
MenuButton,
MenuList
} from '@chakra-ui/react';
import { ListItemType, MultipleArraySelectProps, MultipleSelectProps } from './type';
import EmptyTip from '../EmptyTip';
import { useTranslation } from 'next-i18next';
@@ -13,19 +24,34 @@ export const MultipleRowSelect = ({
emptyTip,
maxH = 300,
onSelect,
popDirection = 'bottom',
styles,
changeOnEverySelect = false
}: MultipleSelectProps) => {
ButtonProps,
changeOnEverySelect = false,
rowMinWidth = 'autp'
}: MultipleSelectProps & {
rowMinWidth?: string;
}) => {
const { t } = useTranslation();
const ref = useRef<HTMLDivElement>(null);
const ButtonRef = useRef<HTMLButtonElement>(null);
const { isOpen, onOpen, onClose } = useDisclosure();
const [cloneValue, setCloneValue] = useState(value);
useOutsideClick({
ref: ref,
handler: onClose
});
const MenuRef = useRef<(HTMLDivElement | null)[]>([]);
const SelectedItemRef = useRef<(HTMLDivElement | null)[]>([]);
useEffect(() => {
if (isOpen) {
for (let i = 0; i < MenuRef.current.length; i++) {
const menu = MenuRef.current[i];
const selectedItem = SelectedItemRef.current[i];
if (menu && selectedItem) {
menu.scrollTop = selectedItem.offsetTop - menu.offsetTop - 100;
}
}
}
}, [isOpen]);
const minWidth = `${MenuRef.current?.[0]?.offsetWidth || 0}px`;
const RenderList = useCallback(
({ index, list }: { index: number; list: MultipleSelectProps['list'] }) => {
@@ -34,14 +60,26 @@ export const MultipleRowSelect = ({
const children = list[selectedIndex]?.children || [];
const hasChildren = list.some((item) => item.children && item.children?.length > 0);
// Store current scroll position before update
const currentScrollTop = MenuRef.current[index]?.scrollTop;
// Use useEffect to restore scroll position after render
useEffect(() => {
if (currentScrollTop !== undefined && MenuRef.current[index]) {
MenuRef.current[index]!.scrollTop = currentScrollTop;
}
}, [cloneValue, currentScrollTop]);
return (
<>
<Box
ref={(ref) => {
MenuRef.current[index] = ref;
}}
className="nowheel"
flex={'1 0 auto'}
// width={0}
px={2}
borderLeft={index !== 0 ? 'base' : 'none'}
minW={index !== 0 ? minWidth : rowMinWidth}
maxH={`${maxH}px`}
overflowY={'auto'}
whiteSpace={'nowrap'}
@@ -49,13 +87,18 @@ export const MultipleRowSelect = ({
{list.map((item) => (
<Flex
key={item.value}
py={2}
ref={(ref) => {
if (item.value === selectedValue) {
SelectedItemRef.current[index] = ref;
}
}}
py={1.5}
_notLast={{ mb: 1 }}
cursor={'pointer'}
px={2}
borderRadius={'md'}
px={1.5}
borderRadius={'sm'}
_hover={{
bg: 'primary.50',
color: 'primary.600'
bg: 'primary.50'
}}
onClick={() => {
const newValue = [...cloneValue];
@@ -81,6 +124,7 @@ export const MultipleRowSelect = ({
}}
{...(item.value === selectedValue
? {
bg: 'primary.50',
color: 'primary.600'
}
: {})}
@@ -109,60 +153,73 @@ export const MultipleRowSelect = ({
}, [value, onOpen]);
return (
<Box ref={ref} position={'relative'}>
<Button
justifyContent={'space-between'}
width={'100%'}
variant={'whitePrimaryOutline'}
size={'lg'}
fontSize={'sm'}
px={3}
outline={'none'}
rightIcon={<MyIcon name={'core/chat/chevronDown'} w="1rem" color={'myGray.500'} />}
_active={{
transform: 'none'
}}
{...(isOpen
? {
borderColor: 'primary.600',
color: 'primary.700',
boxShadow: '0px 0px 0px 2.4px rgba(51, 112, 255, 0.15)'
}
: {
borderColor: 'myGray.200',
boxShadow: 'none'
})}
{...styles}
onClick={() => (isOpen ? onClose() : onOpenSelect())}
<Box
css={css({
'& div': {
width: 'auto !important'
}
})}
>
<Menu
autoSelect={false}
isOpen={isOpen}
onOpen={onOpenSelect}
onClose={onClose}
strategy={'fixed'}
matchWidth
>
<Box>{label ?? placeholder}</Box>
</Button>
{isOpen && (
<Box
position={'absolute'}
{...(popDirection === 'top'
<MenuButton
as={Button}
ref={ButtonRef}
width={'100%'}
px={3}
rightIcon={<MyIcon name={'core/chat/chevronDown'} w={4} color={'myGray.500'} />}
variant={'whitePrimaryOutline'}
size={'lg'}
fontSize={'sm'}
textAlign={'left'}
_active={{
transform: 'none'
}}
{...(isOpen
? {
transform: 'translateY(-105%)',
top: '0'
boxShadow: '0px 0px 0px 2.4px rgba(51, 112, 255, 0.15)',
borderColor: 'primary.600',
color: 'primary.700'
}
: {
transform: 'translateY(105%)',
bottom: '0'
})}
py={2}
bg={'white'}
border={'1px solid #fff'}
boxShadow={'5'}
borderRadius={'md'}
zIndex={1}
minW={'100%'}
w={'max-content'}
: {})}
{...ButtonProps}
>
<Flex>
<RenderList list={list} index={0} />
</Flex>
</Box>
)}
<Box>{label ?? placeholder}</Box>
</MenuButton>
<MenuList
className={ButtonProps?.className}
minW={(() => {
const w = ButtonRef.current?.clientWidth;
if (w) {
return `${w}px !important`;
}
const width = ButtonProps?.width;
return Array.isArray(width)
? width.map((item) => `${item} !important`)
: `${width} !important`;
})()}
w={'auto'}
py={'6px'}
border={'1px solid #fff'}
boxShadow={
'0px 2px 4px rgba(161, 167, 179, 0.25), 0px 0px 1px rgba(121, 141, 159, 0.25);'
}
zIndex={99}
maxH={'40vh'}
overflowY={'auto'}
display={'flex'}
userSelect={'none'}
>
<RenderList list={list} index={0} />
</MenuList>
</Menu>
</Box>
);
};
@@ -176,7 +233,7 @@ export const MultipleRowArraySelect = ({
maxH = 300,
onSelect,
popDirection = 'bottom',
styles
ButtonProps
}: MultipleArraySelectProps) => {
const { t } = useTranslation();
const ref = useRef<HTMLDivElement>(null);
@@ -318,7 +375,7 @@ export const MultipleRowArraySelect = ({
borderColor: 'myGray.200',
boxShadow: 'none'
})}
{...styles}
{...ButtonProps}
onClick={() => (isOpen ? onClose() : onOpenSelect())}
className="nowheel"
>
@@ -343,7 +400,7 @@ export const MultipleRowArraySelect = ({
border={'1px solid #fff'}
boxShadow={'5'}
borderRadius={'md'}
zIndex={1}
zIndex={1000}
minW={'100%'}
w={'max-content'}
>

View File

@@ -1,3 +1,5 @@
import { ButtonProps } from '@chakra-ui/react';
type ListItemType = {
alias?: string;
label: string | React.ReactNode;
@@ -12,9 +14,9 @@ export type MultipleSelectProps = {
emptyTip?: string;
maxH?: number;
onSelect: (val: any[]) => void;
styles?: ButtonProps;
popDirection?: 'top' | 'bottom';
changeOnEverySelect?: boolean;
ButtonProps?: ButtonProps;
};
export type MultipleArraySelectProps = Omit<MultipleSelectProps, 'value'> & {
value?: any[][];

View File

@@ -0,0 +1,76 @@
import React, { useMemo } from 'react';
import { Slider, SliderTrack, SliderThumb, HStack, SliderMark } from '@chakra-ui/react';
import MyNumberInput from '../Input/NumberInput';
const InputSlider = ({
onChange,
value,
max = 100,
min = 0,
step = 1
}: {
value: number;
onChange: (index: number) => void;
max: number;
min: number;
step?: number;
}) => {
const markList = useMemo(() => {
const valLen = max - min;
return [
valLen * 0.007 + min,
valLen * 0.2 + min,
valLen * 0.4 + min,
valLen * 0.6 + min,
valLen * 0.8 + min,
valLen * 0.985 + min
];
}, []);
return (
<HStack zIndex={10} spacing={3}>
<Slider
max={max}
min={min}
step={step}
value={value}
focusThumbOnChange={false}
onChange={onChange}
>
<SliderTrack bg={'myGray.100'} h={'4px'} />
{markList.map((val, i) => (
<SliderMark
key={i}
value={val}
w={'2px'}
h={'2px'}
bg={'#A4A4A4'}
borderRadius={'2px'}
opacity={0.4}
transform={'translateY(-50%)'}
/>
))}
<SliderThumb
bg={'primary.500'}
border={'4px solid'}
borderColor={'#dee7f6'}
w={'18px'}
h={'18px'}
boxShadow={'none'}
// transform={'translate(-50%, -50%) !important'}
/>
</Slider>
<MyNumberInput
size={'sm'}
width={'150px'}
min={min}
max={max}
step={step}
value={value}
onChange={(e) => onChange(e ?? min)}
/>
</HStack>
);
};
export default InputSlider;

View File

@@ -0,0 +1,47 @@
import React, { ReactNode, useMemo } from 'react';
import { createContext } from 'use-context-selector';
import { useMediaQuery } from '@chakra-ui/react';
import Cookies from 'js-cookie';
import { useEffect } from 'react';
const CookieKey = 'NEXT_DEVICE_SIZE';
const setSize = (value: string) => {
Cookies.set(CookieKey, value, { expires: 30 });
localStorage.setItem(CookieKey, value);
};
type useSystemContextType = {
isPc: boolean;
};
export const useSystemStoreContext = createContext<useSystemContextType>({
isPc: true
});
const SystemStoreContextProvider = ({
children,
device
}: {
children: ReactNode;
device?: 'pc' | 'mobile' | null;
}) => {
const [isPc] = useMediaQuery('(min-width: 900px)', {
fallback: device === 'pc'
});
useEffect(() => {
setSize(isPc ? 'pc' : 'mobile');
}, [isPc]);
const contextValue = useMemo(
() => ({
isPc
}),
[isPc]
);
return (
<useSystemStoreContext.Provider value={contextValue}>{children}</useSystemStoreContext.Provider>
);
};
export default SystemStoreContextProvider;

View File

@@ -1,5 +1,6 @@
import { useTranslation } from 'next-i18next';
import { useEffect } from 'react';
import { isProduction } from '@fastgpt/global/common/system/constants';
export const useBeforeunload = (props?: { callback?: () => any; tip?: string }) => {
const { t } = useTranslation();
@@ -7,16 +8,15 @@ export const useBeforeunload = (props?: { callback?: () => any; tip?: string })
const { tip = t('common:common.Confirm to leave the page'), callback } = props || {};
useEffect(() => {
const listen =
process.env.NODE_ENV === 'production'
? (e: any) => {
e.preventDefault();
e.returnValue = tip;
callback?.();
}
: () => {
callback?.();
};
const listen = isProduction
? (e: any) => {
e.preventDefault();
e.returnValue = tip;
callback?.();
}
: () => {
callback?.();
};
window.addEventListener('beforeunload', listen);
return () => {

View File

@@ -1,7 +1,8 @@
import { useMediaQuery } from '@chakra-ui/react';
import { useSystemStoreContext } from '../context/useSystem';
import { useContextSelector } from 'use-context-selector';
export const useSystem = () => {
const [isPc] = useMediaQuery('(min-width: 900px)');
const isPc = useContextSelector(useSystemStoreContext, (state) => state.isPc);
return { isPc };
};

View File

@@ -77,7 +77,7 @@
"usage_balance_notice": "Due to the system upgrade, the original \"automatic renewal and deduction from balance\" mode has been cancelled, and the balance recharge entrance has been closed. \nYour balance can be used to purchase points",
"user_account": "Username",
"user_team_team_name": "Team",
"verification_code_required": "Verification code cannot be empty",
"verification_code": "Verification code",
"you_can_convert": "you can redeem",
"yuan": "Yuan"
}

View File

@@ -3,6 +3,7 @@
"Run": "Execute",
"Team Tags Set": "Team tags",
"Team_Tags": "Team tags",
"ai_point_price": "Billing",
"ai_settings": "AI Configuration",
"all_apps": "All Applications",
"app.Version name": "Version Name",
@@ -19,8 +20,9 @@
"auto_execute_tip": "After turning it on, the workflow will be automatically triggered when the user enters the conversation interface. \nExecution order: 1. Dialogue starter; 2. Global variables; 3. Automatic execution.",
"auto_save": "Auto save",
"chat_debug": "Chat Preview",
"chat_logs": "Conversation Logs",
"chat_logs": "Logs",
"chat_logs_tips": "Logs will record the online, shared, and API (requires chatId) conversation records of this app.",
"config_ai_model_params": "Click to configure AI model related properties",
"config_file_upload": "Click to Configure File Upload Rules",
"config_question_guide": "Configuration guess you want to ask",
"confirm_copy_app_tip": "The system will create an app with the same configuration for you, but permissions will not be copied. Please confirm!",
@@ -68,13 +70,15 @@
"interval.per_hour": "Every Hour",
"intro": "A comprehensive model application orchestration system that offers out-of-the-box data processing and model invocation capabilities. It allows for rapid Dataset construction and workflow orchestration through Flow visualization, enabling complex Dataset scenarios!",
"llm_not_support_vision": "This model does not support image recognition",
"llm_use_vision": "Enable Image Recognition",
"llm_use_vision": "Vision",
"llm_use_vision_tip": "After clicking on the model selection, you can see whether the model supports image recognition and the ability to control whether to start image recognition. \nAfter starting image recognition, the model will read the image content in the file link, and if the user question is less than 500 words, it will automatically parse the image in the user question.",
"logs_chat_user": "user",
"logs_empty": "No logs yet~",
"logs_message_total": "Total Messages",
"logs_title": "Title",
"look_ai_point_price": "View all model billing standards",
"mark_count": "Number of Marked Answers",
"max_histories_number": "Max histories",
"module.Custom Title Tip": "This title will be displayed during the conversation.",
"module.No Modules": "No Plugins Found",
"module.type": "\"{{type}}\" type\n{{description}}",
@@ -96,13 +100,15 @@
"plugin_cost_per_times": "{{cost}} points/time",
"plugin_dispatch": "Plugin Invocation",
"plugin_dispatch_tip": "Adds extra capabilities to the model. The specific plugins to be invoked will be autonomously decided by the model.\nIf a plugin is selected, the Dataset invocation will automatically be treated as a special plugin.",
"publish_channel": "Publish Channel",
"publish_channel": "Publish",
"publish_success": "Publish Successful",
"question_guide_tip": "After the conversation, 3 guiding questions will be generated for you.",
"saved_success": "Save Successful",
"search_app": "Search Application",
"setting_app": "Application Settings",
"setting_plugin": "Plugin Settings",
"setting_app": "Workflow",
"setting_plugin": "Workflow",
"stream_response": "Stream",
"stream_response_tip": "Turning this switch off forces the model to use non-streaming mode and will not output content directly. \nIn the output of the AI reply, the content output by this model can be obtained for secondary processing.",
"template.hard_strict": "Strict Q&A template",
"template.hard_strict_des": "Based on the question and answer template, stricter requirements are imposed on the model's answers.",
"template.qa_template": "Q&A template",
@@ -164,7 +170,7 @@
"workflow.form_input_description_placeholder": "For example: \nAdd your information",
"workflow.form_input_tip": " This module can configure multiple inputs to guide users in entering specific content.",
"workflow.input_description_tip": "You can add a description to explain to users what they need to input",
"workflow.read_files": "Document Parsing",
"workflow.read_files": "Document Parse",
"workflow.read_files_result": "Document Parsing Result",
"workflow.read_files_result_desc": "Original document text, consisting of file names and document content, separated by hyphens between multiple files.",
"workflow.read_files_tip": "Parse the documents uploaded in this round of dialogue and return the corresponding document content",
@@ -175,6 +181,6 @@
"workflow.template.communication": "Communication",
"workflow.user_file_input": "File Link",
"workflow.user_file_input_desc": "Links to documents and images uploaded by users.",
"workflow.user_select": "User Selection",
"workflow.user_select": "User Select",
"workflow.user_select_tip": "This module can configure multiple options for selection during the dialogue. Different options can lead to different workflow branches."
}

View File

@@ -261,17 +261,14 @@
"contribute_app_template": "Contribute Template",
"core.Chat": "Chat",
"core.Max Token": "Max Token",
"core.ai.AI settings": "AI Settings",
"core.ai.Ai point price": "AI Points Consumption",
"core.ai.Max context": "Max Context",
"core.ai.Model": "AI Model",
"core.ai.Model": "Model",
"core.ai.Not deploy rerank model": "Re-rank Model Not Deployed",
"core.ai.Prompt": "Prompt",
"core.ai.Support tool": "Function Call",
"core.ai.model.Dataset Agent Model": "File read model",
"core.ai.model.Vector Model": "Index model",
"core.ai.model.doc_index_and_dialog": "Document Index & Dialog Index",
"core.app.Ai response": "AI Response",
"core.app.Api request": "API Request",
"core.app.Api request desc": "Integrate into existing systems through API, or WeChat Work, Feishu, etc.",
"core.app.App intro": "App Introduction",
@@ -284,8 +281,7 @@
"core.app.Interval timer run": "Scheduled Execution",
"core.app.Interval timer tip": "Can Execute App on Schedule",
"core.app.Make a brief introduction of your app": "Give Your AI App an Introduction",
"core.app.Max histories": "Number of Chat Histories",
"core.app.Max tokens": "Response Limit",
"core.app.Max tokens": "Max response",
"core.app.Name and avatar": "Avatar & Name",
"core.app.Publish": "Publish",
"core.app.Publish Confirm": "Confirm to Publish App? This Will Immediately Update the App Status on All Publishing Channels.",
@@ -906,6 +902,16 @@
"item_name": "Field Name",
"just_now": "just",
"key_repetition": "Key Repetition",
"model_baichuan": "Baichuan",
"model_chatglm": "ChatGLM",
"model_doubao": "Doubao",
"model_ernie": "Ernie",
"model_hunyuan": "Hunyuan",
"model_moonshot": "Moonshot",
"model_other": "Other",
"model_qwen": "Qwen",
"model_sparkdesk": "SprkDesk",
"model_yi": "Yi",
"move.confirm": "Confirm move",
"navbar.Account": "Account",
"navbar.Chat": "Chat",
@@ -922,7 +928,7 @@
"pay.package_tip.buy": "The package you purchased is lower than the current package. This package will take effect after the current package expires.\nYou can view the package usage in Account - Personal Information - Package Details.",
"pay.package_tip.renewal": "You are renewing the package. You can view the package usage in Account - Personal Information - Package Details.",
"pay.package_tip.upgrade": "The package you purchased is higher than the current package. This package will take effect immediately, and the current package will take effect later. You can view the package usage in Account - Personal Information - Package Details.",
"pay.wechat": "Please Scan the QR Code with WeChat to Pay: {{price}} Yuan\nPlease Do Not Close the Page",
"pay.wechat": "Please scan the QR code on WeChat to pay: {{price}} yuan\n\nPlease do not close the page before payment is completed",
"pay.yuan": "{{amount}} Yuan",
"permission.Collaborator": "Collaborator",
"permission.Default permission": "Default Permission",

View File

@@ -18,13 +18,13 @@
"classification_result": "Classification Result",
"code.Reset template": "Reset Template",
"code.Reset template confirm": "Confirm reset code template? This will reset all inputs and outputs to template values. Please save your current code.",
"code_execution": "Code Execution",
"code_execution": "Code Sandbox",
"collection_metadata_filter": "Collection Metadata Filter",
"complete_extraction_result": "Complete Extraction Result",
"complete_extraction_result_description": "A JSON string, e.g., {\"name\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",
"concatenation_result": "Concatenation Result",
"concatenation_text": "Concatenation Text",
"condition_checker": "Condition Checker",
"condition_checker": "Condition",
"confirm_delete_field_tip": "Confirm delete this field?",
"contains": "Contains",
"content_to_retrieve": "Content to Retrieve",
@@ -69,7 +69,7 @@
"http_extract_output": "Output field extraction",
"http_extract_output_description": "Specified fields in the response value can be extracted through JSONPath syntax",
"http_raw_response_description": "Raw HTTP response. Only accepts string or JSON type response data.",
"http_request": "HTTP Request",
"http_request": "HTTP",
"http_request_error_info": "HTTP request error information, returns empty on success",
"ifelse.Input value": "Input Value",
"ifelse.Select value": "Select Value",
@@ -96,7 +96,7 @@
"is_tool_output_label": "as tool response",
"judgment_result": "Judgment Result",
"knowledge_base_reference": "Dataset Reference",
"knowledge_base_search_merge": "Dataset Search Merge",
"knowledge_base_search_merge": "Dataset Merge",
"laf_function_call_test": "Laf Function Call (Test)",
"length_equal_to": "Length Equal To",
"length_greater_than": "Length Greater Than",
@@ -106,7 +106,7 @@
"length_not_equal_to": "Length Not Equal To",
"less_than": "Less Than",
"less_than_or_equal_to": "Less Than or Equal To",
"loop": "Batch execution",
"loop": "Batch Run",
"loop_body": "loop body",
"loop_end": "end of loop",
"loop_input_array": "array",
@@ -128,8 +128,8 @@
"plugin_file_abandon_tip": "Plugin global file upload has been deprecated, please adjust it as soon as possible. \nRelated functions can be achieved through plug-in input and adding image type input.",
"plugin_input": "Plugin Input",
"plugin_output_tool": "When the plug-in is executed as a tool, whether this field responds as a result of the tool",
"question_classification": "Question Classification",
"question_optimization": "Question Optimization",
"question_classification": "Classify",
"question_optimization": "Query extension",
"quote_content_placeholder": "The structure of the reference content can be customized to better suit different scenarios. \nSome variables can be used for template configuration\n\n{{q}} - main content\n\n{{a}} - auxiliary data\n\n{{source}} - source name\n\n{{sourceId}} - source ID\n\n{{index}} - nth reference",
"quote_content_tip": "The structure of the reference content can be customized to better suit different scenarios. Some variables can be used for template configuration:\n\n{{q}} - main content\n{{a}} - auxiliary data\n{{source}} - source name\n{{sourceId}} - source ID\n{{index}} - nth reference\nThey are all optional and the following are the default values:\n\n{{default}}",
"quote_num": "Dataset",
@@ -159,16 +159,16 @@
"template.forbid_stream_desc": "Forces the output mode of nested application streams to be disabled",
"template.plugin_output": "Plugin output",
"template.plugin_start": "Plugin start",
"template.system_config": "System Configuration",
"template.system_config": "System",
"template.tool_call": "Tool Call",
"template.tool_call_intro": "Automatically select one or more functional blocks for calling through the AI model, or call plugins.",
"template.workflow_start": "Workflow Start",
"text_concatenation": "Text Concatenation",
"text_content_extraction": "Text Content Extraction",
"template.workflow_start": "Start",
"text_concatenation": "Text Editor",
"text_content_extraction": "Text Extract",
"text_to_extract": "Text to Extract",
"these_variables_will_be_input_parameters_for_code_execution": "These variables will be input parameters for code execution",
"tool_call_termination": "Tool Call Termination",
"tool_custom_field": "Custom tool parameters",
"tool_call_termination": "Stop ToolCall",
"tool_custom_field": "Custom Tool",
"tool_field": " Tool Field Parameter Configuration",
"tool_input": "Tool Input",
"tool_params.enum_placeholder": "apple \npeach \nwatermelon",

View File

@@ -77,7 +77,7 @@
"usage_balance_notice": "由于系统升级,原“自动续费从余额扣款”模式取消,余额充值入口关闭。您的余额可用于购买积分",
"user_account": "账号",
"user_team_team_name": "团队名",
"verification_code_required": "验证码不能为空",
"verification_code": "验证码",
"you_can_convert": "您可以兑换",
"yuan": "元"
}

View File

@@ -3,6 +3,7 @@
"Run": "运行",
"Team Tags Set": "团队标签",
"Team_Tags": "团队标签",
"ai_point_price": "AI积分计费",
"ai_settings": "AI 配置",
"all_apps": "全部应用",
"app.Version name": "版本名称",
@@ -21,6 +22,7 @@
"chat_debug": "调试预览",
"chat_logs": "对话日志",
"chat_logs_tips": "日志会记录该应用的在线、分享和 API需填写 chatId对话记录",
"config_ai_model_params": "点击配置 AI 模型相关属性",
"config_file_upload": "点击配置文件上传规则",
"config_question_guide": "配置猜你想问",
"confirm_copy_app_tip": "系统将为您创建一个相同配置应用,但权限不会进行复制,请确认!",
@@ -74,7 +76,9 @@
"logs_empty": "还没有日志噢~",
"logs_message_total": "消息总数",
"logs_title": "标题",
"look_ai_point_price": "查看所有模型计费标准",
"mark_count": "标注答案数量",
"max_histories_number": "最大对话轮数",
"module.Custom Title Tip": "该标题名字会展示在对话过程中",
"module.No Modules": "没找到插件",
"module.type": "\"{{type}}\"类型\n{{description}}",
@@ -103,6 +107,8 @@
"search_app": "搜索应用",
"setting_app": "应用配置",
"setting_plugin": "插件配置",
"stream_response": "流输出",
"stream_response_tip": "关闭该开关,可以强制模型使用非流模式,并且不会直接进行内容输出。可以在 AI 回复的输出中,获取本次模型输出的内容进行二次处理。",
"template.hard_strict": "严格问答模板",
"template.hard_strict_des": "在问答模板基础上,对模型的回答做更严格的要求。",
"template.qa_template": "问答模板",

View File

@@ -260,8 +260,6 @@
"contribute_app_template": "贡献模板",
"core.Chat": "对话",
"core.Max Token": "单条数据上限",
"core.ai.AI settings": "AI 配置",
"core.ai.Ai point price": "AI 积分消耗",
"core.ai.Max context": "最大上下文",
"core.ai.Model": "AI 模型",
"core.ai.Not deploy rerank model": "未部署重排模型",
@@ -270,7 +268,6 @@
"core.ai.model.Dataset Agent Model": "文本理解模型",
"core.ai.model.Vector Model": "索引模型",
"core.ai.model.doc_index_and_dialog": "文档索引 & 对话索引",
"core.app.Ai response": "返回 AI 内容",
"core.app.Api request": "API 访问",
"core.app.Api request desc": "通过 API 接入到已有系统中,或企微、飞书等",
"core.app.App intro": "应用介绍",
@@ -283,7 +280,6 @@
"core.app.Interval timer run": "定时执行",
"core.app.Interval timer tip": "可定时执行应用",
"core.app.Make a brief introduction of your app": "给你的 AI 应用一个介绍",
"core.app.Max histories": "聊天记录数量",
"core.app.Max tokens": "回复上限",
"core.app.Name and avatar": "头像 & 名称",
"core.app.Publish": "发布",
@@ -905,6 +901,16 @@
"item_name": "字段名",
"just_now": "刚刚",
"key_repetition": "key 重复",
"model_baichuan": "百川智能",
"model_chatglm": "ChatGLM",
"model_doubao": "豆包",
"model_ernie": "文心一言",
"model_hunyuan": "腾讯混元",
"model_moonshot": "月之暗面",
"model_other": "自定义",
"model_qwen": "阿里千问",
"model_sparkdesk": "讯飞星火",
"model_yi": "零一万物",
"move.confirm": "确认移动",
"navbar.Account": "账号",
"navbar.Chat": "聊天",
@@ -921,7 +927,7 @@
"pay.package_tip.buy": "您购买的套餐等级低于当前套餐,该套餐将在当前套餐过期后生效。\n您可在账号—个人信息—套餐详情里查看套餐使用情况。",
"pay.package_tip.renewal": "您正在续费套餐。您可在账号—个人信息—套餐详情里,查看套餐使用情况。",
"pay.package_tip.upgrade": "您购买的套餐等级高于当前套餐,该套餐将即刻生效,当前套餐将延后生效。您可在账号—个人信息—套餐详情里,查看套餐使用情况。",
"pay.wechat": "请微信扫码支付: {{price}}元\n请勿关闭页面",
"pay.wechat": "请微信扫码支付: {{price}}元\n支付完成前,请勿关闭页面",
"pay.yuan": "{{amount}}元",
"permission.Collaborator": "协作者",
"permission.Default permission": "默认权限",

View File

@@ -77,7 +77,7 @@
"usage_balance_notice": "由於系統升級,原「自動續費從餘額扣款」模式取消,餘額儲值入口關閉。\n您的餘額可用於購買積分",
"user_account": "帳號",
"user_team_team_name": "團隊名",
"verification_code_required": "驗證碼不能為空",
"verification_code": "驗證碼",
"you_can_convert": "您可以兌換",
"yuan": "元"
}

View File

@@ -3,6 +3,7 @@
"Run": "執行",
"Team Tags Set": "團隊標籤",
"Team_Tags": "團隊標籤",
"ai_point_price": "AI積分計費",
"ai_settings": "AI 設定",
"all_apps": "所有應用程式",
"app.Version name": "版本名稱",
@@ -21,6 +22,7 @@
"chat_debug": "聊天預覽",
"chat_logs": "對話紀錄",
"chat_logs_tips": "紀錄會記錄此應用程式的線上、分享和 API需填寫 chatId對話紀錄",
"config_ai_model_params": "點選配置 AI 模型相關屬性",
"config_file_upload": "點選設定檔案上傳規則",
"config_question_guide": "配置猜你想問",
"confirm_copy_app_tip": "系統將為您建立一個相同設定的應用程式,但權限不會複製,請確認!",
@@ -74,7 +76,9 @@
"logs_empty": "還沒有紀錄喔~",
"logs_message_total": "訊息總數",
"logs_title": "標題",
"look_ai_point_price": "查看所有模型計費標準",
"mark_count": "標記答案數量",
"max_histories_number": "最大對話輪數",
"module.Custom Title Tip": "這個標題會顯示在對話過程中",
"module.No Modules": "找不到外掛",
"module.type": "\"{{type}}\" 類型\n{{description}}",
@@ -103,6 +107,8 @@
"search_app": "搜尋應用程式",
"setting_app": "應用程式設定",
"setting_plugin": "外掛設定",
"stream_response": "流輸出",
"stream_response_tip": "關閉該開關​​,可以強制模型使用非流模式,並且不會直接進行內容輸出。\n可在 AI 回覆的輸出中,取得本次模型輸出的內容進行二次處理。",
"template.hard_strict": "嚴格問答範本",
"template.hard_strict_des": "在問答範本基礎上,對模型的回答做出更嚴格的要求。",
"template.qa_template": "問答範本",

View File

@@ -261,8 +261,6 @@
"contribute_app_template": "貢獻範本",
"core.Chat": "對話",
"core.Max Token": "單筆資料上限",
"core.ai.AI settings": "AI 設定",
"core.ai.Ai point price": "AI 點數消耗",
"core.ai.Max context": "最大上下文",
"core.ai.Model": "AI 模型",
"core.ai.Not deploy rerank model": "未部署重新排名模型",
@@ -271,7 +269,6 @@
"core.ai.model.Dataset Agent Model": "檔案處理模型",
"core.ai.model.Vector Model": "索引模型",
"core.ai.model.doc_index_and_dialog": "文件索引與對話索引",
"core.app.Ai response": "AI 回應",
"core.app.Api request": "API 存取",
"core.app.Api request desc": "透過 API 整合到現有系統中,或整合到企業微信、飛書等",
"core.app.App intro": "應用程式介紹",
@@ -284,7 +281,6 @@
"core.app.Interval timer run": "排程執行",
"core.app.Interval timer tip": "可排程執行應用程式",
"core.app.Make a brief introduction of your app": "為您的 AI 應用程式寫一段介紹",
"core.app.Max histories": "聊天記錄數量",
"core.app.Max tokens": "回應上限",
"core.app.Name and avatar": "頭像與名稱",
"core.app.Publish": "發布",
@@ -907,6 +903,16 @@
"item_name": "欄位名稱",
"just_now": "剛剛",
"key_repetition": "鍵值重複",
"model_baichuan": "百川智能",
"model_chatglm": "ChatGLM",
"model_doubao": "豆包",
"model_ernie": "文心一言",
"model_hunyuan": "騰訊混元",
"model_moonshot": "月之暗面",
"model_other": "自訂",
"model_qwen": "阿里千問",
"model_sparkdesk": "訊飛星火",
"model_yi": "零一萬物",
"move.confirm": "確認移動",
"navbar.Account": "帳戶",
"navbar.Chat": "對話",
@@ -923,7 +929,7 @@
"pay.package_tip.buy": "您購買的方案等級低於目前方案,該方案將在目前方案過期後生效。\n您可在帳戶 - 個人資訊 - 方案詳細資訊中檢視方案使用情況。",
"pay.package_tip.renewal": "您正在續約方案。您可在帳戶 - 個人資訊 - 方案詳細資訊中檢視方案使用情況。",
"pay.package_tip.upgrade": "您購買的方案等級高於目前方案,該方案將立即生效,目前方案將延後生效。您可在帳戶 - 個人資訊 - 方案詳細資訊中檢視方案使用情況。",
"pay.wechat": "請使用微信掃碼支付:{{price}} 元\n請勿關閉頁面",
"pay.wechat": "請微信掃碼付款: {{price}}元\n\n付款完成前請勿關閉頁面",
"pay.yuan": "{{amount}} 元",
"permission.Collaborator": "協作者",
"permission.Default permission": "預設權限",

View File

@@ -11,9 +11,9 @@
},
"llmModels": [
{
"provider": "OpenAI", // 模型提供商主要用于分类展示目前已经内置提供商包括https://github.com/labring/FastGPT/blob/main/packages/global/core/ai/provider.ts, 可 pr 提供新的提供商,或直接填写 Other
"model": "gpt-4o-mini", // 模型名(对应OneAPI中渠道的模型名)
"name": "gpt-4o-mini", // 模型别名
"avatar": "/imgs/model/openai.svg", // 模型的logo
"maxContext": 125000, // 最大上下文
"maxResponse": 16000, // 最大回复
"quoteMaxToken": 120000, // 最大引用内容
@@ -35,9 +35,9 @@
"fieldMap": {} // 字段映射o1 模型需要把 max_tokens 映射为 max_completion_tokens
},
{
"provider": "OpenAI",
"model": "gpt-4o",
"name": "gpt-4o",
"avatar": "/imgs/model/openai.svg",
"maxContext": 125000,
"maxResponse": 4000,
"quoteMaxToken": 120000,
@@ -59,9 +59,9 @@
"fieldMap": {}
},
{
"provider": "OpenAI",
"model": "o1-mini",
"name": "o1-mini",
"avatar": "/imgs/model/openai.svg",
"maxContext": 125000,
"maxResponse": 65000,
"quoteMaxToken": 120000,
@@ -84,9 +84,9 @@
}
},
{
"provider": "OpenAI",
"model": "o1-preview",
"name": "o1-preview",
"avatar": "/imgs/model/openai.svg",
"maxContext": 125000,
"maxResponse": 32000,
"quoteMaxToken": 120000,
@@ -111,21 +111,18 @@
],
"vectorModels": [
{
"model": "text-embedding-ada-002", // 模型名与OneAPI对应
"name": "Embedding-2", // 模型展示名
"avatar": "/imgs/model/openai.svg", // logo
"charsPointsPrice": 0, // n积分/1k token
"defaultToken": 700, // 默认文本分割时候的 token
"maxToken": 3000, // 最大 token
"weight": 100, // 优先训练权重
"defaultConfig": {}, // 自定义额外参数。例如,如果希望使用 embedding3-large 的话,可以传入 dimensions:1024来返回1024维度的向量。目前必须小于1536维度
"dbConfig": {}, // 存储时的额外参数(非对称向量模型时候需要用到)
"queryConfig": {} // 参训时的额外参数
"provider": "OpenAI",
"model": "text-embedding-3-small",
"name": "text-embedding-3-small",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
"weight": 100
},
{
"provider": "OpenAI",
"model": "text-embedding-3-large",
"name": "text-embedding-3-large",
"avatar": "/imgs/model/openai.svg",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
@@ -135,13 +132,16 @@
}
},
{
"model": "text-embedding-3-small",
"name": "text-embedding-3-small",
"avatar": "/imgs/model/openai.svg",
"charsPointsPrice": 0,
"defaultToken": 512,
"maxToken": 3000,
"weight": 100
"provider": "OpenAI",
"model": "text-embedding-ada-002", // 模型名与OneAPI对应
"name": "Embedding-2", // 模型展示名
"charsPointsPrice": 0, // n积分/1k token
"defaultToken": 700, // 默认文本分割时候的 token
"maxToken": 3000, // 最大 token
"weight": 100, // 优先训练权重
"defaultConfig": {}, // 自定义额外参数。例如,如果希望使用 embedding3-large 的话,可以传入 dimensions:1024来返回1024维度的向量。目前必须小于1536维度
"dbConfig": {}, // 存储时的额外参数(非对称向量模型时候需要用到)
"queryConfig": {} // 参训时的额外参数
}
],
"reRankModels": [],

View File

@@ -1,6 +1,6 @@
{
"name": "app",
"version": "4.8.15",
"version": "4.8.16",
"private": false,
"scripts": {
"dev": "next dev",

View File

@@ -1,23 +1,21 @@
### FastGPT V4.8.14 更新说明
### FastGPT V4.8.16 更新说明
1. 新增 - 工作流支持进入聊天框/点击开始对话后,自动触发一轮对话。
2. 新增 - 重写 chatContext对话测试也会有日志并且刷新后不会丢失对话
3. 新增 - 分享链接支持配置是否允许查看原文
4. 新增 - 新的 doc2x 插件。
5. 新增 - 繁体中文-台湾。
6. 新增 - 分析链接和 chat api 支持传入自定义 uid。
7. 新增 - 微软 oauth 登录
8. 优化 - 工作流 ui 细节
9. 优化 - 应用编辑记录采用 diff 存储,避免浏览器溢出
10. 优化 - 代码入口,增加 register 入口,无需等待首次访问才执行
11. 优化 - 工作流检查,增加更多缺失值检查
12. 优化 - 增加知识库训练最大重试次数限制
13. 优化 - 图片路径问题和示意图任务
14. 优化 - Milvus description
15. 修复 - 分块策略,四级标题会被丢失。 同时新增了五级标题的支持
16. 修复 - MongoDB 知识库集合唯一索引
17. 修复 - 反选知识库引用后可能会报错
18. 修复 - 简易模式转工作流,不是使用最新编辑记录进行转移。
19. 修复 - 表单输入的说明文字不显示。
1. 新增 - SearXNG 搜索插件[点击查看教程](https://doc.fastgpt.cn//docs/guide/plugins/searxng_plugin_guide/)
2. 新增 - 商业版支持 API 知识库和链接集合定时同步
3. 新增 - 猜你想问支持选择模型和自定义提示词
4. 新增 - 钉钉和企微机器人 webhook 插件。
5. 新增 - 商业版支持钉钉 SSO 登录配置。[点击查看教程](https://doc.fastgpt.cn//docs/guide/admin/sso_dingtalk/)
6. 新增 - 商业版支持飞书和语雀知识库导入。[点击查看教程](https://doc.fastgpt.cn//docs/guide/knowledge_base/lark_dataset/)
7. 新增 - sandbox 新增 createHmac 加密全局方法。
8. 新增 - 工作流右键支持全部折叠
9. 优化 - 工作流/简易模式变量初始化代码,去除监听初始化,避免因渲染顺序不一致导致的失败
10. 优化 - 工作流获取数据类型不一致数据时,增加类型转化,避免 undefined
11. 修复 - 无法自动切换默认语言。增加分享链接,强制执行一次切换默认语言
12. 修复 - 数组选择器自动兼容 4.8.13 以前的数据
13. 修复 - 站点同步知识库,链接同步时未使用选择器。
14. 修复 - 简易模式转工作流,没有把系统配置项转化。
15. 修复 - 插件独立运行,变量初始值未赋上
16. 修复 - 工作流使用弹窗组件时,关闭弹窗后,有时候会出现页面偏移
17. 修复 - 插件调试时,日志未保存插件输入参数

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,27 +0,0 @@
<svg t="1710841166479" class="icon" viewBox="0 0 1040 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1089"
width="128" height="128">
<path
d="M373.508197 8.393443L411.278689 16.786885l37.770491 50.360656 12.590164-4.196721q-19.304918 10.911475 4.196722 20.983606l12.590164-4.196721-4.196722 12.590164q21.822951-5.87541 12.590164 16.786885h16.786885v12.590164l67.147541 109.114754-4.196721 12.590164 12.590164 4.196721-4.196721 12.590164 12.590164 4.196722-193.049181 4.196721 58.754099-104.918033v-25.180328L390.295082 33.57377q-18.465574-5.87541-12.590164 12.590164L251.803279 268.590164H104.918033l-4.196722 12.590164 276.983607 461.639344-130.098361 4.196721-20.983606 20.983607-58.754099 100.721311 117.508197 8.393443-54.557377 20.983607q-79.737705 16.786885-96.52459-29.37705l-58.754098-100.721311v-25.180328l58.754098-109.114754-134.295082-235.016393 67.147541-125.90164 29.377049-29.377049h134.295082l12.590164-12.590164L373.508197 8.393443z"
fill="#4644B0" opacity=".992" p-id="1090"></path>
<path
d="M365.114754 419.672131h235.016394l4.196721 12.590164-8.393443 25.180328q3.357377 95.685246-33.57377 151.081967l4.196721 12.590164q-18.465574-5.87541-12.590164 12.590164v16.786885L516.196721 688.262295 386.098361 474.229508 365.114754 419.672131z"
fill="#4644B0" opacity=".992" p-id="1091"></path>
<path
d="M919.081967 176.262295l8.393443 16.786885-8.393443-16.786885zM944.262295 318.95082l-8.393443 16.786885 8.393443-16.786885zM910.688525 327.344262l-8.393443 16.786886 8.393443-16.786886zM902.295082 386.098361l12.590164 20.983606-16.786885-8.393442 4.196721-12.590164zM927.47541 486.819672l8.393442 16.786885-8.393442-16.786885zM961.04918 495.213115l8.393443 16.786885-8.393443-16.786885zM961.04918 545.57377l8.393443 16.786886-8.393443-16.786886zM1036.590164 621.114754l4.196721 20.983607h-8.393442l4.196721-20.983607zM809.967213 805.770492l-8.393443 16.786885 8.393443-16.786885zM146.885246 881.311475l8.393443 16.786886-8.393443-16.786886zM751.213115 906.491803l-8.393443 16.786886 8.393443-16.786886zM717.639344 965.245902l-8.393442 16.786885 8.393442-16.786885zM516.196721 982.032787l8.393443 16.786885-8.393443-16.786885zM642.098361 1015.606557l37.770491 4.196722-37.770491 4.196721v-8.393443z"
fill="#6C6CEF" opacity=".843" p-id="1092"></path>
<path
d="M373.508197 0l-8.393443 16.786885 8.393443-16.786885zM239.213115 226.622951l-8.393443 16.786885 8.393443-16.786885zM88.131148 243.409836l-16.786886 25.180328 16.786886-25.180328zM100.721311 268.590164l142.688525 4.196721-134.295082 8.393443 4.196721 12.590164-12.590164-25.180328zM46.163934 310.557377l-8.393442 16.786885 8.393442-16.786885zM130.098361 318.95082l8.393442 16.786885-8.393442-16.786885zM12.590164 369.311475L8.393443 381.901639 4.196721 394.491803 0 381.901639 12.590164 369.311475zM163.672131 377.704918l8.393443 16.786885-8.393443-16.786885zM4.196721 402.885246L16.786885 423.868852l-16.786885-8.393442L4.196721 402.885246zM188.852459 419.672131l8.393443 16.786885-8.393443-16.786885zM37.770492 470.032787l8.393442 16.786885-8.393442-16.786885zM222.42623 478.42623l8.393442 16.786885-8.393442-16.786885zM62.95082 512l8.393442 16.786885-8.393442-16.786885zM96.52459 570.754098l8.393443 16.786886-8.393443-16.786886zM247.606557 747.016393l130.098361 4.196722-130.098361 4.196721v-8.393443z"
fill="#413FA6" opacity=".588" p-id="1093"></path>
<path
d="M348.327869 33.57377l-8.393443 16.786886 8.393443-16.786886zM390.295082 33.57377l-16.786885 25.180328 16.786885-25.180328zM323.147541 75.540984l-8.393443 16.786885 8.393443-16.786885zM348.327869 100.721311l-8.393443 16.786886 8.393443-16.786886zM440.655738 125.901639l8.393442 16.786886-8.393442-16.786886zM289.57377 134.295082l-8.393442 16.786885 8.393442-16.786885zM314.754098 159.47541l-8.393442 16.786885 8.393442-16.786885zM432.262295 184.655738l-8.393443 16.786885 8.393443-16.786885zM289.57377 201.442623l-8.393442 16.786885 8.393442-16.786885zM104.918033 235.016393l121.704918 4.196722-121.704918 4.196721v-8.393443zM256 260.196721l-8.393443 16.786886 8.393443-16.786886zM390.295082 268.590164l222.426229 4.196721-222.426229 4.196722v-8.393443zM352.52459 411.278689l201.442623 4.196721-188.852459 4.196721-8.393443 8.393443-4.196721-16.786885zM650.491803 486.819672l-8.393442 16.786885 8.393442-16.786885zM407.081967 512l8.393443 16.786885-8.393443-16.786885zM289.57377 587.540984l8.393443 16.786885-8.393443-16.786885zM591.737705 587.540984l-8.393443 16.786885 8.393443-16.786885zM465.836066 612.721311l8.393442 16.786886-8.393442-16.786886zM323.147541 646.295082l8.393443 16.786885-8.393443-16.786885zM558.163934 646.295082l-8.393442 16.786885 8.393442-16.786885zM88.131148 713.442623l-8.393443 16.786885 8.393443-16.786885zM71.344262 738.622951l4.196722 29.377049H67.147541l4.196721-29.377049zM205.639344 814.163934l-8.393442 16.786886 8.393442-16.786886zM104.918033 822.557377l8.393442 16.786885-8.393442-16.786885zM180.459016 864.52459l264.393443 4.196721-264.393443 4.196722v-8.393443z"
fill="#4847B2" opacity=".176" p-id="1094"></path>
<path
d="M365.114754 0L360.918033 12.590164 348.327869 33.57377l4.196721-12.590163L365.114754 0zM541.377049 0l8.393443 16.786885-8.393443-16.786885zM558.163934 25.180328l8.393443 16.786885-8.393443-16.786885zM390.295082 41.967213l8.393443 16.786885-8.393443-16.786885zM583.344262 67.147541l12.590164 20.983607h-8.393442L583.344262 67.147541zM415.47541 83.934426l8.393442 16.786885-8.393442-16.786885zM608.52459 109.114754h268.590164l29.377049 29.377049-29.377049-20.983606h-268.590164v-8.393443zM910.688525 151.081967l20.983606 29.377049-16.786885-8.393442-4.196721-20.983607zM944.262295 209.836066l20.983607 29.377049-16.786886-8.393443-4.196721-20.983606zM616.918033 268.590164h318.950819l4.196722 12.590164-16.786885 8.393442-4.196722-12.590163h-302.163934v-8.393443zM969.442623 276.983607l4.196721 12.590163-16.786885 8.393443 12.590164-20.983606zM919.081967 302.163934l-4.196721 12.590164-12.590164 20.983607 4.196721-12.590164 12.590164-20.983607zM944.262295 327.344262l-4.196721 12.590164-12.590164 20.983607 4.196721-12.590164 12.590164-20.983607zM885.508197 360.918033l-4.196722 12.590164-8.393442 25.180328 16.786885 25.180327-16.786885-8.393442-8.393443-25.180328 20.983607-29.377049zM919.081967 369.311475l-4.196721 12.590164-4.196721 20.983607-4.196722-20.983607 12.590164-12.590164zM558.163934 411.278689l130.098361 4.196721-130.098361 4.196721v-8.393442zM927.47541 428.065574l20.983606 29.377049-16.786885-8.393443-4.196721-20.983606zM893.901639 436.459016l29.37705 46.163935-25.180328-16.786885-4.196722-29.37705zM952.655738 470.032787l20.983606 29.377049-16.786885-8.393443-4.196721-20.983606zM927.47541 495.213115l20.983606 29.377049-16.786885-8.393443-4.196721-20.983606zM642.098361 503.606557l-8.393443 16.786886 8.393443-16.786886zM788.983607 512l33.57377 20.983607 8.393443 16.786885-16.786886-8.393443-12.590164-20.983606-25.180327 33.57377 4.196721-12.590164 8.393443-29.377049zM986.229508 528.786885l20.983607 29.377049-16.786885-8.393442-4.196722-20.983607zM616.918033 545.57377l-8.393443 16.786886 8.393443-16.786886zM961.04918 553.967213l20.983607 29.377049-16.786885-8.393442-4.196722-20.983607zM768 562.360656l-4.196721 12.590164-4.196722 12.590164-4.196721-12.590164 12.590164-12.590164zM843.540984 579.147541l20.983606 29.377049-16.786885-8.393442-4.196721-20.983607zM1019.803279 587.540984l20.983606 29.377049-16.786885-8.393443-4.196721-20.983606zM986.229508 595.934426l20.983607 41.967213h-130.098361l-12.590164-12.590164 12.590164 4.196722 121.704918-4.196722-12.590164-29.377049zM734.42623 621.114754l-4.196722 12.590164-12.590164 20.983607 4.196722-12.590164 12.590164-20.983607zM1036.590164 646.295082l4.196721 12.590164-20.983606 29.377049 4.196721-12.590164 12.590164-29.377049zM549.770492 663.081967l-8.393443 16.786885 8.393443-16.786885zM700.852459 679.868852l-4.196721 12.590164-12.590164 20.983607-4.196722-12.590164 20.983607-20.983607zM1011.409836 696.655738l-4.196721 12.590164-20.983607 37.770491 4.196722-12.590163 20.983606-37.770492zM675.672131 721.836066l-4.196721 12.590164-4.196721 12.590163-4.196722-12.590163 12.590164-12.590164zM977.836066 755.409836l-25.180328 33.573771-130.098361-4.196722 130.098361-4.196721 25.180328-25.180328zM642.098361 780.590164l-4.196722 12.590164-12.590164 20.983606 4.196722-12.590164 12.590164-20.983606zM809.967213 814.163934l-4.196721 12.590164-12.590164 20.983607 4.196721-12.590164 12.590164-20.983607zM608.52459 839.344262l-4.196721 12.590164-12.590164 20.983607 4.196721-12.590164 12.590164-20.983607zM784.786885 856.131148l-4.196721 12.590163-12.590164 20.983607 4.196721-12.590164 12.590164-20.983606zM449.04918 864.52459l8.393443 16.786885-8.393443-16.786885zM583.344262 881.311475l-4.196721 12.590164-4.196721 12.590164-4.196722-12.590164 12.590164-12.590164zM146.885246 889.704918l20.983606 12.590164-12.590163 4.196721-8.393443-16.786885zM465.836066 889.704918l20.983606 29.377049-16.786885-8.393442-4.196721-20.983607zM180.459016 898.098361l256 4.196721-256 4.196721v-8.393442zM440.655738 914.885246l20.983606 29.377049-16.786885-8.393443-4.196721-20.983606zM751.213115 914.885246l-4.196722 12.590164-12.590163 20.983606 4.196721-12.590164 12.590164-20.983606zM549.770492 940.065574l-4.196722 12.590164-12.590163 20.983606 4.196721-12.590164 12.590164-20.983606zM499.409836 948.459016l29.377049 37.770492-25.180328-16.786885-4.196721-20.983607zM717.639344 973.639344l-4.196721 12.590164-12.590164 20.983607 4.196721-12.590164 12.590164-20.983607zM482.622951 982.032787l12.590164 20.983606-16.786885-8.393442 4.196721-12.590164z"
fill="#6F6FEA" opacity=".227" p-id="1095"></path>
<path
d="M386.098361 0h138.491803L545.57377 8.393443l62.95082 109.114754h260.196721l29.37705 20.983606 67.147541 117.508197v25.180328l-67.147541 117.508197 134.295082 218.229508v33.57377L952.655738 780.590164h-125.90164L814.163934 793.180328 684.065574 1015.606557l-159.47541 8.393443-29.377049-20.983607-62.95082-104.918032-180.459016-4.196722 37.770491-20.983606h159.47541l4.196722 12.590164 71.344262 113.311475 276.983606-478.426229 62.95082 117.508196 151.081967-4.196721-142.688524-243.409836q47.842623-51.2 67.147541-121.704918H591.737705L570.754098 256l4.196722-12.590164-12.590164-4.196721v-16.786885L503.606557 109.114754h-16.786885q9.232787-22.662295-12.590164-16.786885L411.278689 16.786885q-34.413115 10.911475-25.180328-16.786885z"
fill="#6867ED" opacity=".996" p-id="1096"></path>
<path
d="M604.327869 419.672131h71.344262l4.196721 12.590164L566.557377 612.721311l4.196721-12.590163 33.573771-151.081968V419.672131zM558.163934 621.114754l4.196722 12.590164-16.786886 8.393443 12.590164-20.983607zM532.983607 671.47541l-4.196722 12.590164-4.196721 12.590164-4.196721-12.590164 12.590164-12.590164z"
fill="#6867ED" opacity=".996" p-id="1097"></path>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,14 +1,16 @@
import React, { useCallback, useMemo } from 'react';
import React, { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'next-i18next';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useRouter } from 'next/router';
import MySelect, { SelectProps } from '@fastgpt/web/components/common/MySelect';
import { HUGGING_FACE_ICON, LOGO_ICON } from '@fastgpt/global/common/system/constants';
import { Box, Flex, useDisclosure } from '@chakra-ui/react';
import { Box, Flex, HStack, useDisclosure } from '@chakra-ui/react';
import Avatar from '@fastgpt/web/components/common/Avatar';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import dynamic from 'next/dynamic';
import { ModelProviderList } from '@fastgpt/global/core/ai/provider';
import MultipleRowSelect from '@fastgpt/web/components/common/MySelect/MultipleRowSelect';
import { getModelFromList } from '@fastgpt/global/core/ai/model';
const AiPointsModal = dynamic(() =>
import('@/pages/price/components/Points').then((mod) => mod.AiPointsModal)
@@ -18,10 +20,9 @@ type Props = SelectProps & {
disableTip?: string;
};
const AIModelSelector = ({ list, onchange, disableTip, ...props }: Props) => {
const OneRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
const { t } = useTranslation();
const { feConfigs, llmModelList, vectorModelList } = useSystemStore();
const router = useRouter();
const {
isOpen: isOpenAiPointsModal,
@@ -40,9 +41,7 @@ const AIModelSelector = ({ list, onchange, disableTip, ...props }: Props) => {
}, [props.size]);
const avatarList = list.map((item) => {
const modelData =
llmModelList.find((model) => model.model === item.value) ||
vectorModelList.find((model) => model.model === item.value);
const modelData = getModelFromList([...llmModelList, ...vectorModelList], item.value);
return {
value: item.value,
@@ -55,14 +54,14 @@ const AIModelSelector = ({ list, onchange, disableTip, ...props }: Props) => {
fallbackSrc={HUGGING_FACE_ICON}
w={avatarSize}
/>
<Box>{item.label}</Box>
<Box>{modelData.name}</Box>
</Flex>
)
};
});
const expandList = useMemo(() => {
return feConfigs.show_pay
return feConfigs?.show_pay
? avatarList.concat({
label: (
<Flex alignItems={'center'}>
@@ -108,5 +107,122 @@ const AIModelSelector = ({ list, onchange, disableTip, ...props }: Props) => {
</Box>
);
};
const MultipleRowSelector = ({ list, onchange, disableTip, ...props }: Props) => {
const { t } = useTranslation();
const { feConfigs, llmModelList, vectorModelList } = useSystemStore();
const [value, setValue] = useState<string[]>([]);
const {
isOpen: isOpenAiPointsModal,
onClose: onCloseAiPointsModal,
onOpen: onOpenAiPointsModal
} = useDisclosure();
const avatarSize = useMemo(() => {
const size = {
sm: '1rem',
md: '1.2rem',
lg: '1.4rem'
};
//@ts-ignore
return props.size ? size[props.size] : size['md'];
}, [props.size]);
const selectorList = useMemo(() => {
const renderList = ModelProviderList.map<{
label: React.JSX.Element;
value: string;
children: { label: string | React.ReactNode; value: string }[];
}>((provider) => ({
label: (
<Flex alignItems={'center'} py={1}>
<Avatar
borderRadius={'0'}
mr={2}
src={provider?.avatar || HUGGING_FACE_ICON}
fallbackSrc={HUGGING_FACE_ICON}
w={avatarSize}
/>
<Box>{t(provider.name as any)}</Box>
</Flex>
),
value: provider.id,
children: []
}));
for (const item of list) {
const modelData = getModelFromList([...llmModelList, ...vectorModelList], item.value);
const provider =
renderList.find((item) => item.value === (modelData?.provider || 'Other')) ??
renderList[renderList.length - 1];
provider.children.push({
label: modelData.name,
value: modelData.model
});
}
return renderList.filter((item) => item.children.length > 0);
}, [avatarSize, list, llmModelList, t, vectorModelList]);
const onSelect = useCallback(
(e: string[]) => {
return onchange?.(e[1]);
},
[onchange]
);
const SelectedModel = useMemo(() => {
const modelData = getModelFromList([...llmModelList, ...vectorModelList], props.value);
setValue([modelData.provider, props.value]);
return (
<HStack spacing={1}>
<Avatar
borderRadius={'0'}
mr={2}
src={modelData?.avatar}
fallbackSrc={HUGGING_FACE_ICON}
w={avatarSize}
/>
<Box>{modelData?.name}</Box>
</HStack>
);
}, [avatarSize, llmModelList, props.value, vectorModelList]);
return (
<Box
css={{
span: {
display: 'block'
}
}}
>
<MyTooltip label={disableTip}>
<MultipleRowSelect
label={SelectedModel}
list={selectorList}
onSelect={onSelect}
value={value}
rowMinWidth="160px"
ButtonProps={{
isDisabled: !!disableTip
}}
/>
</MyTooltip>
{isOpenAiPointsModal && <AiPointsModal onClose={onCloseAiPointsModal} />}
</Box>
);
};
const AIModelSelector = (props: Props) => {
return props.list.length > 10 ? (
<MultipleRowSelector {...props} />
) : (
<OneRowSelector {...props} />
);
};
export default AIModelSelector;

View File

@@ -7,10 +7,18 @@ import {
BoxProps,
Button,
Flex,
Link,
HStack,
ModalBody,
ModalFooter,
Switch
Switch,
TableContainer,
Tbody,
Td,
Th,
Thead,
Tr,
Table,
useDisclosure
} from '@chakra-ui/react';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import MySlider from '@/components/Slider';
@@ -21,6 +29,13 @@ import AIModelSelector from '@/components/Select/AIModelSelector';
import { LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
import { getWebLLMModel } from '@/web/common/system/utils';
import MyIcon from '@fastgpt/web/components/common/Icon';
import dynamic from 'next/dynamic';
import InputSlider from '@fastgpt/web/components/common/MySlider/InputSlider';
const AiPointsModal = dynamic(() =>
import('@/pages/price/components/Points').then((mod) => mod.AiPointsModal)
);
const AIChatSettingsModal = ({
onClose,
@@ -35,7 +50,7 @@ const AIChatSettingsModal = ({
}) => {
const { t } = useTranslation();
const [refresh, setRefresh] = useState(false);
const { feConfigs, llmModelList } = useSystemStore();
const { feConfigs } = useSystemStore();
const { handleSubmit, getValues, setValue, watch } = useForm({
defaultValues: defaultData
@@ -69,30 +84,35 @@ const AIChatSettingsModal = ({
alignItems: 'center',
fontSize: 'sm',
color: 'myGray.900',
width: ['6rem', '8rem']
width: '7rem'
};
const {
isOpen: isOpenAiPointsModal,
onClose: onCloseAiPointsModal,
onOpen: onOpenAiPointsModal
} = useDisclosure();
return (
<MyModal
isOpen
iconSrc="/imgs/workflow/AI.png"
onClose={onClose}
title={
<>
{t('common:core.ai.AI settings')}
<HStack>
<Box>{t('app:ai_settings')}</Box>
{feConfigs?.docUrl && (
<Link
href={getDocPath('/docs/guide/course/ai_settings/')}
target={'_blank'}
ml={1}
textDecoration={'underline'}
fontWeight={'normal'}
fontSize={'md'}
>
{t('common:common.Read intro')}
</Link>
<MyIcon
name="book"
color={'primary.600'}
w={'1rem'}
cursor={'pointer'}
onClick={() => {
window.open(getDocPath('/docs/guide/course/ai_settings/'), '_blank');
}}
/>
)}
</>
</HStack>
}
w={'500px'}
>
@@ -113,48 +133,66 @@ const AIChatSettingsModal = ({
/>
</Box>
</Flex>
{feConfigs && (
<Flex mt={6}>
<Box {...LabelStyles} mr={2}>
{t('common:core.ai.Ai point price')}
</Box>
<Box flex={1}>
{t('common:support.wallet.Ai point every thousand tokens', {
points: selectedModel?.charsPointsPrice || 0
})}
</Box>
</Flex>
)}
<Flex mt={6}>
<Box {...LabelStyles} mr={2}>
{t('common:core.ai.Max context')}
</Box>
<Box flex={1}>{selectedModel?.maxContext || 4096}Tokens</Box>
</Flex>
<Flex mt={6}>
<Box {...LabelStyles} mr={2}>
{t('common:core.ai.Support tool')}
<QuestionTip ml={1} label={t('common:core.module.template.AI support tool tip')} />
</Box>
<Box flex={1}>
{selectedModel?.toolChoice || selectedModel?.functionCall
? t('common:common.support')
: t('common:common.not_support')}
</Box>
</Flex>
<Flex mt={6}>
<TableContainer
my={5}
bg={'primary.50'}
borderRadius={'lg'}
borderWidth={'1px'}
borderColor={'primary.1'}
>
<Table fontSize={'xs'} overflow={'overlay'}>
<Thead>
<Tr bg={'transparent !important'} color={'myGray.600'}>
<Th fontSize={'mini'} pb={2}>
<HStack spacing={1}>
<Box> {t('app:ai_point_price')}</Box>
<QuestionTip
label={t('app:look_ai_point_price')}
onClick={onOpenAiPointsModal}
/>
</HStack>
</Th>
<Th fontSize={'mini'} pb={2}>
{t('common:core.ai.Max context')}
</Th>
<Th fontSize={'mini'} pb={2}>
<HStack spacing={1}>
<Box>{t('common:core.ai.Support tool')}</Box>
<QuestionTip label={t('common:core.module.template.AI support tool tip')} />
</HStack>
</Th>
</Tr>
</Thead>
<Tbody>
<Tr color={'myGray.900'}>
<Td pt={0} pb={2}>
{t('common:support.wallet.Ai point every thousand tokens', {
points: selectedModel?.charsPointsPrice || 0
})}
</Td>
<Td pt={0} pb={2}>
{Math.round((selectedModel?.maxContext || 4096) / 1000)}K
</Td>
<Td pt={0} pb={2}>
{selectedModel?.toolChoice || selectedModel?.functionCall
? t('common:common.support')
: t('common:common.not_support')}
</Td>
</Tr>
</Tbody>
</Table>
</TableContainer>
<Flex>
<Box {...LabelStyles} mr={2}>
{t('common:core.app.Temperature')}
</Box>
<Box flex={1} ml={1}>
<MySlider
markList={[
{ label: t('common:core.app.deterministic'), value: 0 },
{ label: t('common:core.app.Random'), value: 10 }
]}
width={'95%'}
<Box flex={'1 0 0'}>
<InputSlider
min={0}
max={10}
step={1}
value={getValues(NodeInputKeyEnum.aiChatTemperature)}
onChange={(e) => {
setValue(NodeInputKeyEnum.aiChatTemperature, e);
@@ -163,20 +201,15 @@ const AIChatSettingsModal = ({
/>
</Box>
</Flex>
<Flex mt={6}>
<Flex mt={5}>
<Box {...LabelStyles} mr={2}>
{t('common:core.app.Max tokens')}
</Box>
<Box flex={1}>
<MySlider
markList={[
{ label: '100', value: 100 },
{ label: `${tokenLimit}`, value: tokenLimit }
]}
width={'95%'}
<Box flex={'1 0 0'}>
<InputSlider
min={100}
max={tokenLimit}
step={50}
step={200}
value={getValues(NodeInputKeyEnum.aiChatMaxToken)}
onChange={(val) => {
setValue(NodeInputKeyEnum.aiChatMaxToken, val);
@@ -186,19 +219,15 @@ const AIChatSettingsModal = ({
</Box>
</Flex>
{showMaxHistoriesSlider && (
<Flex mt={6}>
<Flex mt={5}>
<Box {...LabelStyles} mr={2}>
{t('common:core.app.Max histories')}
{t('app:max_histories_number')}
</Box>
<Box flex={1}>
<MySlider
markList={[
{ label: 0, value: 0 },
{ label: 30, value: 30 }
]}
width={'95%'}
<Box flex={'1 0 0'}>
<InputSlider
min={0}
max={30}
step={1}
value={getValues('maxHistories') ?? 6}
onChange={(e) => {
setValue('maxHistories', e);
@@ -209,13 +238,10 @@ const AIChatSettingsModal = ({
</Flex>
)}
{showResponseAnswerText && (
<Flex mt={6} alignItems={'center'}>
<Flex mt={5} alignItems={'center'}>
<Box {...LabelStyles}>
{t('common:core.app.Ai response')}
<QuestionTip
ml={1}
label={t('common:core.module.template.AI response switch tip')}
></QuestionTip>
{t('app:stream_response')}
<QuestionTip ml={1} label={t('app:stream_response_tip')}></QuestionTip>
</Box>
<Box flex={1}>
<Switch
@@ -230,7 +256,7 @@ const AIChatSettingsModal = ({
</Flex>
)}
{showVisionSwitch && (
<Flex mt={6} alignItems={'center'}>
<Flex mt={5} alignItems={'center'}>
<Box {...LabelStyles}>
{t('app:llm_use_vision')}
<QuestionTip ml={1} label={t('app:llm_use_vision_tip')}></QuestionTip>
@@ -261,6 +287,8 @@ const AIChatSettingsModal = ({
{t('common:common.Confirm')}
</Button>
</ModalFooter>
{isOpenAiPointsModal && <AiPointsModal onClose={onCloseAiPointsModal} />}
</MyModal>
);
};

Some files were not shown because too many files have changed in this diff Show More