diff --git a/docSite/assets/imgs/image-100.png b/docSite/assets/imgs/image-100.png new file mode 100644 index 000000000..2fcd4c06a Binary files /dev/null and b/docSite/assets/imgs/image-100.png differ diff --git a/docSite/assets/imgs/image-101.png b/docSite/assets/imgs/image-101.png new file mode 100644 index 000000000..c1648a4ea Binary files /dev/null and b/docSite/assets/imgs/image-101.png differ diff --git a/docSite/assets/imgs/image-102.png b/docSite/assets/imgs/image-102.png new file mode 100644 index 000000000..27f0131ab Binary files /dev/null and b/docSite/assets/imgs/image-102.png differ diff --git a/docSite/assets/imgs/image-103.png b/docSite/assets/imgs/image-103.png new file mode 100644 index 000000000..039194024 Binary files /dev/null and b/docSite/assets/imgs/image-103.png differ diff --git a/docSite/assets/imgs/image-104.png b/docSite/assets/imgs/image-104.png new file mode 100644 index 000000000..7f09448b1 Binary files /dev/null and b/docSite/assets/imgs/image-104.png differ diff --git a/docSite/assets/imgs/image-105.png b/docSite/assets/imgs/image-105.png new file mode 100644 index 000000000..527ddab85 Binary files /dev/null and b/docSite/assets/imgs/image-105.png differ diff --git a/docSite/assets/imgs/image-88.png b/docSite/assets/imgs/image-88.png new file mode 100644 index 000000000..03b5def59 Binary files /dev/null and b/docSite/assets/imgs/image-88.png differ diff --git a/docSite/assets/imgs/image-89.png b/docSite/assets/imgs/image-89.png new file mode 100644 index 000000000..3bbd87bc4 Binary files /dev/null and b/docSite/assets/imgs/image-89.png differ diff --git a/docSite/assets/imgs/image-90.png b/docSite/assets/imgs/image-90.png new file mode 100644 index 000000000..6ff40e2b5 Binary files /dev/null and b/docSite/assets/imgs/image-90.png differ diff --git a/docSite/assets/imgs/image-91.png b/docSite/assets/imgs/image-91.png new file mode 100644 index 000000000..25fc67b92 Binary files /dev/null and b/docSite/assets/imgs/image-91.png differ diff --git a/docSite/assets/imgs/image-92.png b/docSite/assets/imgs/image-92.png new file mode 100644 index 000000000..786473411 Binary files /dev/null and b/docSite/assets/imgs/image-92.png differ diff --git a/docSite/assets/imgs/image-93.png b/docSite/assets/imgs/image-93.png new file mode 100644 index 000000000..b87ef9bb3 Binary files /dev/null and b/docSite/assets/imgs/image-93.png differ diff --git a/docSite/assets/imgs/image-94.png b/docSite/assets/imgs/image-94.png new file mode 100644 index 000000000..20c2b714d Binary files /dev/null and b/docSite/assets/imgs/image-94.png differ diff --git a/docSite/assets/imgs/image-95.png b/docSite/assets/imgs/image-95.png new file mode 100644 index 000000000..1ef65ca8b Binary files /dev/null and b/docSite/assets/imgs/image-95.png differ diff --git a/docSite/assets/imgs/image-96.png b/docSite/assets/imgs/image-96.png new file mode 100644 index 000000000..3ddbc9c48 Binary files /dev/null and b/docSite/assets/imgs/image-96.png differ diff --git a/docSite/assets/imgs/image-97.png b/docSite/assets/imgs/image-97.png new file mode 100644 index 000000000..f376836b3 Binary files /dev/null and b/docSite/assets/imgs/image-97.png differ diff --git a/docSite/assets/imgs/image-98.png b/docSite/assets/imgs/image-98.png new file mode 100644 index 000000000..c97f5d85e Binary files /dev/null and b/docSite/assets/imgs/image-98.png differ diff --git a/docSite/assets/imgs/image-99.png b/docSite/assets/imgs/image-99.png new file mode 100644 index 000000000..5d4abc5d8 Binary files /dev/null and b/docSite/assets/imgs/image-99.png differ diff --git a/docSite/content/zh-cn/docs/development/configuration.md b/docSite/content/zh-cn/docs/development/configuration.md index f9ee74cbd..8cb5cbba0 100644 --- a/docSite/content/zh-cn/docs/development/configuration.md +++ b/docSite/content/zh-cn/docs/development/configuration.md @@ -25,247 +25,6 @@ weight: 707 "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", // 模型别名 - "maxContext": 125000, // 最大上下文 - "maxResponse": 16000, // 最大回复 - "quoteMaxToken": 120000, // 最大引用内容 - "maxTemperature": 1.2, // 最大温度 - "charsPointsPrice": 0, // n积分/1k token(商业版) - "censor": false, // 是否开启敏感校验(商业版) - "vision": true, // 是否支持图片输入 - "datasetProcess": true, // 是否设置为文本理解模型(QA),务必保证至少有一个为true,否则知识库会报错 - "usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true) - "usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true) - "usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true) - "toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。) - "functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式) - "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 - "customExtractPrompt": "", // 自定义内容提取提示词 - "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 - "defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) - "fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens) - }, - { - "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, - "toolChoice": true, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": {}, - "fieldMap": {} - }, - { - "provider": "OpenAI", - "model": "o1-mini", - "name": "o1-mini", - "maxContext": 125000, - "maxResponse": 65000, - "quoteMaxToken": 120000, - "maxTemperature": 1.2, - "charsPointsPrice": 0, - "censor": false, - "vision": false, - "datasetProcess": true, - "usedInClassify": true, - "usedInExtractFields": true, - "usedInToolCall": true, - "toolChoice": false, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": { - "temperature": 1, - "max_tokens": null, - "stream": false - } - }, - { - "provider": "OpenAI", - "model": "o1-preview", - "name": "o1-preview", - "maxContext": 125000, - "maxResponse": 32000, - "quoteMaxToken": 120000, - "maxTemperature": 1.2, - "charsPointsPrice": 0, - "censor": false, - "vision": false, - "datasetProcess": true, - "usedInClassify": true, - "usedInExtractFields": true, - "usedInToolCall": true, - "toolChoice": false, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": { - "temperature": 1, - "max_tokens": null, - "stream": false - } - } - ], - "vectorModels": [ - { - "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", - "charsPointsPrice": 0, - "defaultToken": 512, - "maxToken": 3000, - "weight": 100, - "defaultConfig": { - "dimensions": 1024 - } - }, - { - "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": [], - "audioSpeechModels": [ - { - "provider": "OpenAI", - "model": "tts-1", - "name": "OpenAI TTS1", - "charsPointsPrice": 0, - "voices": [ - { "label": "Alloy", "value": "alloy", "bufferId": "openai-Alloy" }, - { "label": "Echo", "value": "echo", "bufferId": "openai-Echo" }, - { "label": "Fable", "value": "fable", "bufferId": "openai-Fable" }, - { "label": "Onyx", "value": "onyx", "bufferId": "openai-Onyx" }, - { "label": "Nova", "value": "nova", "bufferId": "openai-Nova" }, - { "label": "Shimmer", "value": "shimmer", "bufferId": "openai-Shimmer" } - ] - } - ], - "whisperModel": { - "provider": "OpenAI", - "model": "whisper-1", - "name": "Whisper1", - "charsPointsPrice": 0 } } -``` - -## 内置的模型提供商ID - -为了方便模型分类展示,FastGPT 内置了部分模型提供商的名字和 Logo。如果你期望补充提供商,可[提交 Issue](https://github.com/labring/FastGPT/issues),并提供几个信息: - -1. 厂商官网地址 -2. 厂商 SVG logo,建议是正方形图片。 - -目前已支持的提供商, 复制 "-" 之前的字符串,作为 provider 的值。 - -- OpenAI -- Claude -- Gemini -- MistralAI -- Groq -- AliCloud - 阿里云 -- Qwen - 通义千问 -- Doubao - 豆包 -- ChatGLM - 智谱 -- DeepSeek - 深度求索 -- Moonshot - 月之暗面 -- MiniMax -- SparkDesk - 讯飞星火 -- Hunyuan - 腾讯混元 -- Baichuan - 百川 -- Yi - 零一万物 -- Ernie - 文心一言 -- StepFun - 阶跃星辰 -- Ollama -- BAAI - 智源研究院 -- FishAudio -- Intern - 书生 -- Moka - Moka-AI -- Other - 其他 - - -## ReRank 模型接入 - -由于 OneAPI 不支持 Rerank 模型,所以需要单独配置接入,这里 - - -### 使用硅基流动的在线模型 - -有免费的 `bge-reranker-v2-m3` 模型可以使用。 - -1. [点击注册硅基流动账号](https://cloud.siliconflow.cn/i/TR9Ym0c4) -2. 进入控制台,获取 API key: https://cloud.siliconflow.cn/account/ak -3. 修改 FastGPT 配置文件 - -```json -{ - "reRankModels": [ - { - "model": "BAAI/bge-reranker-v2-m3", // 这里的model需要对应 siliconflow 的模型名 - "name": "BAAI/bge-reranker-v2-m3", - "requestUrl": "https://api.siliconflow.cn/v1/rerank", - "requestAuth": "siliconflow 上申请的 key" - } - ] -} -``` - -### 私有部署模型 - -请使用 4.6.6-alpha 以上版本,配置文件中的 `reRankModels` 为重排模型,虽然是数组,不过目前仅有第1个生效。 - -1. [部署 ReRank 模型](/docs/development/custom-models/bge-rerank/) -1. 找到 FastGPT 的配置文件中的 `reRankModels`, 4.6.6 以前是 `ReRankModels`。 -2. 修改对应的值: - -```json -{ - "reRankModels": [ - { - "model": "bge-reranker-base", // 随意 - "name": "检索重排-base", // 随意 - "charsPointsPrice": 0, - "requestUrl": "{{host}}/v1/rerank", - "requestAuth": "安全凭证,已自动补 Bearer" - } - ] -} -``` +``` \ No newline at end of file diff --git a/docSite/content/zh-cn/docs/development/custom-models/bge-rerank.md b/docSite/content/zh-cn/docs/development/custom-models/bge-rerank.md index c6ae7fd11..ef1f27ac7 100644 --- a/docSite/content/zh-cn/docs/development/custom-models/bge-rerank.md +++ b/docSite/content/zh-cn/docs/development/custom-models/bge-rerank.md @@ -118,10 +118,17 @@ services: ``` ## 接入 FastGPT -参考 [ReRank模型接入](/docs/development/configuration/#rerank-接入),host 变量为部署的域名。 +1. 打开 FastGPT 模型配置,新增一个重排模型。 +2. 填写模型配置表单:模型 ID 为`bge-reranker-base`,地址填写`{{host}}/v1/rerank`,host 为你部署的域名/IP:Port。 + +![alt text](/imgs/image-102.png) ## QA +### 403报错 + +FastGPT中,自定义请求 Token 和环境变量的 ACCESS_TOKEN 不一致。 + ### Docker 运行提示 `Bus error (core dumped)` 尝试增加 `docker-compose.yml` 配置项 `shm_size` ,以增加容器中的共享内存目录大小。 diff --git a/docSite/content/zh-cn/docs/development/docker.md b/docSite/content/zh-cn/docs/development/docker.md index e438d1655..79a58e159 100644 --- a/docSite/content/zh-cn/docs/development/docker.md +++ b/docSite/content/zh-cn/docs/development/docker.md @@ -202,6 +202,10 @@ docker restart oneapi 首次运行,会自动初始化 root 用户,密码为 `1234`(与环境变量中的`DEFAULT_ROOT_PSW`一致),日志里会提示一次`MongoServerError: Unable to read from a snapshot due to pending collection catalog changes;`可忽略。 +### 6. 配置模型 + +[点击查看模型配置教程](/docs/development/modelConfig/intro/) + ## FAQ ### Mongo 副本集自动初始化失败 diff --git a/docSite/content/zh-cn/docs/development/faq.md b/docSite/content/zh-cn/docs/development/faq.md index a2e747f0b..9d37d7750 100644 --- a/docSite/content/zh-cn/docs/development/faq.md +++ b/docSite/content/zh-cn/docs/development/faq.md @@ -23,11 +23,11 @@ images: [] ![](/imgs/faq1.png) 这是索引模型的长度限制,通过任何方式部署都一样的,但不同索引模型的配置不一样,可以在后台修改参数。 -### sealos怎么挂载 小程序配置文件 +### 怎么挂载小程序配置文件 -新增配置文件:/app/projects/app/public/xxxx.txt +将验证文件,挂载到指定位置:/app/projects/app/public/xxxx.txt -如图: +然后重启。例如: ![](/imgs/faq2.png) diff --git a/docSite/content/zh-cn/docs/development/modelConfig/intro.md b/docSite/content/zh-cn/docs/development/modelConfig/intro.md new file mode 100644 index 000000000..ff59f695f --- /dev/null +++ b/docSite/content/zh-cn/docs/development/modelConfig/intro.md @@ -0,0 +1,412 @@ +--- +title: 'FastGPT 模型配置说明' +description: 'FastGPT 模型配置说明' +icon: 'api' +draft: false +toc: true +weight: 744 +--- + +在 4.8.20 版本以前,FastGPT 模型配置在 `config.json` 文件中声明,你可以在 https://github.com/labring/FastGPT/blob/main/projects/app/data/model.json 中找到旧版的配置文件示例。 + +从 4.8.20 版本开始,你可以直接在 FastGPT 页面中进行模型配置,并且系统内置了大量模型,无需从 0 开始配置。下面介绍模型配置的基本流程: + +## 1. 使用 OneAPI 对接模型提供商 + +可以使用 [OneAPI 接入教程](/docs/development/modelconfig/one-api) 来进行模型聚合,从而可以对接更多模型提供商。你需要先在各服务商申请好 API 接入 OneAPI 后,才能在 FastGPT 中使用这些模型。示例流程如下: + +![alt text](/imgs/image-95.png) + +除了各模型官方的服务外,还有一些第三方服务商提供模型接入服务,当然你也可以用 Ollama 等来部署本地模型,最终都需要接入 OneAPI,下面是一些第三方服务商: + +{{% alert icon=" " context="info" %}} +- [SiliconCloud(硅基流动)](https://cloud.siliconflow.cn/i/TR9Ym0c4): 提供开源模型调用的平台。 +- [Sealos AIProxy](https://hzh.sealos.run/?openapp=system-aiproxy): 提供国内各家模型代理,无需逐一申请 api。 +{{% /alert %}} + +在 OneAPI 配置好模型后,你就可以打开 FastGPT 页面,启用对应模型了。 + +## 2. 登录 root 用户 + +仅 root 用户可以进行模型配置。 + +## 3. 进入模型配置页面 + +登录 root 用户后,在`账号-模型提供商-模型配置`中,你可以看到所有内置的模型和自定义模型,以及哪些模型启用了。 + +![alt text](/image-90.png) + +## 4. 配置介绍 + +{{% alert icon="🤖 " context="success" %}} +注意:目前语音识别模型和重排模型仅会生效一个,所以配置时候,只需要配置一个即可。 +{{% /alert %}} + +### 核心配置 + +- 模型 ID:实际发出请求的`model`值,全局唯一。 +- 自定义请求地址/Token:如果需要绕过`OneAPI`,可以设置自定义请求地址和 Token。一般情况下不需要,如果 OneAPI 不支持某些模型,可以使用该特性。 + +### 模型类型 + +1. 语言模型 - 进行文本对话,多模态模型支持图片识别。 +2. 索引模型 - 对文本块进行索引,用于相关文本检索。 +3. 语音合成 - 将文本转换为语音。 +4. 语音识别 - 将语音转换为文本。 +5. 重排模型 - 对文本进行重排,用于优化文本质量。 + +### 启用模型 + +系统内置了目前主流厂商的模型,如果你不熟悉配置,直接点击`启用`即可,需要注意到是,模型 ID 需要和 OneAPI 中渠道的`模型`一致。 + +| | | +| --- | --- | +| ![alt text](/imgs/image-91.png) | ![alt text](/imgs/image-92.png) | + +### 修改模型配置 + +点击模型右侧的齿轮即可进行模型配置,不同类型模型的配置有区别。 + +| | | +| --- | --- | +| ![alt text](/imgs/image-93.png) | ![alt text](/imgs/image-94.png) | + +### 新增自定义模型 + +如果系统内置的模型无法满足你的需求,你可以添加自定义模型。自定义模型中,如果`模型 ID`与系统内置的模型 ID 一致,则会被认为是修改系统模型。 + +| | | +| --- | --- | +| ![alt text](/imgs/image-96.png) | ![alt text](/imgs/image-97.png) | + +### 通过配置文件配置 + +如果你觉得通过页面配置模型比较麻烦,你也可以通过配置文件来配置模型。或者希望快速将一个系统的配置,复制到另一个系统,也可以通过配置文件来实现。 + +| | | +| --- | --- | +| ![alt text](/imgs/image-98.png) | ![alt text](/imgs/image-99.png) | + +**语言模型字段说明:** + +```json +{ + "model": "模型 ID", + "metadata": { + "isCustom": true, // 是否为自定义模型 + "isActive": true, // 是否启用 + "provider": "OpenAI", // 模型提供商,主要用于分类展示,目前已经内置提供商包括:https://github.com/labring/FastGPT/blob/main/packages/global/core/ai/provider.ts, 可 pr 提供新的提供商,或直接填写 Other + "model": "gpt-4o-mini", // 模型ID(对应OneAPI中渠道的模型名) + "name": "gpt-4o-mini", // 模型别名 + "maxContext": 125000, // 最大上下文 + "maxResponse": 16000, // 最大回复 + "quoteMaxToken": 120000, // 最大引用内容 + "maxTemperature": 1.2, // 最大温度 + "charsPointsPrice": 0, // n积分/1k token(商业版) + "censor": false, // 是否开启敏感校验(商业版) + "vision": true, // 是否支持图片输入 + "datasetProcess": true, // 是否设置为文本理解模型(QA),务必保证至少有一个为true,否则知识库会报错 + "usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true) + "usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true) + "usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true) + "toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。) + "functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式) + "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 + "customExtractPrompt": "", // 自定义内容提取提示词 + "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 + "defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) + "fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens) + } +} +``` + +**索引模型字段说明:** + +```json +{ + "model": "模型 ID", + "metadata": { + "isCustom": true, // 是否为自定义模型 + "isActive": true, // 是否启用 + "provider": "OpenAI", // 模型提供商 + "model": "text-embedding-3-small", // 模型ID + "name": "text-embedding-3-small", // 模型别名 + "charsPointsPrice": 0, // n积分/1k token + "defaultToken": 512, // 默认文本分割时候的 token + "maxToken": 3000 // 最大 token + } +} +``` + +**重排模型字段说明:** + +```json +{ + "model": "模型 ID", + "metadata": { + "isCustom": true, // 是否为自定义模型 + "isActive": true, // 是否启用 + "provider": "BAAI", // 模型提供商 + "model": "bge-reranker-v2-m3", // 模型ID + "name": "ReRanker-Base", // 模型别名 + "requestUrl": "", // 自定义请求地址 + "requestAuth": "", // 自定义请求认证 + "type": "rerank" // 模型类型 + } +} +``` + +**语音合成模型字段说明:** + +```json +{ + "model": "模型 ID", + "metadata": { + "isActive": true, // 是否启用 + "isCustom": true, // 是否为自定义模型 + "type": "tts", // 模型类型 + "provider": "FishAudio", // 模型提供商 + "model": "fishaudio/fish-speech-1.5", // 模型ID + "name": "fish-speech-1.5", // 模型别名 + "voices": [ // 音色 + { + "label": "fish-alex", // 音色名称 + "value": "fishaudio/fish-speech-1.5:alex", // 音色ID + }, + { + "label": "fish-anna", // 音色名称 + "value": "fishaudio/fish-speech-1.5:anna", // 音色ID + } + ], + "charsPointsPrice": 0 // n积分/1k token + } +} +``` + +**语音识别模型字段说明:** + +```json +{ + "model": "whisper-1", + "metadata": { + "isActive": true, // 是否启用 + "isCustom": true, // 是否为自定义模型 + "provider": "OpenAI", // 模型提供商 + "model": "whisper-1", // 模型ID + "name": "whisper-1", // 模型别名 + "charsPointsPrice": 0, // n积分/1k token + "type": "stt" // 模型类型 + } +} +``` + +## 模型测试 + +FastGPT 页面上提供了每类模型的简单测试,可以初步检查模型是否正常工作,会实际按模板发送一个请求。 + +![alt text](/imgs/image-105.png) + +## 模型接入示例 + +### ReRank 模型接入 + +由于 OneAPI 不支持 Rerank 模型,所以需要单独配置。FastGPT 中,模型配置支持自定义请求地址,可以绕过 OneAPI,直接向提供商发起请求,可以利用这个特性来接入 Rerank 模型。 + + +#### 使用硅基流动的在线模型 + +有免费的 `bge-reranker-v2-m3` 模型可以使用。 + +1. [点击注册硅基流动账号](https://cloud.siliconflow.cn/i/TR9Ym0c4) +2. 进入控制台,获取 API key: https://cloud.siliconflow.cn/account/ak +3. 打开 FastGPT 模型配置,新增一个`BAAI/bge-reranker-v2-m3`的重排模型(如果系统内置了,也可以直接变更,无需新增)。 + +![alt text](/imgs/image-101.png) + +#### 私有部署模型 + +[点击查看部署 ReRank 模型教程](/docs/development/custom-models/bge-rerank/) + + +## 旧版模型配置说明 + +配置好 OneAPI 后,需要在`config.json`文件中,手动的增加模型配置,并重启。 + +由于环境变量不利于配置复杂的内容,FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/development/docker/) 来挂载配置文件。 + +**开发环境下**,你需要将示例配置文件 `config.json` 复制成 `config.local.json` 文件才会生效。 +**Docker部署**,修改`config.json` 文件,需要重启容器。 + +下面配置文件示例中包含了系统参数和各个模型配置: + +```json +{ + "feConfigs": { + "lafEnv": "https://laf.dev" // laf环境。 https://laf.run (杭州阿里云) ,或者私有化的laf环境。如果使用 Laf openapi 功能,需要最新版的 laf 。 + }, + "systemEnv": { + "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", // 模型别名 + "maxContext": 125000, // 最大上下文 + "maxResponse": 16000, // 最大回复 + "quoteMaxToken": 120000, // 最大引用内容 + "maxTemperature": 1.2, // 最大温度 + "charsPointsPrice": 0, // n积分/1k token(商业版) + "censor": false, // 是否开启敏感校验(商业版) + "vision": true, // 是否支持图片输入 + "datasetProcess": true, // 是否设置为文本理解模型(QA),务必保证至少有一个为true,否则知识库会报错 + "usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true) + "usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true) + "usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true) + "toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。) + "functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式) + "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 + "customExtractPrompt": "", // 自定义内容提取提示词 + "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 + "defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) + "fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens) + }, + { + "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, + "toolChoice": true, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": {}, + "fieldMap": {} + }, + { + "provider": "OpenAI", + "model": "o1-mini", + "name": "o1-mini", + "maxContext": 125000, + "maxResponse": 65000, + "quoteMaxToken": 120000, + "maxTemperature": 1.2, + "charsPointsPrice": 0, + "censor": false, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": { + "temperature": 1, + "max_tokens": null, + "stream": false + } + }, + { + "provider": "OpenAI", + "model": "o1-preview", + "name": "o1-preview", + "maxContext": 125000, + "maxResponse": 32000, + "quoteMaxToken": 120000, + "maxTemperature": 1.2, + "charsPointsPrice": 0, + "censor": false, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": { + "temperature": 1, + "max_tokens": null, + "stream": false + } + } + ], + "vectorModels": [ + { + "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", + "charsPointsPrice": 0, + "defaultToken": 512, + "maxToken": 3000, + "weight": 100, + "defaultConfig": { + "dimensions": 1024 + } + }, + { + "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": [], + "audioSpeechModels": [ + { + "provider": "OpenAI", + "model": "tts-1", + "name": "OpenAI TTS1", + "charsPointsPrice": 0, + "voices": [ + { "label": "Alloy", "value": "alloy", "bufferId": "openai-Alloy" }, + { "label": "Echo", "value": "echo", "bufferId": "openai-Echo" }, + { "label": "Fable", "value": "fable", "bufferId": "openai-Fable" }, + { "label": "Onyx", "value": "onyx", "bufferId": "openai-Onyx" }, + { "label": "Nova", "value": "nova", "bufferId": "openai-Nova" }, + { "label": "Shimmer", "value": "shimmer", "bufferId": "openai-Shimmer" } + ] + } + ], + "whisperModel": { + "provider": "OpenAI", + "model": "whisper-1", + "name": "Whisper1", + "charsPointsPrice": 0 + } +} +``` \ No newline at end of file diff --git a/docSite/content/zh-cn/docs/development/modelConfig/one-api.md b/docSite/content/zh-cn/docs/development/modelConfig/one-api.md index 2bfee1013..537e90067 100644 --- a/docSite/content/zh-cn/docs/development/modelConfig/one-api.md +++ b/docSite/content/zh-cn/docs/development/modelConfig/one-api.md @@ -94,69 +94,16 @@ CHAT_API_KEY=sk-xxxxxx ![](/imgs/oneapi-demo1.png) -### 2. 修改 FastGPT 配置文件 +### 2. 修改 FastGPT 模型配置 -可以在 `/projects/app/src/data/config.json` 里找到配置文件(本地开发需要复制成 config.local.json),按下面内容修改配置文件,最新/更具体的配置说明,可查看[FastGPT 配置文件说明](/docs/development/configuration)。 +打开 FastGPT 模型配置,启动文心千帆模型,如果希望未内置,可以通过新增模型来配置。 -配置模型关键点在于`model` 需要与 OneAPI 渠道中的模型一致。 - -```json -{ - "llmModels": [ // 语言模型配置 - { - "model": "ERNIE-Bot", // 这里的模型需要对应 One API 的模型 - "name": "文心一言", // 对外展示的名称 - "avatar": "/imgs/model/openai.svg", // 模型的logo - "maxContext": 16000, // 最大上下文 - "maxResponse": 4000, // 最大回复 - "quoteMaxToken": 13000, // 最大引用内容 - "maxTemperature": 1.2, // 最大温度 - "charsPointsPrice": 0, - "censor": false, - "vision": false, // 是否支持图片输入 - "datasetProcess": true, // 是否设置为知识库处理模型 - "usedInClassify": true, // 是否用于问题分类 - "usedInExtractFields": true, // 是否用于字段提取 - "usedInToolCall": true, // 是否用于工具调用 - "toolChoice": true, // 是否支持工具选择 - "functionCall": false, // 是否支持函数调用 - "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 - "customExtractPrompt": "", // 自定义内容提取提示词 - "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 - "defaultConfig":{} // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) - } - ], - "vectorModels": [ // 向量模型配置 - { - "model": "text-embedding-ada-002", - "name": "Embedding-2", - "avatar": "/imgs/model/openai.svg", - "charsPointsPrice": 0, - "defaultToken": 700, - "maxToken": 3000, - "weight": 100 - }, - ] -} -``` - -### 3. 重启 FastGPT - -**Docker 版本** - -```bash -docker-compose down -docker-compose up -d -``` - -**Sealos 版本** - -直接找到 FastGPT 服务,点击重启即可。 +![alt text](/imgs/image-103.png) ## 其他服务商接入参考 -这章介绍一些提供商接入 OneAPI 的教程,配置后不要忘记修改 FastGPT 配置文件。 +这章介绍一些提供商接入 OneAPI 的教程,配置后不要忘记在 FastGPT 模型配置中启用。 ### 阿里通义千问 diff --git a/docSite/content/zh-cn/docs/development/modelConfig/siliconCloud.md b/docSite/content/zh-cn/docs/development/modelConfig/siliconCloud.md index e1177bb46..06036deb3 100644 --- a/docSite/content/zh-cn/docs/development/modelConfig/siliconCloud.md +++ b/docSite/content/zh-cn/docs/development/modelConfig/siliconCloud.md @@ -27,137 +27,13 @@ OPENAI_BASE_URL=https://api.siliconflow.cn/v1 CHAT_API_KEY=sk-xxxxxx ``` -## 3. 修改 FastGPT 配置文件 +## 3. 修改 FastGPT 模型配置 -我们选取 SiliconCloud 中的模型作为 FastGPT 配置。这里配置了 `Qwen2.5 72b` 的纯语言和视觉模型;选择 `bge-m3` 作为向量模型;选择 `bge-reranker-v2-m3` 作为重排模型。选择 `fish-speech-1.5` 作为语音模型;选择 `SenseVoiceSmall` 作为语音输入模型。 +系统内置了几个硅基流动的模型进行体验,如果需要其他模型,可以手动添加。 -注意:ReRank 模型仍需配置一次 Api Key +这里启动了 `Qwen2.5 72b` 的纯语言和视觉模型;选择 `bge-m3` 作为向量模型;选择 `bge-reranker-v2-m3` 作为重排模型。选择 `fish-speech-1.5` 作为语音模型;选择 `SenseVoiceSmall` 作为语音输入模型。 -```json -{ - "llmModels": [ - { - "provider": "Other", // 模型提供商,主要用于分类展示,目前已经内置提供商包括:https://github.com/labring/FastGPT/blob/main/packages/global/core/ai/provider.ts, 可 pr 提供新的提供商,或直接填写 Other - "model": "Qwen/Qwen2.5-72B-Instruct", // 模型名(对应OneAPI中渠道的模型名) - "name": "Qwen2.5-72B-Instruct", // 模型别名 - "maxContext": 32000, // 最大上下文 - "maxResponse": 4000, // 最大回复 - "quoteMaxToken": 30000, // 最大引用内容 - "maxTemperature": 1, // 最大温度 - "charsPointsPrice": 0, // n积分/1k token(商业版) - "censor": false, // 是否开启敏感校验(商业版) - "vision": false, // 是否支持图片输入 - "datasetProcess": true, // 是否设置为文本理解模型(QA),务必保证至少有一个为true,否则知识库会报错 - "usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true) - "usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true) - "usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true) - "toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。) - "functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式) - "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 - "customExtractPrompt": "", // 自定义内容提取提示词 - "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 - "defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) - "fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens) - }, - { - "provider": "Other", - "model": "Qwen/Qwen2-VL-72B-Instruct", - "name": "Qwen2-VL-72B-Instruct", - "maxContext": 32000, - "maxResponse": 4000, - "quoteMaxToken": 30000, - "maxTemperature": 1, - "charsPointsPrice": 0, - "censor": false, - "vision": true, - "datasetProcess": false, - "usedInClassify": false, - "usedInExtractFields": false, - "usedInToolCall": false, - "toolChoice": false, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": {} - } - ], - "vectorModels": [ - { - "provider": "Other", - "model": "Pro/BAAI/bge-m3", - "name": "Pro/BAAI/bge-m3", - "charsPointsPrice": 0, - "defaultToken": 512, - "maxToken": 5000, - "weight": 100 - } - ], - "reRankModels": [ - { - "model": "BAAI/bge-reranker-v2-m3", // 这里的model需要对应 siliconflow 的模型名 - "name": "BAAI/bge-reranker-v2-m3", - "requestUrl": "https://api.siliconflow.cn/v1/rerank", - "requestAuth": "siliconflow 上申请的 key" - } - ], - "audioSpeechModels": [ - { - "model": "fishaudio/fish-speech-1.5", - "name": "fish-speech-1.5", - "voices": [ - { - "label": "fish-alex", - "value": "fishaudio/fish-speech-1.5:alex", - "bufferId": "fish-alex" - }, - { - "label": "fish-anna", - "value": "fishaudio/fish-speech-1.5:anna", - "bufferId": "fish-anna" - }, - { - "label": "fish-bella", - "value": "fishaudio/fish-speech-1.5:bella", - "bufferId": "fish-bella" - }, - { - "label": "fish-benjamin", - "value": "fishaudio/fish-speech-1.5:benjamin", - "bufferId": "fish-benjamin" - }, - { - "label": "fish-charles", - "value": "fishaudio/fish-speech-1.5:charles", - "bufferId": "fish-charles" - }, - { - "label": "fish-claire", - "value": "fishaudio/fish-speech-1.5:claire", - "bufferId": "fish-claire" - }, - { - "label": "fish-david", - "value": "fishaudio/fish-speech-1.5:david", - "bufferId": "fish-david" - }, - { - "label": "fish-diana", - "value": "fishaudio/fish-speech-1.5:diana", - "bufferId": "fish-diana" - } - ] - } - ], - "whisperModel": { - "model": "FunAudioLLM/SenseVoiceSmall", - "name": "SenseVoiceSmall", - "charsPointsPrice": 0 - } -} -``` - -## 4. 重启 FastGPT +![alt text](/imgs/image-104.png) ## 5. 体验测试 diff --git a/docSite/content/zh-cn/docs/development/sealos.md b/docSite/content/zh-cn/docs/development/sealos.md index 9e4f25e84..0a23e5ce7 100644 --- a/docSite/content/zh-cn/docs/development/sealos.md +++ b/docSite/content/zh-cn/docs/development/sealos.md @@ -34,7 +34,7 @@ FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI 、A Deploy on Sealos -### 开始部署 +### 1. 开始部署 由于需要部署数据库,部署完后需要等待 2~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。 @@ -52,27 +52,15 @@ FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI 、A ![](/imgs/sealos2.png) -### 登录 +### 2. 登录 用户名:`root` 密码是刚刚一键部署时设置的`root_password` -### 修改配置文件和环境变量 +### 3. 配置模型 -在 Sealos 中,你可以打开`应用管理`(App Launchpad)看到部署的 FastGPT,可以打开`数据库`(Database)看到对应的数据库。 - -在`应用管理`中,选中 FastGPT,点击变更,可以看到对应的环境变量和配置文件。 - -![](/imgs/fastgptonsealos1.png) - -{{% alert icon="🤖 " context="success" %}} -在 Sealos 上,FastGPT 一共运行了 1 个服务和 2 个数据库,如暂停和删除请注意数据库一同操作。(你可以白天启动,晚上暂停它们,省钱大法) -{{% /alert %}} - -### 更新 - -点击变更或重启会自动拉取镜像更新,请确保镜像`tag`正确。建议不要使用`latest`,改成固定版本号。 +[点击查看模型配置教程](/docs/development/modelConfig/intro/) ## 收费 @@ -88,7 +76,20 @@ FastGPT 商业版共包含了2个应用(fastgpt, fastgpt-plus)和2个数据 点击右侧的详情,可以查看对应应用的详细信息。 +### 修改配置文件和环境变量 + +在 Sealos 中,你可以打开`应用管理`(App Launchpad)看到部署的 FastGPT,可以打开`数据库`(Database)看到对应的数据库。 + +在`应用管理`中,选中 FastGPT,点击变更,可以看到对应的环境变量和配置文件。 + +![](/imgs/fastgptonsealos1.png) + +{{% alert icon="🤖 " context="success" %}} +在 Sealos 上,FastGPT 一共运行了 1 个服务和 2 个数据库,如暂停和删除请注意数据库一同操作。(你可以白天启动,晚上暂停它们,省钱大法) +{{% /alert %}} + ### 如何更新/升级 FastGPT + [升级脚本文档](https://doc.tryfastgpt.ai/docs/development/upgrading/)先看下文档,看下需要升级哪个版本。注意,不要跨版本升级!!!!! 例如,目前是4.5 版本,要升级到4.5.1,就先把镜像版本改成v4.5.1,执行一下升级脚本,等待完成后再继续升级。如果目标版本不需要执行初始化,则可以跳过。 @@ -148,8 +149,6 @@ SYSTEM_FAVICON 可以是一个网络地址 ![](/imgs/onsealos8.png) -### 管理后台(已合并到plus) - ### 商业版镜像配置文件 ``` diff --git a/docSite/content/zh-cn/docs/development/upgrading/4820.md b/docSite/content/zh-cn/docs/development/upgrading/4820.md index 124ddc654..0a2965e1a 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/4820.md +++ b/docSite/content/zh-cn/docs/development/upgrading/4820.md @@ -9,6 +9,10 @@ weight: 804 ## 更新指南 +### 1. 更新环境变量 + +如果有很早版本用户,配置了`ONEAPI_URL`的,需要统一改成`OPENAI_BASE_URL` + ### 1. 更新镜像: @@ -26,6 +30,7 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4820' \ ## 完整更新内容 -1. 新增 - 可视化模型配置。预设超过 100 个模型,方便进行模型配置。 +1. 新增 - 可视化模型参数配置。预设超过 100 个模型配置。同时支持所有类型模型的一键测试。(预计下个版本会完全支持在页面上配置渠道)。 2. 新增 - 使用记录导出和仪表盘。 -3. 优化 - 页面组件抽离,减少页面组件路由。 \ No newline at end of file +3. 优化 - 页面组件抽离,减少页面组件路由。 +4. 优化 - 全文检索,忽略大小写。 \ No newline at end of file diff --git a/packages/global/core/ai/provider.ts b/packages/global/core/ai/provider.ts index 05bc78407..1f10b9ebc 100644 --- a/packages/global/core/ai/provider.ts +++ b/packages/global/core/ai/provider.ts @@ -7,6 +7,7 @@ export type ModelProviderIdType = | 'Meta' | 'MistralAI' | 'Groq' + | 'Grok' | 'AliCloud' | 'Qwen' | 'Doubao' @@ -60,6 +61,11 @@ export const ModelProviderList: ModelProviderType[] = [ name: 'MistralAI', avatar: 'model/mistral' }, + { + id: 'Grok', + name: 'Grok', + avatar: 'model/grok' + }, { id: 'Groq', name: 'Groq', diff --git a/packages/global/core/chat/constants.ts b/packages/global/core/chat/constants.ts index ac0d27875..13aa64934 100644 --- a/packages/global/core/chat/constants.ts +++ b/packages/global/core/chat/constants.ts @@ -75,5 +75,3 @@ export enum ChatStatusEnum { running = 'running', finish = 'finish' } - -export const MARKDOWN_QUOTE_SIGN = 'QUOTE SIGN'; diff --git a/packages/service/core/ai/audio/speech.ts b/packages/service/core/ai/audio/speech.ts index fe805d151..3d82f68c6 100644 --- a/packages/service/core/ai/audio/speech.ts +++ b/packages/service/core/ai/audio/speech.ts @@ -1,5 +1,6 @@ import type { NextApiResponse } from 'next'; import { getAIApi } from '../config'; +import { getTTSModel } from '../model'; export async function text2Speech({ res, @@ -18,15 +19,26 @@ export async function text2Speech({ voice: string; speed?: number; }) { + const modelData = getTTSModel(model)!; const ai = getAIApi(); - const response = await ai.audio.speech.create({ - model, - // @ts-ignore - voice, - input, - response_format: 'mp3', - speed - }); + const response = await ai.audio.speech.create( + { + model, + // @ts-ignore + voice, + input, + response_format: 'mp3', + speed + }, + modelData.requestUrl && modelData.requestAuth + ? { + path: modelData.requestUrl, + headers: { + Authorization: `Bearer ${modelData.requestAuth}` + } + } + : {} + ); const readableStream = response.body as unknown as NodeJS.ReadableStream; readableStream.pipe(res); diff --git a/packages/service/core/ai/config.ts b/packages/service/core/ai/config.ts index ca05ebbc8..859bbb80d 100644 --- a/packages/service/core/ai/config.ts +++ b/packages/service/core/ai/config.ts @@ -14,8 +14,7 @@ export const openaiBaseUrl = process.env.OPENAI_BASE_URL || 'https://api.openai. export const getAIApi = (props?: { userKey?: OpenaiAccountType; timeout?: number }) => { const { userKey, timeout } = props || {}; - const baseUrl = - userKey?.baseUrl || global?.systemEnv?.oneapiUrl || process.env.ONEAPI_URL || openaiBaseUrl; + const baseUrl = userKey?.baseUrl || global?.systemEnv?.oneapiUrl || openaiBaseUrl; const apiKey = userKey?.key || global?.systemEnv?.chatApiKey || process.env.CHAT_API_KEY || ''; return new OpenAI({ @@ -30,8 +29,7 @@ export const getAIApi = (props?: { userKey?: OpenaiAccountType; timeout?: number export const getAxiosConfig = (props?: { userKey?: OpenaiAccountType }) => { const { userKey } = props || {}; - const baseUrl = - userKey?.baseUrl || global?.systemEnv?.oneapiUrl || process.env.ONEAPI_URL || openaiBaseUrl; + const baseUrl = userKey?.baseUrl || global?.systemEnv?.oneapiUrl || openaiBaseUrl; const apiKey = userKey?.key || global?.systemEnv?.chatApiKey || process.env.CHAT_API_KEY || ''; return { diff --git a/packages/service/core/ai/config/embedding/siliconflow-bge-m3.json b/packages/service/core/ai/config/embedding/siliconflow-bge-m3.json new file mode 100644 index 000000000..31509ccf7 --- /dev/null +++ b/packages/service/core/ai/config/embedding/siliconflow-bge-m3.json @@ -0,0 +1,10 @@ +{ + "provider": "Siliconflow", + "model": "BAAI/bge-m3", + "name": "BAAI/bge-m3", + + "defaultToken": 512, + "maxToken": 8000, + + "charsPointsPrice": 0 +} diff --git a/packages/service/core/ai/config/embedding/text-embedding-3-large.json b/packages/service/core/ai/config/embedding/text-embedding-3-large.json index cfc87467c..5a37f9c77 100644 --- a/packages/service/core/ai/config/embedding/text-embedding-3-large.json +++ b/packages/service/core/ai/config/embedding/text-embedding-3-large.json @@ -4,7 +4,7 @@ "name": "text-embedding-3-large", "defaultToken": 512, - "maxToken": 3000, + "maxToken": 8000, "charsPointsPrice": 0, diff --git a/packages/service/core/ai/config/embedding/text-embedding-3-small.json b/packages/service/core/ai/config/embedding/text-embedding-3-small.json index 111c385c3..096e63d05 100644 --- a/packages/service/core/ai/config/embedding/text-embedding-3-small.json +++ b/packages/service/core/ai/config/embedding/text-embedding-3-small.json @@ -4,7 +4,7 @@ "name": "text-embedding-3-small", "defaultToken": 512, - "maxToken": 3000, + "maxToken": 8000, "charsPointsPrice": 0 } diff --git a/packages/service/core/ai/config/embedding/text-embedding-ada-002.json b/packages/service/core/ai/config/embedding/text-embedding-ada-002.json index 6389ac1d8..cdec0bae7 100644 --- a/packages/service/core/ai/config/embedding/text-embedding-ada-002.json +++ b/packages/service/core/ai/config/embedding/text-embedding-ada-002.json @@ -4,7 +4,7 @@ "name": "text-embedding-ada-002", "defaultToken": 512, - "maxToken": 3000, + "maxToken": 8000, "charsPointsPrice": 0 } diff --git a/packages/service/core/ai/config/llm/Doubao-lite-128k.json b/packages/service/core/ai/config/llm/Doubao-lite-128k.json index 85b2863c8..8919f377a 100644 --- a/packages/service/core/ai/config/llm/Doubao-lite-128k.json +++ b/packages/service/core/ai/config/llm/Doubao-lite-128k.json @@ -3,26 +3,23 @@ "model": "Doubao-lite-128k", "name": "Doubao-lite-128k", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, "maxTemperature": 1, "vision": false, - "toolChoice": false, + "toolChoice": true, "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/Doubao-lite-32k.json b/packages/service/core/ai/config/llm/Doubao-lite-32k.json index 24a0e1316..05596cdf9 100644 --- a/packages/service/core/ai/config/llm/Doubao-lite-32k.json +++ b/packages/service/core/ai/config/llm/Doubao-lite-32k.json @@ -3,16 +3,13 @@ "model": "Doubao-lite-32k", "name": "Doubao-lite-32k", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 32000, "maxResponse": 4000, - "quoteMaxToken": 30000, + "quoteMaxToken": 32000, "maxTemperature": 1, "vision": false, - "toolChoice": false, + "toolChoice": true, "functionCall": false, "defaultSystemChatPrompt": "", @@ -22,7 +19,7 @@ "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/Doubao-lite-4k.json b/packages/service/core/ai/config/llm/Doubao-lite-4k.json new file mode 100644 index 000000000..626d21702 --- /dev/null +++ b/packages/service/core/ai/config/llm/Doubao-lite-4k.json @@ -0,0 +1,26 @@ +{ + "provider": "Doubao", + "model": "Doubao-lite-4k", + "name": "Doubao-lite-4k", + + "maxContext": 4000, + "maxResponse": 4000, + "quoteMaxToken": 4000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/Doubao-pro-128k.json b/packages/service/core/ai/config/llm/Doubao-pro-128k.json index dfa95808d..552ca08c8 100644 --- a/packages/service/core/ai/config/llm/Doubao-pro-128k.json +++ b/packages/service/core/ai/config/llm/Doubao-pro-128k.json @@ -3,26 +3,23 @@ "model": "Doubao-pro-128k", "name": "Doubao-pro-128k", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, "maxTemperature": 1, "vision": false, - "toolChoice": false, + "toolChoice": true, "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/Doubao-pro-32k.json b/packages/service/core/ai/config/llm/Doubao-pro-32k.json index eab9bd21d..ada380a24 100644 --- a/packages/service/core/ai/config/llm/Doubao-pro-32k.json +++ b/packages/service/core/ai/config/llm/Doubao-pro-32k.json @@ -3,16 +3,13 @@ "model": "Doubao-pro-32k", "name": "Doubao-pro-32k", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 32000, "maxResponse": 4000, - "quoteMaxToken": 30000, + "quoteMaxToken": 32000, "maxTemperature": 1, "vision": false, - "toolChoice": false, + "toolChoice": true, "functionCall": false, "defaultSystemChatPrompt": "", @@ -22,7 +19,7 @@ "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/Doubao-pro-4k.json b/packages/service/core/ai/config/llm/Doubao-pro-4k.json new file mode 100644 index 000000000..e6b3cedc7 --- /dev/null +++ b/packages/service/core/ai/config/llm/Doubao-pro-4k.json @@ -0,0 +1,26 @@ +{ + "provider": "Doubao", + "model": "Doubao-pro-4k", + "name": "Doubao-pro-4k", + + "maxContext": 4000, + "maxResponse": 4000, + "quoteMaxToken": 4000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/Doubao-vision-lite-32k.json b/packages/service/core/ai/config/llm/Doubao-vision-lite-32k.json index 9a3c89c82..6decf23de 100644 --- a/packages/service/core/ai/config/llm/Doubao-vision-lite-32k.json +++ b/packages/service/core/ai/config/llm/Doubao-vision-lite-32k.json @@ -3,12 +3,9 @@ "model": "Doubao-vision-lite-32k", "name": "Doubao-vision-lite-32k", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 32000, "maxResponse": 4000, - "quoteMaxToken": 30000, + "quoteMaxToken": 32000, "maxTemperature": 1, "vision": true, @@ -22,7 +19,7 @@ "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/Doubao-vision-pro-32k.json b/packages/service/core/ai/config/llm/Doubao-vision-pro-32k.json index e3d6f8939..3867616bb 100644 --- a/packages/service/core/ai/config/llm/Doubao-vision-pro-32k.json +++ b/packages/service/core/ai/config/llm/Doubao-vision-pro-32k.json @@ -3,12 +3,9 @@ "model": "Doubao-vision-pro-32k", "name": "Doubao-vision-pro-32k", - "censor": false, - "charsPointsPrice": 2, - "maxContext": 32000, "maxResponse": 4000, - "quoteMaxToken": 30000, + "quoteMaxToken": 32000, "maxTemperature": 1, "vision": true, @@ -22,7 +19,7 @@ "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/ERNIE-4.0-8K.json b/packages/service/core/ai/config/llm/ERNIE-4.0-8K.json index 8beef5a02..5fec2f058 100644 --- a/packages/service/core/ai/config/llm/ERNIE-4.0-8K.json +++ b/packages/service/core/ai/config/llm/ERNIE-4.0-8K.json @@ -3,9 +3,6 @@ "model": "ERNIE-4.0-8K", "name": "ERNIE-4.0-8K", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 8000, "maxResponse": 2048, "quoteMaxToken": 5000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/ERNIE-4.0-Turbo-8K.json b/packages/service/core/ai/config/llm/ERNIE-4.0-Turbo-8K.json index dd81db52e..7ff86c06a 100644 --- a/packages/service/core/ai/config/llm/ERNIE-4.0-Turbo-8K.json +++ b/packages/service/core/ai/config/llm/ERNIE-4.0-Turbo-8K.json @@ -3,9 +3,6 @@ "model": "ERNIE-4.0-Turbo-8K", "name": "ERNIE-4.0-Turbo-8K", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 8000, "maxResponse": 2048, "quoteMaxToken": 5000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/ERNIE-Lite-8K.json b/packages/service/core/ai/config/llm/ERNIE-Lite-8K.json index 5288e690e..492ccda11 100644 --- a/packages/service/core/ai/config/llm/ERNIE-Lite-8K.json +++ b/packages/service/core/ai/config/llm/ERNIE-Lite-8K.json @@ -3,9 +3,6 @@ "model": "ERNIE-Lite-8K", "name": "ERNIE-lite-8k", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 8000, "maxResponse": 2048, "quoteMaxToken": 6000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/ERNIE-Speed-128K.json b/packages/service/core/ai/config/llm/ERNIE-Speed-128K.json index 6765e5acc..76555c3d4 100644 --- a/packages/service/core/ai/config/llm/ERNIE-Speed-128K.json +++ b/packages/service/core/ai/config/llm/ERNIE-Speed-128K.json @@ -1,10 +1,7 @@ { "provider": "Ernie", "model": "ERNIE-Speed-128K", - "name": "ERNIE-Speed-128K(测试)", - - "censor": false, - "charsPointsPrice": 0, + "name": "ERNIE-Speed-128K", "maxContext": 128000, "maxResponse": 4096, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/MiniMax-Text-01.json b/packages/service/core/ai/config/llm/MiniMax-Text-01.json index 9d5ae20b4..54f3f0b91 100644 --- a/packages/service/core/ai/config/llm/MiniMax-Text-01.json +++ b/packages/service/core/ai/config/llm/MiniMax-Text-01.json @@ -3,9 +3,6 @@ "model": "MiniMax-Text-01", "name": "MiniMax-Text-01", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 1000000, "maxResponse": 1000000, "quoteMaxToken": 100000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/SparkDesk-lite.json b/packages/service/core/ai/config/llm/SparkDesk-lite.json new file mode 100644 index 000000000..e55497357 --- /dev/null +++ b/packages/service/core/ai/config/llm/SparkDesk-lite.json @@ -0,0 +1,20 @@ +{ + "provider": "SparkDesk", + "model": "lite", + "name": "SparkDesk-lite", + "maxContext": 32000, + "maxResponse": 4000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/SparkDesk-max-32k.json b/packages/service/core/ai/config/llm/SparkDesk-max-32k.json new file mode 100644 index 000000000..74bd46ea1 --- /dev/null +++ b/packages/service/core/ai/config/llm/SparkDesk-max-32k.json @@ -0,0 +1,26 @@ +{ + "provider": "SparkDesk", + "model": "max-32k", + "name": "SparkDesk-max-32k", + + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": false, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/SparkDesk-max.json b/packages/service/core/ai/config/llm/SparkDesk-max.json new file mode 100644 index 000000000..41b55201e --- /dev/null +++ b/packages/service/core/ai/config/llm/SparkDesk-max.json @@ -0,0 +1,20 @@ +{ + "provider": "SparkDesk", + "model": "generalv3.5", + "name": "SparkDesk-max", + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/SparkDesk-pro-128k.json b/packages/service/core/ai/config/llm/SparkDesk-pro-128k.json new file mode 100644 index 000000000..86567a8c7 --- /dev/null +++ b/packages/service/core/ai/config/llm/SparkDesk-pro-128k.json @@ -0,0 +1,20 @@ +{ + "provider": "SparkDesk", + "model": "pro-128k", + "name": "SparkDesk-Pro-128k", + "maxContext": 128000, + "maxResponse": 4000, + "quoteMaxToken": 128000, + "maxTemperature": 1, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/SparkDesk-v3.5.json b/packages/service/core/ai/config/llm/SparkDesk-pro.json similarity index 70% rename from packages/service/core/ai/config/llm/SparkDesk-v3.5.json rename to packages/service/core/ai/config/llm/SparkDesk-pro.json index f4fec9f0f..524cc35ca 100644 --- a/packages/service/core/ai/config/llm/SparkDesk-v3.5.json +++ b/packages/service/core/ai/config/llm/SparkDesk-pro.json @@ -1,15 +1,13 @@ { "provider": "SparkDesk", - "model": "SparkDesk-v3.5", - "name": "SparkDesk-v3.5", + "model": "generalv3", + "name": "SparkDesk-Pro", "maxContext": 8000, "maxResponse": 8000, - "quoteMaxToken": 6000, + "quoteMaxToken": 8000, "maxTemperature": 1, - "charsPointsPrice": 0.3, - "censor": false, "vision": false, - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "usedInExtractFields": true, "usedInToolCall": true, diff --git a/packages/service/core/ai/config/llm/SparkDesk-v4.0.json b/packages/service/core/ai/config/llm/SparkDesk-v4.0.json index 49416ee41..75577d820 100644 --- a/packages/service/core/ai/config/llm/SparkDesk-v4.0.json +++ b/packages/service/core/ai/config/llm/SparkDesk-v4.0.json @@ -1,14 +1,11 @@ { "provider": "SparkDesk", - "model": "SparkDesk-v4.0", - "name": "SparkDesk-v4.0", - - "censor": false, - "charsPointsPrice": 0, + "model": "4.0Ultra", + "name": "SparkDesk-v4.0 Ultra", "maxContext": 8000, "maxResponse": 8000, - "quoteMaxToken": 6000, + "quoteMaxToken": 8000, "maxTemperature": 1, "vision": false, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/abab6.5s-chat.json b/packages/service/core/ai/config/llm/abab6.5s-chat.json index d9decfc0f..53c82cc90 100644 --- a/packages/service/core/ai/config/llm/abab6.5s-chat.json +++ b/packages/service/core/ai/config/llm/abab6.5s-chat.json @@ -3,9 +3,6 @@ "model": "abab6.5s-chat", "name": "MiniMax-abab6.5s", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 245000, "maxResponse": 10000, "quoteMaxToken": 240000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/claude-3-5-haiku-20241022.json b/packages/service/core/ai/config/llm/claude-3-5-haiku-20241022.json index a775495da..27f8f7a0d 100644 --- a/packages/service/core/ai/config/llm/claude-3-5-haiku-20241022.json +++ b/packages/service/core/ai/config/llm/claude-3-5-haiku-20241022.json @@ -3,9 +3,6 @@ "model": "claude-3-5-haiku-20241022", "name": "claude-3-5-haiku-20241022", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 200000, "maxResponse": 8000, "quoteMaxToken": 100000, diff --git a/packages/service/core/ai/config/llm/claude-3-5-sonnet-20240620.json b/packages/service/core/ai/config/llm/claude-3-5-sonnet-20240620.json index dc4e6f002..950d699f2 100644 --- a/packages/service/core/ai/config/llm/claude-3-5-sonnet-20240620.json +++ b/packages/service/core/ai/config/llm/claude-3-5-sonnet-20240620.json @@ -3,9 +3,6 @@ "model": "claude-3-5-sonnet-20240620", "name": "Claude-3-5-sonnet-20240620", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 200000, "maxResponse": 8000, "quoteMaxToken": 100000, diff --git a/packages/service/core/ai/config/llm/claude-3-5-sonnet-20241022.json b/packages/service/core/ai/config/llm/claude-3-5-sonnet-20241022.json index 5b0dca6d6..7bd9cad45 100644 --- a/packages/service/core/ai/config/llm/claude-3-5-sonnet-20241022.json +++ b/packages/service/core/ai/config/llm/claude-3-5-sonnet-20241022.json @@ -3,9 +3,6 @@ "model": "claude-3-5-sonnet-20241022", "name": "Claude-3-5-sonnet-20241022", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 200000, "maxResponse": 8000, "quoteMaxToken": 100000, diff --git a/packages/service/core/ai/config/llm/claude-3-opus-20240229.json b/packages/service/core/ai/config/llm/claude-3-opus-20240229.json index e088b6302..f361d5084 100644 --- a/packages/service/core/ai/config/llm/claude-3-opus-20240229.json +++ b/packages/service/core/ai/config/llm/claude-3-opus-20240229.json @@ -3,9 +3,6 @@ "model": "claude-3-opus-20240229", "name": "claude-3-opus-20240229", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 200000, "maxResponse": 4096, "quoteMaxToken": 100000, diff --git a/packages/service/core/ai/config/llm/deepseek-chat.json b/packages/service/core/ai/config/llm/deepseek-chat.json index 729387e16..3e80722a3 100644 --- a/packages/service/core/ai/config/llm/deepseek-chat.json +++ b/packages/service/core/ai/config/llm/deepseek-chat.json @@ -3,9 +3,6 @@ "model": "deepseek-chat", "name": "Deepseek-chat", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 64000, "maxResponse": 4096, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/deepseek-reasoner.json b/packages/service/core/ai/config/llm/deepseek-reasoner.json index 3971afff8..782b65a27 100644 --- a/packages/service/core/ai/config/llm/deepseek-reasoner.json +++ b/packages/service/core/ai/config/llm/deepseek-reasoner.json @@ -3,9 +3,6 @@ "model": "deepseek-reasoner", "name": "Deepseek-reasoner", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 64000, "maxResponse": 4096, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/gemini-1.5-flash.json b/packages/service/core/ai/config/llm/gemini-1.5-flash.json index 597e625e6..f01b2497c 100644 --- a/packages/service/core/ai/config/llm/gemini-1.5-flash.json +++ b/packages/service/core/ai/config/llm/gemini-1.5-flash.json @@ -3,9 +3,6 @@ "model": "gemini-1.5-flash", "name": "Gemini-1.5-flash", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 1000000, "maxResponse": 8000, "quoteMaxToken": 60000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/gemini-1.5-pro.json b/packages/service/core/ai/config/llm/gemini-1.5-pro.json index ed9489d59..2255259be 100644 --- a/packages/service/core/ai/config/llm/gemini-1.5-pro.json +++ b/packages/service/core/ai/config/llm/gemini-1.5-pro.json @@ -3,9 +3,6 @@ "model": "gemini-1.5-pro", "name": "Gemini-1.5-pro", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 2000000, "maxResponse": 8000, "quoteMaxToken": 60000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/gemini-2.0-flash-exp.json b/packages/service/core/ai/config/llm/gemini-2.0-flash-exp.json index a55f83b4a..0697f35d2 100644 --- a/packages/service/core/ai/config/llm/gemini-2.0-flash-exp.json +++ b/packages/service/core/ai/config/llm/gemini-2.0-flash-exp.json @@ -3,9 +3,6 @@ "model": "gemini-2.0-flash-exp", "name": "Gemini-2.0-flash-exp", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 1000000, "maxResponse": 8000, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/gemini-2.0-flash-thinking-exp.json b/packages/service/core/ai/config/llm/gemini-2.0-flash-thinking-exp.json index 13e563852..c0287ee87 100644 --- a/packages/service/core/ai/config/llm/gemini-2.0-flash-thinking-exp.json +++ b/packages/service/core/ai/config/llm/gemini-2.0-flash-thinking-exp.json @@ -3,9 +3,6 @@ "model": "gemini-2.0-flash-thinking-exp-01-21", "name": "Gemini-2.0-flash-thinking-exp", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 1000000, "maxResponse": 8000, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/gemini-exp-1206.json b/packages/service/core/ai/config/llm/gemini-exp-1206.json index d5ba89541..3702c04bd 100644 --- a/packages/service/core/ai/config/llm/gemini-exp-1206.json +++ b/packages/service/core/ai/config/llm/gemini-exp-1206.json @@ -3,9 +3,6 @@ "model": "gemini-exp-1206", "name": "gemini-exp-1206", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 8000, "quoteMaxToken": 120000, diff --git a/packages/service/core/ai/config/llm/glm-4-air.json b/packages/service/core/ai/config/llm/glm-4-air.json index d6dde05af..52792a3b6 100644 --- a/packages/service/core/ai/config/llm/glm-4-air.json +++ b/packages/service/core/ai/config/llm/glm-4-air.json @@ -3,9 +3,6 @@ "model": "glm-4-air", "name": "glm-4-air", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/glm-4-flash.json b/packages/service/core/ai/config/llm/glm-4-flash.json index f1fd0a610..f68338fb6 100644 --- a/packages/service/core/ai/config/llm/glm-4-flash.json +++ b/packages/service/core/ai/config/llm/glm-4-flash.json @@ -3,9 +3,6 @@ "model": "glm-4-flash", "name": "glm-4-flash", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/glm-4-long.json b/packages/service/core/ai/config/llm/glm-4-long.json index 623cde0f9..15d6fa36b 100644 --- a/packages/service/core/ai/config/llm/glm-4-long.json +++ b/packages/service/core/ai/config/llm/glm-4-long.json @@ -3,9 +3,6 @@ "model": "glm-4-long", "name": "glm-4-long", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 1000000, "maxResponse": 4000, "quoteMaxToken": 900000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/glm-4-plus.json b/packages/service/core/ai/config/llm/glm-4-plus.json index a040cd9db..7c87b9be6 100644 --- a/packages/service/core/ai/config/llm/glm-4-plus.json +++ b/packages/service/core/ai/config/llm/glm-4-plus.json @@ -3,9 +3,6 @@ "model": "glm-4-plus", "name": "GLM-4-plus", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/glm-4v-flash.json b/packages/service/core/ai/config/llm/glm-4v-flash.json index 262d39eb2..b22035c6b 100644 --- a/packages/service/core/ai/config/llm/glm-4v-flash.json +++ b/packages/service/core/ai/config/llm/glm-4v-flash.json @@ -3,9 +3,6 @@ "model": "glm-4v-flash", "name": "glm-4v-flash", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 8000, "maxResponse": 1000, "quoteMaxToken": 6000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/glm-4v-plus.json b/packages/service/core/ai/config/llm/glm-4v-plus.json index b4139bd72..c6d43ea3c 100644 --- a/packages/service/core/ai/config/llm/glm-4v-plus.json +++ b/packages/service/core/ai/config/llm/glm-4v-plus.json @@ -3,9 +3,6 @@ "model": "glm-4v-plus", "name": "GLM-4v-plus", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 8000, "maxResponse": 1000, "quoteMaxToken": 6000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/gpt-3.5-turbo.json b/packages/service/core/ai/config/llm/gpt-3.5-turbo.json index 09ad72967..28f49c1cd 100644 --- a/packages/service/core/ai/config/llm/gpt-3.5-turbo.json +++ b/packages/service/core/ai/config/llm/gpt-3.5-turbo.json @@ -1,10 +1,7 @@ { "provider": "OpenAI", "model": "gpt-3.5-turbo", - "name": "gpt-3.5-turbo(abandon)", - - "censor": true, - "charsPointsPrice": 1, + "name": "gpt-3.5-turbo", "maxContext": 16000, "maxResponse": 4000, @@ -16,15 +13,11 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": true, - - "defaultConfig": { - "max_tokens": null - } + "usedInToolCall": true } diff --git a/packages/service/core/ai/config/llm/gpt-4-turbo.json b/packages/service/core/ai/config/llm/gpt-4-turbo.json index 316eb21a7..4a75e5aeb 100644 --- a/packages/service/core/ai/config/llm/gpt-4-turbo.json +++ b/packages/service/core/ai/config/llm/gpt-4-turbo.json @@ -1,12 +1,9 @@ { "provider": "OpenAI", "model": "gpt-4-turbo", - "name": "gpt-4-turbo(abandon)", + "name": "gpt-4-turbo", - "censor": true, - "charsPointsPrice": 15, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 60000, "maxTemperature": 1.2, @@ -16,15 +13,11 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": true, - - "defaultConfig": { - "max_tokens": null - } + "usedInToolCall": true } diff --git a/packages/service/core/ai/config/llm/gpt-4o-mini.json b/packages/service/core/ai/config/llm/gpt-4o-mini.json index a3e2a7b41..1a70d53de 100644 --- a/packages/service/core/ai/config/llm/gpt-4o-mini.json +++ b/packages/service/core/ai/config/llm/gpt-4o-mini.json @@ -3,10 +3,7 @@ "model": "gpt-4o-mini", "name": "GPT-4o-mini", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 16000, "quoteMaxToken": 60000, "maxTemperature": 1.2, diff --git a/packages/service/core/ai/config/llm/gpt-4o.json b/packages/service/core/ai/config/llm/gpt-4o.json index fc9ede2c8..8eed54e85 100644 --- a/packages/service/core/ai/config/llm/gpt-4o.json +++ b/packages/service/core/ai/config/llm/gpt-4o.json @@ -3,10 +3,7 @@ "model": "gpt-4o", "name": "GPT-4o", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 60000, "maxTemperature": 1.2, diff --git a/packages/service/core/ai/config/llm/groq-llama-3.1-8b-instant.json b/packages/service/core/ai/config/llm/groq-llama-3.1-8b-instant.json index 752c76df0..ab5e59773 100644 --- a/packages/service/core/ai/config/llm/groq-llama-3.1-8b-instant.json +++ b/packages/service/core/ai/config/llm/groq-llama-3.1-8b-instant.json @@ -3,10 +3,7 @@ "model": "llama-3.1-8b-instant", "name": "Groq-llama-3.1-8b-instant", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 8000, "quoteMaxToken": 60000, "maxTemperature": 1.2, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/groq-llama-3.3-70b-versatile copy.json b/packages/service/core/ai/config/llm/groq-llama-3.3-70b-versatile copy.json index 034b07924..ebf95b00e 100644 --- a/packages/service/core/ai/config/llm/groq-llama-3.3-70b-versatile copy.json +++ b/packages/service/core/ai/config/llm/groq-llama-3.3-70b-versatile copy.json @@ -3,10 +3,7 @@ "model": "llama-3.3-70b-versatile", "name": "Groq-llama-3.3-70b-versatile", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 8000, "quoteMaxToken": 60000, "maxTemperature": 1.2, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/hunyuan-large.json b/packages/service/core/ai/config/llm/hunyuan-large.json index 4dd4b5126..d038004fa 100644 --- a/packages/service/core/ai/config/llm/hunyuan-large.json +++ b/packages/service/core/ai/config/llm/hunyuan-large.json @@ -3,9 +3,6 @@ "model": "hunyuan-large", "name": "hunyuan-large", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 28000, "maxResponse": 4000, "quoteMaxToken": 20000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/hunyuan-lite.json b/packages/service/core/ai/config/llm/hunyuan-lite.json index b690783d4..1e63e08ba 100644 --- a/packages/service/core/ai/config/llm/hunyuan-lite.json +++ b/packages/service/core/ai/config/llm/hunyuan-lite.json @@ -3,9 +3,6 @@ "model": "hunyuan-lite", "name": "hunyuan-lite", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 250000, "maxResponse": 6000, "quoteMaxToken": 100000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/hunyuan-pro-32k.json b/packages/service/core/ai/config/llm/hunyuan-pro.json similarity index 79% rename from packages/service/core/ai/config/llm/hunyuan-pro-32k.json rename to packages/service/core/ai/config/llm/hunyuan-pro.json index 616a41839..474726214 100644 --- a/packages/service/core/ai/config/llm/hunyuan-pro-32k.json +++ b/packages/service/core/ai/config/llm/hunyuan-pro.json @@ -1,10 +1,7 @@ { "provider": "Hunyuan", - "model": "hunyuan-pro-32k(测试)", - "name": "hunyuan-pro-32k(测试)", - - "censor": false, - "charsPointsPrice": 0, + "model": "hunyuan-pro", + "name": "hunyuan-pro", "maxContext": 28000, "maxResponse": 4000, diff --git a/packages/service/core/ai/config/llm/hunyuan-standard.json b/packages/service/core/ai/config/llm/hunyuan-standard.json index d26b8a75b..41ba34c6d 100644 --- a/packages/service/core/ai/config/llm/hunyuan-standard.json +++ b/packages/service/core/ai/config/llm/hunyuan-standard.json @@ -3,10 +3,7 @@ "model": "hunyuan-standard", "name": "hunyuan-standard", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 30000, + "maxContext": 32000, "maxResponse": 2000, "quoteMaxToken": 20000, "maxTemperature": 1, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/hunyuan-turbo-vision.json b/packages/service/core/ai/config/llm/hunyuan-turbo-vision.json index c5f0072f8..340d1e125 100644 --- a/packages/service/core/ai/config/llm/hunyuan-turbo-vision.json +++ b/packages/service/core/ai/config/llm/hunyuan-turbo-vision.json @@ -3,9 +3,6 @@ "model": "hunyuan-turbo-vision", "name": "hunyuan-turbo-vision", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 6000, "maxResponse": 2000, "quoteMaxToken": 6000, @@ -16,13 +13,13 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, - "usedInClassify": false, + "datasetProcess": true, + "usedInClassify": true, "customCQPrompt": "", - "usedInExtractFields": false, - "usedInQueryExtension": false, + "usedInExtractFields": true, + "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/hunyuan-turbo.json b/packages/service/core/ai/config/llm/hunyuan-turbo.json index b3988923b..6039977c5 100644 --- a/packages/service/core/ai/config/llm/hunyuan-turbo.json +++ b/packages/service/core/ai/config/llm/hunyuan-turbo.json @@ -3,9 +3,6 @@ "model": "hunyuan-turbo", "name": "hunyuan-turbo", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 28000, "maxResponse": 4000, "quoteMaxToken": 20000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/hunyuan-vision.json b/packages/service/core/ai/config/llm/hunyuan-vision.json index 6d40cb493..ffc08ecfc 100644 --- a/packages/service/core/ai/config/llm/hunyuan-vision.json +++ b/packages/service/core/ai/config/llm/hunyuan-vision.json @@ -3,9 +3,6 @@ "model": "hunyuan-vision", "name": "hunyuan-vision", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 6000, "maxResponse": 2000, "quoteMaxToken": 4000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/internlm2-pro-chat.json b/packages/service/core/ai/config/llm/internlm2-pro-chat.json new file mode 100644 index 000000000..2128f68fb --- /dev/null +++ b/packages/service/core/ai/config/llm/internlm2-pro-chat.json @@ -0,0 +1,26 @@ +{ + "provider": "Intern", + "model": "internlm2-pro-chat", + "name": "internlm2-pro-chat", + + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/internlm3-8b-instruct.json b/packages/service/core/ai/config/llm/internlm3-8b-instruct.json new file mode 100644 index 000000000..53acf23a7 --- /dev/null +++ b/packages/service/core/ai/config/llm/internlm3-8b-instruct.json @@ -0,0 +1,26 @@ +{ + "provider": "Intern", + "model": "internlm3-8b-instruct", + "name": "internlm3-8b-instruct", + + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/ministral-3b-latest.json b/packages/service/core/ai/config/llm/ministral-3b-latest.json index 1df50de9a..395113bd1 100644 --- a/packages/service/core/ai/config/llm/ministral-3b-latest.json +++ b/packages/service/core/ai/config/llm/ministral-3b-latest.json @@ -3,9 +3,6 @@ "model": "ministral-3b-latest", "name": "Ministral-3b-latest", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 130000, "maxResponse": 8000, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/ministral-8b-latest.json b/packages/service/core/ai/config/llm/ministral-8b-latest.json index 3186d2f78..a9841d84a 100644 --- a/packages/service/core/ai/config/llm/ministral-8b-latest.json +++ b/packages/service/core/ai/config/llm/ministral-8b-latest.json @@ -3,9 +3,6 @@ "model": "ministral-8b-latest", "name": "Ministral-8b-latest", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 130000, "maxResponse": 8000, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/mistral-large-latest.json b/packages/service/core/ai/config/llm/mistral-large-latest.json index 3ae60d526..3a627d57a 100644 --- a/packages/service/core/ai/config/llm/mistral-large-latest.json +++ b/packages/service/core/ai/config/llm/mistral-large-latest.json @@ -3,9 +3,6 @@ "model": "mistral-large-latest", "name": "Mistral-large-latest", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 130000, "maxResponse": 8000, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/mistral-small-latest.json b/packages/service/core/ai/config/llm/mistral-small-latest.json index 238d40695..f28fc06ea 100644 --- a/packages/service/core/ai/config/llm/mistral-small-latest.json +++ b/packages/service/core/ai/config/llm/mistral-small-latest.json @@ -3,12 +3,9 @@ "model": "mistral-small-latest", "name": "Mistral-small-latest", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 32000, "maxResponse": 4000, - "quoteMaxToken": 30000, + "quoteMaxToken": 32000, "maxTemperature": 1.2, "vision": false, diff --git a/packages/service/core/ai/config/llm/moonshot-v1-128k.json b/packages/service/core/ai/config/llm/moonshot-v1-128k.json index 80236fb46..50d144cc3 100644 --- a/packages/service/core/ai/config/llm/moonshot-v1-128k.json +++ b/packages/service/core/ai/config/llm/moonshot-v1-128k.json @@ -1,10 +1,7 @@ { "provider": "Moonshot", "model": "moonshot-v1-128k", - "name": "月之暗面-128k", - - "censor": false, - "charsPointsPrice": 0, + "name": "moonshot-v1-128k", "maxContext": 128000, "maxResponse": 4000, @@ -22,7 +19,7 @@ "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/moonshot-v1-32k.json b/packages/service/core/ai/config/llm/moonshot-v1-32k.json index 18ca06da3..dc6f0f4bc 100644 --- a/packages/service/core/ai/config/llm/moonshot-v1-32k.json +++ b/packages/service/core/ai/config/llm/moonshot-v1-32k.json @@ -1,14 +1,11 @@ { "provider": "Moonshot", "model": "moonshot-v1-32k", - "name": "月之暗面-32k", - - "censor": false, - "charsPointsPrice": 0, + "name": "moonshot-v1-32k", "maxContext": 32000, "maxResponse": 4000, - "quoteMaxToken": 30000, + "quoteMaxToken": 32000, "maxTemperature": 1, "vision": false, @@ -22,7 +19,7 @@ "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/moonshot-v1-8k.json b/packages/service/core/ai/config/llm/moonshot-v1-8k.json index ebd92f45f..56b75a2df 100644 --- a/packages/service/core/ai/config/llm/moonshot-v1-8k.json +++ b/packages/service/core/ai/config/llm/moonshot-v1-8k.json @@ -1,10 +1,7 @@ { "provider": "Moonshot", "model": "moonshot-v1-8k", - "name": "月之暗面-8k", - - "censor": false, - "charsPointsPrice": 0, + "name": "moonshot-v1-8k", "maxContext": 8000, "maxResponse": 4000, @@ -16,13 +13,13 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/o1-mini.json b/packages/service/core/ai/config/llm/o1-mini.json index c859f9076..aa8a4f809 100644 --- a/packages/service/core/ai/config/llm/o1-mini.json +++ b/packages/service/core/ai/config/llm/o1-mini.json @@ -3,10 +3,7 @@ "model": "o1-mini", "name": "o1-mini", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, "maxTemperature": 1.2, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/o1-preview.json b/packages/service/core/ai/config/llm/o1-preview.json index 9b65d18ec..c13b7d525 100644 --- a/packages/service/core/ai/config/llm/o1-preview.json +++ b/packages/service/core/ai/config/llm/o1-preview.json @@ -3,10 +3,7 @@ "model": "o1-preview", "name": "o1-preview", - "censor": false, - "charsPointsPrice": 0, - - "maxContext": 125000, + "maxContext": 128000, "maxResponse": 4000, "quoteMaxToken": 120000, "maxTemperature": 1.2, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/o1.json b/packages/service/core/ai/config/llm/o1.json index 6fbcfe227..35d5ec0c1 100644 --- a/packages/service/core/ai/config/llm/o1.json +++ b/packages/service/core/ai/config/llm/o1.json @@ -3,9 +3,6 @@ "model": "o1", "name": "o1", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 195000, "maxResponse": 8000, "quoteMaxToken": 120000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/qwen-coder-turbo.json b/packages/service/core/ai/config/llm/qwen-coder-turbo.json index 48491c157..e9e9f9f05 100644 --- a/packages/service/core/ai/config/llm/qwen-coder-turbo.json +++ b/packages/service/core/ai/config/llm/qwen-coder-turbo.json @@ -3,9 +3,6 @@ "model": "qwen-coder-turbo", "name": "qwen-coder-turbo", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 8000, "quoteMaxToken": 50000, @@ -16,13 +13,13 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, - "usedInClassify": false, + "datasetProcess": true, + "usedInClassify": true, "customCQPrompt": "", - "usedInExtractFields": false, - "usedInQueryExtension": false, + "usedInExtractFields": true, + "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/qwen-max.json b/packages/service/core/ai/config/llm/qwen-max.json index d9894c06f..e48740535 100644 --- a/packages/service/core/ai/config/llm/qwen-max.json +++ b/packages/service/core/ai/config/llm/qwen-max.json @@ -3,9 +3,6 @@ "model": "qwen-max", "name": "Qwen-max", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 8000, "maxResponse": 4000, "quoteMaxToken": 6000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/qwen-plus.json b/packages/service/core/ai/config/llm/qwen-plus.json index 43461ab11..95a901529 100644 --- a/packages/service/core/ai/config/llm/qwen-plus.json +++ b/packages/service/core/ai/config/llm/qwen-plus.json @@ -3,9 +3,6 @@ "model": "qwen-plus", "name": "Qwen-plus", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 64000, "maxResponse": 8000, "quoteMaxToken": 60000, diff --git a/packages/service/core/ai/config/llm/qwen-turbo.json b/packages/service/core/ai/config/llm/qwen-turbo.json index a7fcef65c..f3e5bc143 100644 --- a/packages/service/core/ai/config/llm/qwen-turbo.json +++ b/packages/service/core/ai/config/llm/qwen-turbo.json @@ -3,9 +3,6 @@ "model": "qwen-turbo", "name": "Qwen-turbo", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 128000, "maxResponse": 8000, "quoteMaxToken": 100000, diff --git a/packages/service/core/ai/config/llm/qwen-vl-max.json b/packages/service/core/ai/config/llm/qwen-vl-max.json index f040f18f9..4474ec2c3 100644 --- a/packages/service/core/ai/config/llm/qwen-vl-max.json +++ b/packages/service/core/ai/config/llm/qwen-vl-max.json @@ -3,9 +3,6 @@ "model": "qwen-vl-max", "name": "qwen-vl-max", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 32000, "maxResponse": 2000, "quoteMaxToken": 20000, @@ -16,13 +13,13 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, - "usedInClassify": false, + "datasetProcess": true, + "usedInClassify": true, "customCQPrompt": "", - "usedInExtractFields": false, - "usedInQueryExtension": false, + "usedInExtractFields": true, + "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false, + "usedInToolCall": true, "defaultConfig": {}, "fieldMap": {} diff --git a/packages/service/core/ai/config/llm/qwen-vl-plus.json b/packages/service/core/ai/config/llm/qwen-vl-plus.json index 7796d0d8b..700988627 100644 --- a/packages/service/core/ai/config/llm/qwen-vl-plus.json +++ b/packages/service/core/ai/config/llm/qwen-vl-plus.json @@ -3,9 +3,6 @@ "model": "qwen-vl-plus", "name": "qwen-vl-plus", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 32000, "maxResponse": 2000, "quoteMaxToken": 20000, @@ -16,11 +13,11 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, - "usedInClassify": false, + "datasetProcess": true, + "usedInClassify": true, "customCQPrompt": "", - "usedInExtractFields": false, - "usedInQueryExtension": false, + "usedInExtractFields": true, + "usedInQueryExtension": true, "customExtractPrompt": "", - "usedInToolCall": false + "usedInToolCall": true } diff --git a/packages/service/core/ai/config/llm/qwen2.5-14b-instruct.json b/packages/service/core/ai/config/llm/qwen2.5-14b-instruct.json index e1825c030..3ac48e54a 100644 --- a/packages/service/core/ai/config/llm/qwen2.5-14b-instruct.json +++ b/packages/service/core/ai/config/llm/qwen2.5-14b-instruct.json @@ -1,10 +1,7 @@ { "provider": "Qwen", "model": "qwen2.5-14b-instruct", - "name": "qwen2.5-14b-128k", - - "censor": false, - "charsPointsPrice": 0, + "name": "qwen2.5-14b-instruct", "maxContext": 128000, "maxResponse": 8000, diff --git a/packages/service/core/ai/config/llm/qwen2.5-32b-instruct.json b/packages/service/core/ai/config/llm/qwen2.5-32b-instruct.json index b0c8a0498..add3479dd 100644 --- a/packages/service/core/ai/config/llm/qwen2.5-32b-instruct.json +++ b/packages/service/core/ai/config/llm/qwen2.5-32b-instruct.json @@ -1,10 +1,7 @@ { "provider": "Qwen", "model": "qwen2.5-32b-instruct", - "name": "qwen2.5-32b-128k", - - "censor": false, - "charsPointsPrice": 0, + "name": "qwen2.5-32b-instruct", "maxContext": 128000, "maxResponse": 8000, diff --git a/packages/service/core/ai/config/llm/qwen2.5-72b-instruct.json b/packages/service/core/ai/config/llm/qwen2.5-72b-instruct.json index 9b9e0e40b..b04e62045 100644 --- a/packages/service/core/ai/config/llm/qwen2.5-72b-instruct.json +++ b/packages/service/core/ai/config/llm/qwen2.5-72b-instruct.json @@ -1,10 +1,7 @@ { "provider": "Qwen", "model": "qwen2.5-72b-instruct", - "name": "Qwen2.5-72B-128k", - - "censor": false, - "charsPointsPrice": 0, + "name": "Qwen2.5-72B-instruct", "maxContext": 128000, "maxResponse": 8000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/qwen2.5-7b-instruct.json b/packages/service/core/ai/config/llm/qwen2.5-7b-instruct.json new file mode 100644 index 000000000..c68ab80ea --- /dev/null +++ b/packages/service/core/ai/config/llm/qwen2.5-7b-instruct.json @@ -0,0 +1,26 @@ +{ + "provider": "Qwen", + "model": "qwen2.5-7b-instruct", + "name": "qwen2.5-7b-instruct", + + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 50000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/siliconflow-Qwen2-VL-72B-Instruct.json b/packages/service/core/ai/config/llm/siliconflow-Qwen2-VL-72B-Instruct.json new file mode 100644 index 000000000..82ee180c8 --- /dev/null +++ b/packages/service/core/ai/config/llm/siliconflow-Qwen2-VL-72B-Instruct.json @@ -0,0 +1,22 @@ +{ + "provider": "Siliconflow", + "model": "Qwen/Qwen2-VL-72B-Instruct", + "name": "Qwen/Qwen2-VL-72B-Instruct", + "maxContext": 32000, + "maxResponse": 4000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + "charsPointsPrice": 0, + "censor": false, + "vision": true, + "datasetProcess": false, + "usedInClassify": false, + "usedInExtractFields": false, + "usedInToolCall": false, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": {} +} diff --git a/packages/service/core/ai/config/llm/siliconflow-deepseek-v2.5.json b/packages/service/core/ai/config/llm/siliconflow-deepseek-v2.5.json new file mode 100644 index 000000000..69fd77e70 --- /dev/null +++ b/packages/service/core/ai/config/llm/siliconflow-deepseek-v2.5.json @@ -0,0 +1,26 @@ +{ + "provider": "Siliconflow", + "model": "deepseek-ai/DeepSeek-V2.5", + "name": "deepseek-ai/DeepSeek-V2.5", + + "maxContext": 32000, + "maxResponse": 4000, + "quoteMaxToken": 32000, + "maxTemperature": 1, + + "vision": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/siliconflow-qwen2.5-72b-instruct.json b/packages/service/core/ai/config/llm/siliconflow-qwen2.5-72b-instruct.json new file mode 100644 index 000000000..48f13a039 --- /dev/null +++ b/packages/service/core/ai/config/llm/siliconflow-qwen2.5-72b-instruct.json @@ -0,0 +1,26 @@ +{ + "provider": "Siliconflow", + "model": "Qwen/Qwen2.5-72B-Instruct", + "name": "Qwen/Qwen2.5-72B-Instruct", + + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 50000, + "maxTemperature": 1, + + "vision": false, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + + "defaultConfig": {}, + "fieldMap": {} +} diff --git a/packages/service/core/ai/config/llm/step-1-128k.json b/packages/service/core/ai/config/llm/step-1-128k.json new file mode 100644 index 000000000..ed5c5e931 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1-128k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1-128k", + "name": "step-1-128k", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 128000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1-256k.json b/packages/service/core/ai/config/llm/step-1-256k.json new file mode 100644 index 000000000..4d13c2813 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1-256k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1-256k", + "name": "step-1-256k", + "maxContext": 256000, + "maxResponse": 8000, + "quoteMaxToken": 256000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1-32k.json b/packages/service/core/ai/config/llm/step-1-32k.json new file mode 100644 index 000000000..6172becab --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1-32k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1-32k", + "name": "step-1-32k", + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 32000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1-8k.json b/packages/service/core/ai/config/llm/step-1-8k.json new file mode 100644 index 000000000..0d2c5cac7 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1-8k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1-8k", + "name": "step-1-8k", + "maxContext": 8000, + "maxResponse": 8000, + "quoteMaxToken": 8000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1-flash.json b/packages/service/core/ai/config/llm/step-1-flash.json new file mode 100644 index 000000000..ffeabc0b2 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1-flash.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1-flash", + "name": "step-1-flash", + "maxContext": 8000, + "maxResponse": 4000, + "quoteMaxToken": 6000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1o-vision-32k.json b/packages/service/core/ai/config/llm/step-1o-vision-32k.json new file mode 100644 index 000000000..b3252ed01 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1o-vision-32k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1o-vision-32k", + "name": "step-1o-vision-32k", + "maxContext": 32000, + "quoteMaxToken": 32000, + "maxResponse": 8000, + "maxTemperature": 2, + "vision": true, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1v-32k.json b/packages/service/core/ai/config/llm/step-1v-32k.json new file mode 100644 index 000000000..5f50ff191 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1v-32k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1v-32k", + "name": "step-1v-32k", + "maxContext": 32000, + "quoteMaxToken": 32000, + "maxResponse": 8000, + "maxTemperature": 2, + "vision": true, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-1v-8k.json b/packages/service/core/ai/config/llm/step-1v-8k.json new file mode 100644 index 000000000..967a06960 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-1v-8k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-1v-8k", + "name": "step-1v-8k", + "maxContext": 8000, + "maxResponse": 8000, + "quoteMaxToken": 8000, + "maxTemperature": 2, + "vision": true, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-2-16k-exp.json b/packages/service/core/ai/config/llm/step-2-16k-exp.json new file mode 100644 index 000000000..985a2a2f9 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-2-16k-exp.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-2-16k-exp", + "name": "step-2-16k-exp", + "maxContext": 16000, + "maxResponse": 4000, + "quoteMaxToken": 4000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-2-16k.json b/packages/service/core/ai/config/llm/step-2-16k.json new file mode 100644 index 000000000..22e413347 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-2-16k.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-2-16k", + "name": "step-2-16k", + "maxContext": 16000, + "maxResponse": 4000, + "quoteMaxToken": 4000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/step-2-mini.json b/packages/service/core/ai/config/llm/step-2-mini.json new file mode 100644 index 000000000..3baaaa019 --- /dev/null +++ b/packages/service/core/ai/config/llm/step-2-mini.json @@ -0,0 +1,20 @@ +{ + "provider": "StepFun", + "model": "step-2-mini", + "name": "step-2-mini", + "maxContext": 8000, + "maxResponse": 4000, + "quoteMaxToken": 6000, + "maxTemperature": 2, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "" +} diff --git a/packages/service/core/ai/config/llm/yi-lightning.json b/packages/service/core/ai/config/llm/yi-lightning.json index 4584adc00..3f93984b6 100644 --- a/packages/service/core/ai/config/llm/yi-lightning.json +++ b/packages/service/core/ai/config/llm/yi-lightning.json @@ -3,9 +3,6 @@ "model": "yi-lightning", "name": "yi-lightning", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 16000, "maxResponse": 4000, "quoteMaxToken": 12000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/llm/yi-vision-v2.json b/packages/service/core/ai/config/llm/yi-vision-v2.json index f338388cd..493b6385a 100644 --- a/packages/service/core/ai/config/llm/yi-vision-v2.json +++ b/packages/service/core/ai/config/llm/yi-vision-v2.json @@ -3,9 +3,6 @@ "model": "yi-vision-v2", "name": "yi-vision-v2", - "censor": false, - "charsPointsPrice": 0, - "maxContext": 16000, "maxResponse": 4000, "quoteMaxToken": 12000, @@ -16,7 +13,7 @@ "functionCall": false, "defaultSystemChatPrompt": "", - "datasetProcess": false, + "datasetProcess": true, "usedInClassify": true, "customCQPrompt": "", "usedInExtractFields": true, diff --git a/packages/service/core/ai/config/tts/step-tts-mini.json b/packages/service/core/ai/config/tts/step-tts-mini.json new file mode 100644 index 000000000..688590f2a --- /dev/null +++ b/packages/service/core/ai/config/tts/step-tts-mini.json @@ -0,0 +1,84 @@ +{ + "provider": "StepFun", + "model": "step-tts-mini", + "name": "step-tts-mini", + "charsPointsPrice": 0, + "voices": [ + { + "label": "cixingnansheng", + "value": "cixingnansheng" + }, + { + "label": "zhengpaiqingnian", + "value": "zhengpaiqingnian" + }, + { + "label": "yuanqinansheng", + "value": "yuanqinansheng" + }, + { + "label": "qingniandaxuesheng", + "value": "qingniandaxuesheng" + }, + { + "label": "boyinnansheng", + "value": "boyinnansheng" + }, + { + "label": "ruyananshi", + "value": "ruyananshi" + }, + { + "label": "shenchennanyin", + "value": "shenchennanyin" + }, + { + "label": "qinqienvsheng", + "value": "qinqienvsheng" + }, + { + "label": "wenrounvsheng", + "value": "wenrounvsheng" + }, + { + "label": "jilingshaonv", + "value": "jilingshaonv" + }, + { + "label": "yuanqishaonv", + "value": "yuanqishaonv" + }, + { + "label": "ruanmengnvsheng", + "value": "ruanmengnvsheng" + }, + { + "label": "youyanvsheng", + "value": "youyanvsheng" + }, + { + "label": "lengyanyujie", + "value": "lengyanyujie" + }, + { + "label": "shuangkuaijiejie", + "value": "shuangkuaijiejie" + }, + { + "label": "wenjingxuejie", + "value": "wenjingxuejie" + }, + { + "label": "linjiajiejie", + "value": "linjiajiejie" + }, + { + "label": "linjiameimei", + "value": "linjiameimei" + }, + { + "label": "zhixingjiejie", + "value": "zhixingjiejie" + } + ] +} diff --git a/packages/service/core/ai/config/utils.ts b/packages/service/core/ai/config/utils.ts index eeb0daeb5..4f6f9973f 100644 --- a/packages/service/core/ai/config/utils.ts +++ b/packages/service/core/ai/config/utils.ts @@ -14,6 +14,11 @@ import { debounce } from 'lodash'; type FolderBaseType = `${ModelTypeEnum}`; +/* + TODO: 分优先级读取: + 1. 有外部挂载目录,则读取外部的 + 2. 没有外部挂载目录,则读取本地的。然后试图拉取云端的进行覆盖。 +*/ export const loadSystemModels = async (init = false) => { const getModelNameList = (base: FolderBaseType) => { const currentFileUrl = new URL(import.meta.url); @@ -46,9 +51,7 @@ export const loadSystemModels = async (init = false) => { } }; - if (!init && global.systemModelList && global.systemModelList.length > 0) return; - - const dbModels = await MongoSystemModel.find({}).lean(); + if (!init && global.systemModelList) return; global.systemModelList = []; global.systemActiveModelList = []; @@ -58,50 +61,58 @@ export const loadSystemModels = async (init = false) => { global.sttModelMap = new Map(); global.reRankModelMap = new Map(); - const baseList: FolderBaseType[] = [ - ModelTypeEnum.llm, - ModelTypeEnum.embedding, - ModelTypeEnum.tts, - ModelTypeEnum.stt, - ModelTypeEnum.rerank - ]; + try { + const dbModels = await MongoSystemModel.find({}).lean(); - // System model - await Promise.all( - baseList.map(async (base) => { - const modelList = getModelNameList(base); - const nameList = modelList.map((name) => `${base}/${name}`); + const baseList: FolderBaseType[] = [ + ModelTypeEnum.llm, + ModelTypeEnum.embedding, + ModelTypeEnum.tts, + ModelTypeEnum.stt, + ModelTypeEnum.rerank + ]; - await Promise.all( - nameList.map(async (name) => { - const fileContent = (await import(`./${name}`))?.default as SystemModelItemType; + // System model + await Promise.all( + baseList.map(async (base) => { + const modelList = getModelNameList(base); + const nameList = modelList.map((name) => `${base}/${name}`); - const dbModel = dbModels.find((item) => item.model === fileContent.model); + await Promise.all( + nameList.map(async (name) => { + const fileContent = (await import(`./${name}`))?.default as SystemModelItemType; - const model: any = { - ...fileContent, - ...dbModel?.metadata, - type: dbModel?.metadata?.type || base, - isCustom: false - }; + const dbModel = dbModels.find((item) => item.model === fileContent.model); - pushModel(model); - }) - ); - }) - ); + const model: any = { + ...fileContent, + ...dbModel?.metadata, + type: dbModel?.metadata?.type || base, + isCustom: false + }; - // Custom model - dbModels.forEach((dbModel) => { - if (global.systemModelList.find((item) => item.model === dbModel.model)) return; + pushModel(model); + }) + ); + }) + ); - pushModel({ - ...dbModel.metadata, - isCustom: true + // Custom model + dbModels.forEach((dbModel) => { + if (global.systemModelList.find((item) => item.model === dbModel.model)) return; + + pushModel({ + ...dbModel.metadata, + isCustom: true + }); }); - }); - console.log('Load models success', JSON.stringify(global.systemActiveModelList, null, 2)); + console.log('Load models success', JSON.stringify(global.systemActiveModelList, null, 2)); + } catch (error) { + console.error('Load models error', error); + // @ts-ignore + global.systemModelList = undefined; + } }; export const watchSystemModelUpdate = () => { diff --git a/packages/service/core/ai/rerank/index.ts b/packages/service/core/ai/rerank/index.ts index e55455268..e43246959 100644 --- a/packages/service/core/ai/rerank/index.ts +++ b/packages/service/core/ai/rerank/index.ts @@ -1,6 +1,7 @@ import { addLog } from '../../../common/system/log'; import { POST } from '../../../common/api/serverRequest'; import { getFirstReRankModel } from '../model'; +import { getAxiosConfig } from '../config'; type PostReRankResponse = { id: string; @@ -24,9 +25,11 @@ export function reRankRecall({ return Promise.reject('no rerank model'); } + const { baseUrl, authorization } = getAxiosConfig({}); + let start = Date.now(); return POST( - model.requestUrl, + model.requestUrl ? model.requestUrl : `${baseUrl}/v1/rerank`, { model: model.model, query, @@ -34,7 +37,7 @@ export function reRankRecall({ }, { headers: { - Authorization: `Bearer ${model.requestAuth}` + Authorization: model.requestAuth ? model.requestAuth : authorization }, timeout: 30000 } diff --git a/packages/service/core/dataset/data/dataTextSchema.ts b/packages/service/core/dataset/data/dataTextSchema.ts index e0564ed2b..f23a7f7d0 100644 --- a/packages/service/core/dataset/data/dataTextSchema.ts +++ b/packages/service/core/dataset/data/dataTextSchema.ts @@ -33,7 +33,18 @@ const DatasetDataTextSchema = new Schema({ }); try { - DatasetDataTextSchema.index({ teamId: 1, datasetId: 1, fullTextToken: 'text' }); + DatasetDataTextSchema.index( + { teamId: 1, datasetId: 1, fullTextToken: 'text' }, + { + name: 'teamId_1_datasetId_1_fullTextToken_text', + default_language: 'none', + collation: { + locale: 'simple', // 使用简单匹配规则 + strength: 2, // 忽略大小写 + caseLevel: false // 进一步确保大小写不敏感 + } + } + ); DatasetDataTextSchema.index({ dataId: 1 }, { unique: true }); } catch (error) { console.log(error); diff --git a/packages/service/core/workflow/dispatch/chat/oneapi.ts b/packages/service/core/workflow/dispatch/chat/oneapi.ts index b37e204ee..23dccfe93 100644 --- a/packages/service/core/workflow/dispatch/chat/oneapi.ts +++ b/packages/service/core/workflow/dispatch/chat/oneapi.ts @@ -281,11 +281,12 @@ async function filterDatasetQuote({ }) { function getValue(item: SearchDataResponseItemType, index: number) { return replaceVariable(quoteTemplate || Prompt_QuoteTemplateList[0].value, { + id: item.id, q: item.q, a: item.a, updateTime: formatTime2YMDHM(item.updateTime), source: item.sourceName, - sourceId: String(item.sourceId || 'UnKnow'), + sourceId: String(item.sourceId || ''), index: index + 1 }); } diff --git a/packages/service/support/permission/dataset/auth.ts b/packages/service/support/permission/dataset/auth.ts index 08829fcf6..a1286619e 100644 --- a/packages/service/support/permission/dataset/auth.ts +++ b/packages/service/support/permission/dataset/auth.ts @@ -279,6 +279,7 @@ export async function authDatasetData({ return { ...result, - datasetData: data + datasetData: data, + collection: result.collection }; } diff --git a/packages/web/components/common/Icon/button.tsx b/packages/web/components/common/Icon/button.tsx index 9fde10ec4..b335a117a 100644 --- a/packages/web/components/common/Icon/button.tsx +++ b/packages/web/components/common/Icon/button.tsx @@ -1,12 +1,14 @@ import React from 'react'; import { Flex, FlexProps } from '@chakra-ui/react'; import MyIcon from './index'; +import MyTooltip from '../MyTooltip'; type Props = FlexProps & { icon: string; size?: string; onClick?: () => void; hoverColor?: string; + tip?: string; }; const MyIconButton = ({ @@ -14,26 +16,29 @@ const MyIconButton = ({ onClick, hoverColor = 'primary.600', size = '1rem', + tip, ...props }: Props) => { return ( - - - + + + + + ); }; diff --git a/packages/web/components/common/Icon/constants.ts b/packages/web/components/common/Icon/constants.ts index 4a34e0b54..291cabc07 100644 --- a/packages/web/components/common/Icon/constants.ts +++ b/packages/web/components/common/Icon/constants.ts @@ -374,6 +374,7 @@ export const iconPaths = { 'model/ernie': () => import('./icons/model/ernie.svg'), 'model/fishaudio': () => import('./icons/model/fishaudio.svg'), 'model/gemini': () => import('./icons/model/gemini.svg'), + 'model/grok': () => import('./icons/model/grok.svg'), 'model/groq': () => import('./icons/model/groq.svg'), 'model/huggingface': () => import('./icons/model/huggingface.svg'), 'model/hunyuan': () => import('./icons/model/hunyuan.svg'), diff --git a/packages/web/components/common/Icon/icons/modal/changePer.svg b/packages/web/components/common/Icon/icons/modal/changePer.svg index 8e5ad1ef2..eb1e9c633 100644 --- a/packages/web/components/common/Icon/icons/modal/changePer.svg +++ b/packages/web/components/common/Icon/icons/modal/changePer.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/web/components/common/Icon/icons/model/grok.svg b/packages/web/components/common/Icon/icons/model/grok.svg new file mode 100644 index 000000000..c32cf6c9f --- /dev/null +++ b/packages/web/components/common/Icon/icons/model/grok.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/packages/web/components/common/Icon/icons/model/stepfun.svg b/packages/web/components/common/Icon/icons/model/stepfun.svg index a78ebed2f..8b7fd0721 100644 --- a/packages/web/components/common/Icon/icons/model/stepfun.svg +++ b/packages/web/components/common/Icon/icons/model/stepfun.svg @@ -1 +1,29 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/web/i18n/en/account.json b/packages/web/i18n/en/account.json index 45a7bb341..d9526114d 100644 --- a/packages/web/i18n/en/account.json +++ b/packages/web/i18n/en/account.json @@ -51,12 +51,15 @@ "model.request_auth_tip": "When making a request to a custom request address, carry the request header: Authorization: Bearer xxx to make the request.", "model.request_url": "Custom url", "model.request_url_tip": "If this value is filled in, a request will be made directly to this address without going through OneAPI", + "model.test_model": "Model testing", "model.tool_choice": "Tool choice", + "model.tool_choice_tag": "ToolCall", "model.tool_choice_tip": "If the model supports tool calling, turn on this switch", "model.used_in_classify": "Used for problem classification", "model.used_in_extract_fields": "for text extraction", "model.used_in_tool_call": "Used for tool call nodes", "model.vision": "Vision model", + "model.vision_tag": "Vision", "model.vision_tip": "If the model supports image recognition, turn on this switch.", "model.voices": "voice role", "model.voices_tip": "Configure multiple through an array, for example:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]", diff --git a/packages/web/i18n/en/app.json b/packages/web/i18n/en/app.json index de29637fe..6ebf7368c 100644 --- a/packages/web/i18n/en/app.json +++ b/packages/web/i18n/en/app.json @@ -114,6 +114,7 @@ "setting_app": "Workflow", "setting_plugin": "Workflow", "simple_tool_tips": "This plugin contains special inputs and is not currently supported for invocation by simple applications.", + "source_updateTime": "Update time", "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.", "temperature": "Temperature", diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index cbceef926..99b8a6015 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -1010,6 +1010,7 @@ "plugin.go to laf": "Go to Write", "plugin.path": "Path", "prompt_input_placeholder": "Please enter the prompt word", + "read_quote": "View citations", "required": "Required", "resume_failed": "Resume Failed", "select_reference_variable": "Select Reference Variable", diff --git a/packages/web/i18n/en/workflow.json b/packages/web/i18n/en/workflow.json index 223dda9b5..5f7c2c7ac 100644 --- a/packages/web/i18n/en/workflow.json +++ b/packages/web/i18n/en/workflow.json @@ -133,7 +133,7 @@ "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_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{{id}} - the unique id of the reference data\n{{q}} - main content\n{{a}} - auxiliary data\n{{source}} - source name\n{{sourceId}} - source ID\n{{index}} - nth reference\n\nThey are all optional and the following are the default values:\n\n{{default}}", "quote_num": "Dataset", "quote_prompt_tip": "You can use {{quote}} to insert a quote content template and {{question}} to insert a question (Role=user).\n\nThe following are the default values:\n\n{{default}}", "quote_role_system_tip": "Please note that the {{question}} variable is removed from the \"Quote Template Prompt Words\"", diff --git a/packages/web/i18n/zh-CN/account.json b/packages/web/i18n/zh-CN/account.json index f86c22ea1..bfb0622eb 100644 --- a/packages/web/i18n/zh-CN/account.json +++ b/packages/web/i18n/zh-CN/account.json @@ -51,13 +51,16 @@ "model.request_auth_tip": "向自定义请求地址发起请求时候,携带请求头:Authorization: Bearer xxx 进行请求", "model.request_url": "自定义请求地址", "model.request_url_tip": "如果填写该值,则会直接向该地址发起请求,不经过 OneAPI", + "model.test_model": "模型测试", "model.tool_choice": "支持工具调用", + "model.tool_choice_tag": "工具调用", "model.tool_choice_tip": "如果该模型支持工具调用,则开启该开关", "model.used_in_classify": "用于问题分类", "model.used_in_extract_fields": "用于文本提取", "model.used_in_query_extension": "用于问题优化", "model.used_in_tool_call": "用于工具调用节点", "model.vision": "支持图片识别", + "model.vision_tag": "视觉", "model.vision_tip": "如果模型支持图片识别,则打开该开关。", "model.voices": "声音角色", "model.voices_tip": "通过一个数组配置多个,例如:\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]", diff --git a/packages/web/i18n/zh-CN/app.json b/packages/web/i18n/zh-CN/app.json index a87fb0234..23736ff46 100644 --- a/packages/web/i18n/zh-CN/app.json +++ b/packages/web/i18n/zh-CN/app.json @@ -114,6 +114,7 @@ "setting_app": "应用配置", "setting_plugin": "插件配置", "simple_tool_tips": "该插件含有特殊输入,暂不支持被简易应用调用", + "source_updateTime": "更新时间", "stream_response": "流输出", "stream_response_tip": "关闭该开关,可以强制模型使用非流模式,并且不会直接进行内容输出。可以在 AI 回复的输出中,获取本次模型输出的内容进行二次处理。", "temperature": "温度", diff --git a/packages/web/i18n/zh-CN/common.json b/packages/web/i18n/zh-CN/common.json index d138fb1cd..b1725937f 100644 --- a/packages/web/i18n/zh-CN/common.json +++ b/packages/web/i18n/zh-CN/common.json @@ -1013,6 +1013,7 @@ "plugin.go to laf": "去编写", "plugin.path": "路径", "prompt_input_placeholder": "请输入提示词", + "read_quote": "查看引用", "required": "必须", "resume_failed": "恢复失败", "select_reference_variable": "选择引用变量", diff --git a/packages/web/i18n/zh-CN/workflow.json b/packages/web/i18n/zh-CN/workflow.json index 37c4dcabb..31ca07689 100644 --- a/packages/web/i18n/zh-CN/workflow.json +++ b/packages/web/i18n/zh-CN/workflow.json @@ -133,7 +133,7 @@ "question_classification": "问题分类", "question_optimization": "问题优化", "quote_content_placeholder": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置\n{{q}} - 主要内容\n{{a}} - 辅助数据\n{{source}} - 来源名\n{{sourceId}} - 来源ID\n{{index}} - 第 n 个引用", - "quote_content_tip": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置\n{{q}} - 主要内容\n{{a}} - 辅助数据\n{{source}} - 来源名\n{{sourceId}} - 来源ID\n{{index}} - 第 n 个引用\n他们都是可选的,下面是默认值:\n{{default}}", + "quote_content_tip": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置\n{{id}} - 引用数据唯一id\n{{q}} - 主要内容\n{{a}} - 辅助数据\n{{source}} - 来源名\n{{sourceId}} - 来源ID\n{{index}} - 第 n 个引用\n他们都是可选的,下面是默认值:\n{{default}}", "quote_num": "引用", "quote_prompt_tip": "可以用 {{quote}} 来插入引用内容模板,使用 {{question}} 来插入问题(Role=user)。\n下面是默认值:\n{{default}}", "quote_role_system_tip": "请注意从“引用模板提示词”中移除 {{question}} 变量", diff --git a/packages/web/i18n/zh-Hant/account.json b/packages/web/i18n/zh-Hant/account.json index 0ae7b65f1..0ad905070 100644 --- a/packages/web/i18n/zh-Hant/account.json +++ b/packages/web/i18n/zh-Hant/account.json @@ -50,12 +50,15 @@ "model.request_auth_tip": "向自訂請求地址發起請求時候,攜帶請求頭:Authorization: Bearer xxx 進行請求", "model.request_url": "自訂請求地址", "model.request_url_tip": "如果填入該值,則會直接向該位址發起請求,不經過 OneAPI", + "model.test_model": "模型測試", "model.tool_choice": "支援工具調用", + "model.tool_choice_tag": "工具調用", "model.tool_choice_tip": "如果該模型支援工具調用,則開啟該開關", "model.used_in_classify": "用於問題分類", "model.used_in_extract_fields": "用於文字擷取", "model.used_in_tool_call": "用於工具呼叫節點", "model.vision": "支援圖片識別", + "model.vision_tag": "視覺", "model.vision_tip": "如果模型支援圖片識別,則開啟該開關。", "model.voices": "聲音角色", "model.voices_tip": "透過一個數組配置多個,例如:\n\n[\n {\n \"label\": \"Alloy\",\n \"value\": \"alloy\"\n },\n {\n \"label\": \"Echo\",\n \"value\": \"echo\"\n }\n]", diff --git a/packages/web/i18n/zh-Hant/app.json b/packages/web/i18n/zh-Hant/app.json index 5e0e28bcd..93e1cef89 100644 --- a/packages/web/i18n/zh-Hant/app.json +++ b/packages/web/i18n/zh-Hant/app.json @@ -114,6 +114,7 @@ "setting_app": "應用程式設定", "setting_plugin": "外掛設定", "simple_tool_tips": "該插件含有特殊輸入,暫不支持被簡易應用調用", + "source_updateTime": "更新時間", "stream_response": "流輸出", "stream_response_tip": "關閉該開關​​,可以強制模型使用非流模式,並且不會直接進行內容輸出。\n可在 AI 回覆的輸出中,取得本次模型輸出的內容進行二次處理。", "temperature": "溫度", diff --git a/packages/web/i18n/zh-Hant/common.json b/packages/web/i18n/zh-Hant/common.json index 67abe21bf..718d2da32 100644 --- a/packages/web/i18n/zh-Hant/common.json +++ b/packages/web/i18n/zh-Hant/common.json @@ -1009,6 +1009,7 @@ "plugin.go to laf": "前往編寫", "plugin.path": "路徑", "prompt_input_placeholder": "請輸入提示詞", + "read_quote": "查看引用", "required": "必填", "resume_failed": "恢復失敗", "select_reference_variable": "選擇引用變數", diff --git a/packages/web/i18n/zh-Hant/workflow.json b/packages/web/i18n/zh-Hant/workflow.json index b022ab4ca..fe9e93e6c 100644 --- a/packages/web/i18n/zh-Hant/workflow.json +++ b/packages/web/i18n/zh-Hant/workflow.json @@ -133,7 +133,7 @@ "question_classification": "問題分類", "question_optimization": "問題最佳化", "quote_content_placeholder": "可以自訂引用內容的結構,以便更好地適應不同場景。可以使用一些變數來設定範本\n{{q}} - 主要內容\n{{a}} - 輔助資料\n{{source}} - 來源名稱\n{{sourceId}} - 來源 ID\n{{index}} - 第 n 個引用", - "quote_content_tip": "可以自訂引用內容的結構,以便更好地適應不同場景。可以使用一些變數來設定範本\n{{q}} - 主要內容\n{{a}} - 輔助資料\n{{source}} - 來源名稱\n{{sourceId}} - 來源 ID\n{{index}} - 第 n 個引用\n它們都是選用的,以下是預設值:\n{{default}}", + "quote_content_tip": "可以自訂引用內容的結構,以更好的適合不同場景。\n可以使用一些變數來進行模板配置\n\n{{id}} - 引用資料唯一id\n\n{{q}} - 主要內容\n\n{{a}} - 輔助數據\n\n{{source}} - 來源名\n\n{{sourceId}} - 來源ID\n\n{{index}} - 第 n 個引用\n\n他們都是可選的,下面是預設值:\n\n{{default}}", "quote_num": "引用數量", "quote_prompt_tip": "可以使用 {{quote}} 來插入引用內容範本,使用 {{question}} 來插入問題(Role=user)。\n以下是預設值:\n{{default}}", "quote_role_system_tip": "請注意從「引用範本提示詞」中移除 {{question}} 變數", diff --git a/projects/app/.env.template b/projects/app/.env.template index 71ed204df..15e33b9d4 100644 --- a/projects/app/.env.template +++ b/projects/app/.env.template @@ -11,10 +11,7 @@ FILE_TOKEN_KEY=filetokenkey ROOT_KEY=fdafasd # openai 基本地址,可用作中转。 OPENAI_BASE_URL=https://api.openai.com/v1 -# oneapi 地址,可以使用 oneapi 来实现多模型接入 -# ONEAPI_URL=https://xxxx.cloud.sealos.io/openai/v1 -# 通用key。可以是 openai 的也可以是 oneapi 的。 -# 此处逻辑:优先走 ONEAPI_URL,如果填写了 ONEAPI_URL,key 也需要是 ONEAPI 的 key +# OpenAI API Key CHAT_API_KEY=sk-xxxx # 强制将图片转成 base64 传递给模型 MULTIPLE_DATA_TO_BASE64=true diff --git a/projects/app/data/config.json b/projects/app/data/config.json index f4845358e..e167e71a2 100644 --- a/projects/app/data/config.json +++ b/projects/app/data/config.json @@ -8,163 +8,5 @@ "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", // 模型别名 - "maxContext": 125000, // 最大上下文 - "maxResponse": 16000, // 最大回复 - "quoteMaxToken": 120000, // 最大引用内容 - "maxTemperature": 1.2, // 最大温度 - "charsPointsPrice": 0, // n积分/1k token(商业版) - "censor": false, // 是否开启敏感校验(商业版) - "vision": true, // 是否支持图片输入 - "datasetProcess": true, // 是否设置为文本理解模型(QA),务必保证至少有一个为true,否则知识库会报错 - "usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true) - "usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true) - "usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true) - "toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。) - "functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式) - "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 - "customExtractPrompt": "", // 自定义内容提取提示词 - "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 - "defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) - "fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens) - }, - { - "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, - "toolChoice": true, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": {}, - "fieldMap": {} - }, - { - "provider": "OpenAI", - "model": "o1-mini", - "name": "o1-mini", - "maxContext": 125000, - "maxResponse": 65000, - "quoteMaxToken": 120000, - "maxTemperature": 1.2, - "charsPointsPrice": 0, - "censor": false, - "vision": false, - "datasetProcess": true, - "usedInClassify": true, - "usedInExtractFields": true, - "usedInToolCall": true, - "toolChoice": false, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": { - "temperature": 1, - "max_tokens": null, - "stream": false - } - }, - { - "provider": "OpenAI", - "model": "o1-preview", - "name": "o1-preview", - "maxContext": 125000, - "maxResponse": 32000, - "quoteMaxToken": 120000, - "maxTemperature": 1.2, - "charsPointsPrice": 0, - "censor": false, - "vision": false, - "datasetProcess": true, - "usedInClassify": true, - "usedInExtractFields": true, - "usedInToolCall": true, - "toolChoice": false, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": { - "temperature": 1, - "max_tokens": null, - "stream": false - } - } - ], - "vectorModels": [ - { - "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", - "charsPointsPrice": 0, - "defaultToken": 512, - "maxToken": 3000, - "weight": 100, - "defaultConfig": { - "dimensions": 1024 - } - }, - { - "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": [], - "audioSpeechModels": [ - { - "provider": "OpenAI", - "model": "tts-1", - "name": "OpenAI TTS1", - "charsPointsPrice": 0, - "voices": [ - { "label": "Alloy", "value": "alloy", "bufferId": "openai-Alloy" }, - { "label": "Echo", "value": "echo", "bufferId": "openai-Echo" }, - { "label": "Fable", "value": "fable", "bufferId": "openai-Fable" }, - { "label": "Onyx", "value": "onyx", "bufferId": "openai-Onyx" }, - { "label": "Nova", "value": "nova", "bufferId": "openai-Nova" }, - { "label": "Shimmer", "value": "shimmer", "bufferId": "openai-Shimmer" } - ] - } - ], - "whisperModel": { - "provider": "OpenAI", - "model": "whisper-1", - "name": "Whisper1", - "charsPointsPrice": 0 } } diff --git a/projects/app/data/model.json b/projects/app/data/model.json new file mode 100644 index 000000000..3ebb244fb --- /dev/null +++ b/projects/app/data/model.json @@ -0,0 +1,170 @@ +// 已使用 json5 进行解析,会自动去掉注释,无需手动去除 +{ + "feConfigs": { + "lafEnv": "https://laf.dev" // laf环境。 https://laf.run (杭州阿里云) ,或者私有化的laf环境。如果使用 Laf openapi 功能,需要最新版的 laf 。 + }, + "systemEnv": { + "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", // 模型别名 + "maxContext": 128000, // 最大上下文 + "maxResponse": 16000, // 最大回复 + "quoteMaxToken": 120000, // 最大引用内容 + "maxTemperature": 1.2, // 最大温度 + "charsPointsPrice": 0, // n积分/1k token(商业版) + "censor": false, // 是否开启敏感校验(商业版) + "vision": true, // 是否支持图片输入 + "datasetProcess": true, // 是否设置为文本理解模型(QA),务必保证至少有一个为true,否则知识库会报错 + "usedInClassify": true, // 是否用于问题分类(务必保证至少有一个为true) + "usedInExtractFields": true, // 是否用于内容提取(务必保证至少有一个为true) + "usedInToolCall": true, // 是否用于工具调用(务必保证至少有一个为true) + "toolChoice": true, // 是否支持工具选择(分类,内容提取,工具调用会用到。) + "functionCall": false, // 是否支持函数调用(分类,内容提取,工具调用会用到。会优先使用 toolChoice,如果为false,则使用 functionCall,如果仍为 false,则使用提示词模式) + "customCQPrompt": "", // 自定义文本分类提示词(不支持工具和函数调用的模型 + "customExtractPrompt": "", // 自定义内容提取提示词 + "defaultSystemChatPrompt": "", // 对话默认携带的系统提示词 + "defaultConfig": {}, // 请求API时,挟带一些默认配置(比如 GLM4 的 top_p) + "fieldMap": {} // 字段映射(o1 模型需要把 max_tokens 映射为 max_completion_tokens) + }, + { + "provider": "OpenAI", + "model": "gpt-4o", + "name": "gpt-4o", + "maxContext": 128000, + "maxResponse": 4000, + "quoteMaxToken": 120000, + "maxTemperature": 1.2, + "charsPointsPrice": 0, + "censor": false, + "vision": true, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "toolChoice": true, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": {}, + "fieldMap": {} + }, + { + "provider": "OpenAI", + "model": "o1-mini", + "name": "o1-mini", + "maxContext": 128000, + "maxResponse": 65000, + "quoteMaxToken": 120000, + "maxTemperature": 1.2, + "charsPointsPrice": 0, + "censor": false, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": { + "temperature": 1, + "max_tokens": null, + "stream": false + } + }, + { + "provider": "OpenAI", + "model": "o1-preview", + "name": "o1-preview", + "maxContext": 128000, + "maxResponse": 32000, + "quoteMaxToken": 120000, + "maxTemperature": 1.2, + "charsPointsPrice": 0, + "censor": false, + "vision": false, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "toolChoice": false, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": { + "temperature": 1, + "max_tokens": null, + "stream": false + } + } + ], + "vectorModels": [ + { + "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", + "charsPointsPrice": 0, + "defaultToken": 512, + "maxToken": 3000, + "weight": 100, + "defaultConfig": { + "dimensions": 1024 + } + }, + { + "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": [], + "audioSpeechModels": [ + { + "provider": "OpenAI", + "model": "tts-1", + "name": "OpenAI TTS1", + "charsPointsPrice": 0, + "voices": [ + { "label": "Alloy", "value": "alloy", "bufferId": "openai-Alloy" }, + { "label": "Echo", "value": "echo", "bufferId": "openai-Echo" }, + { "label": "Fable", "value": "fable", "bufferId": "openai-Fable" }, + { "label": "Onyx", "value": "onyx", "bufferId": "openai-Onyx" }, + { "label": "Nova", "value": "nova", "bufferId": "openai-Nova" }, + { "label": "Shimmer", "value": "shimmer", "bufferId": "openai-Shimmer" } + ] + } + ], + "whisperModel": { + "provider": "OpenAI", + "model": "whisper-1", + "name": "Whisper1", + "charsPointsPrice": 0 + } +} diff --git a/projects/app/data/pluginTemplates/customFeedback.json b/projects/app/data/pluginTemplates/customFeedback.json deleted file mode 100644 index 47733ee8d..000000000 --- a/projects/app/data/pluginTemplates/customFeedback.json +++ /dev/null @@ -1,302 +0,0 @@ -{ - "author": "FastGPT", - "version": "481", - "templateType": "other", - "name": "自定义反馈", - "avatar": "/imgs/workflow/customFeedback.svg", - "intro": "该模块被触发时,会给当前的对话记录增加一条反馈。可用于自动记录对话效果等。", - "showStatus": false, - "isTool": false, - "weight": 0, - "workflow": { - "nodes": [ - { - "nodeId": "lmpb9v2lo2lk", - "name": "插件开始", - "intro": "自定义配置外部输入,使用插件时,仅暴露自定义配置的输入", - "avatar": "/imgs/workflow/input.png", - "flowNodeType": "pluginInput", - "showStatus": false, - "position": { - "x": 541.7107154264237, - "y": -165.05298493910115 - }, - "version": "481", - "inputs": [ - { - "key": "system_addInputParam", - "valueType": "dynamic", - "label": "自定义输入变量", - "renderTypeList": ["addInputParam"], - "required": false, - "description": "", - "canEdit": true, - "value": "", - "customInputConfig": { - "selectValueTypeList": ["string"], - "showDescription": false, - "showDefaultValue": false - } - }, - { - "key": "反馈内容", - "valueType": "string", - "label": "反馈内容", - "renderTypeList": ["textarea", "reference"], - "description": "", - "canEdit": true, - "value": "", - "maxLength": "" - } - ], - "outputs": [ - { - "id": "ILc8GS7iU53M", - "key": "反馈内容", - "valueType": "string", - "label": "反馈内容", - "type": "static" - }, - { - "id": "2LCxDnOSculb", - "key": "system_addInputParam", - "valueType": "dynamic", - "label": "动态外部数据", - "type": "static" - } - ] - }, - { - "nodeId": "i7uow4wj2wdp", - "name": "插件输出", - "intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出", - "avatar": "/imgs/workflow/output.png", - "flowNodeType": "pluginOutput", - "showStatus": false, - "position": { - "x": 1607.7142331269126, - "y": -151.8669210746189 - }, - "version": "481", - "inputs": [ - { - "key": "text", - "valueType": "string", - "label": "text", - "renderTypeList": ["reference"], - "description": "", - "canEdit": true, - "editField": { - "key": true, - "description": true, - "valueType": true - }, - "value": ["CRT7oIEU8v2P", "pYKS0LB9gAr3"] - } - ], - "outputs": [] - }, - { - "nodeId": "CRT7oIEU8v2P", - "name": "HTTP 请求", - "intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)", - "avatar": "/imgs/workflow/http.png", - "flowNodeType": "httpRequest468", - "showStatus": true, - "position": { - "x": 1070.8458389994719, - "y": -415.09022555407836 - }, - "version": "481", - "inputs": [ - { - "key": "system_addInputParam", - "renderTypeList": ["addInputParam"], - "valueType": "dynamic", - "label": "", - "required": false, - "description": "core.module.input.description.HTTP Dynamic Input", - "editField": { - "key": true, - "valueType": true - }, - "value": ["lmpb9v2lo2lk", "2LCxDnOSculb"], - "customInputConfig": { - "selectValueTypeList": [ - "string", - "number", - "boolean", - "object", - "arrayString", - "arrayNumber", - "arrayBoolean", - "arrayObject", - "any", - "chatHistory", - "datasetQuote", - "dynamic", - "selectApp", - "selectDataset" - ], - "showDescription": false, - "showDefaultValue": true - } - }, - { - "key": "system_httpMethod", - "renderTypeList": ["custom"], - "valueType": "string", - "label": "", - "value": "POST", - "required": true - }, - { - "key": "system_httpReqUrl", - "renderTypeList": ["hidden"], - "valueType": "string", - "label": "", - "description": "core.module.input.description.Http Request Url", - "placeholder": "https://api.ai.com/getInventory", - "required": false, - "value": "/api/plugins/customFeedback/v2" - }, - { - "key": "system_httpHeader", - "renderTypeList": ["custom"], - "valueType": "any", - "value": [], - "label": "", - "description": "core.module.input.description.Http Request Header", - "placeholder": "core.module.input.description.Http Request Header", - "required": false - }, - { - "key": "system_httpParams", - "renderTypeList": ["hidden"], - "valueType": "any", - "value": [], - "label": "", - "required": false - }, - { - "key": "system_httpJsonBody", - "renderTypeList": ["hidden"], - "valueType": "any", - "value": "{\r\n \"customFeedback\":\"{{customFeedback}}\",\r\n \"customInputs\": {{customInputs}},\r\n \"appId\": \"{{appId}}\",\r\n \"chatId\": \"{{chatId}}\",\r\n \"responseChatItemId\": \"{{responseChatItemId}}\"\r\n}", - "label": "", - "required": false - }, - { - "key": "customFeedback", - "valueType": "string", - "label": "customFeedback", - "renderTypeList": ["reference"], - "description": "", - "canEdit": true, - "editField": { - "key": true, - "valueType": true - }, - "value": ["lmpb9v2lo2lk", "ILc8GS7iU53M"] - }, - { - "renderTypeList": ["reference"], - "valueType": "dynamic", - "canEdit": true, - "key": "customInputs", - "label": "customInputs", - "customInputConfig": { - "selectValueTypeList": [ - "string", - "number", - "boolean", - "object", - "arrayString", - "arrayNumber", - "arrayBoolean", - "arrayObject", - "any", - "chatHistory", - "datasetQuote", - "dynamic", - "selectApp", - "selectDataset" - ], - "showDescription": false, - "showDefaultValue": true - }, - "required": true, - "value": ["lmpb9v2lo2lk", "2LCxDnOSculb"] - } - ], - "outputs": [ - { - "id": "system_addOutputParam", - "key": "system_addOutputParam", - "type": "dynamic", - "valueType": "dynamic", - "label": "", - "customFieldConfig": { - "selectValueTypeList": [ - "string", - "number", - "boolean", - "object", - "arrayString", - "arrayNumber", - "arrayBoolean", - "arrayObject", - "any", - "chatHistory", - "datasetQuote", - "dynamic", - "selectApp", - "selectDataset" - ], - "showDescription": false, - "showDefaultValue": true - } - }, - { - "id": "error", - "key": "error", - "label": "请求错误", - "description": "HTTP请求错误信息,成功时返回空", - "valueType": "object", - "type": "static" - }, - { - "id": "httpRawResponse", - "key": "httpRawResponse", - "label": "原始响应", - "required": true, - "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。", - "valueType": "any", - "type": "static" - }, - { - "id": "pYKS0LB9gAr3", - "type": "dynamic", - "key": "text", - "valueType": "string", - "label": "text" - } - ] - } - ], - "edges": [ - { - "source": "lmpb9v2lo2lk", - "target": "CRT7oIEU8v2P", - "sourceHandle": "lmpb9v2lo2lk-source-right", - "targetHandle": "CRT7oIEU8v2P-target-left" - }, - { - "source": "CRT7oIEU8v2P", - "target": "i7uow4wj2wdp", - "sourceHandle": "CRT7oIEU8v2P-source-right", - "targetHandle": "i7uow4wj2wdp-target-left" - } - ] - } -} diff --git a/projects/app/data/pluginTemplates/getCurrentTime.json b/projects/app/data/pluginTemplates/getCurrentTime.json deleted file mode 100644 index 9968fab87..000000000 --- a/projects/app/data/pluginTemplates/getCurrentTime.json +++ /dev/null @@ -1,134 +0,0 @@ -{ - "author": "FastGPT", - "version": "481", - "templateType": "tools", - "name": "获取当前时间", - "avatar": "/imgs/workflow/getCurrentTime.svg", - "intro": "获取用户当前时区的时间。", - "showStatus": false, - "isTool": true, - "weight": 10, - "workflow": { - "nodes": [ - { - "nodeId": "lmpb9v2lo2lk", - "name": "插件开始", - "intro": "自定义配置外部输入,使用插件时,仅暴露自定义配置的输入", - "avatar": "/imgs/workflow/input.png", - "flowNodeType": "pluginInput", - "showStatus": false, - "position": { - "x": 616.4226348688949, - "y": -165.05298493910115 - }, - "inputs": [], - "outputs": [] - }, - { - "nodeId": "i7uow4wj2wdp", - "name": "插件输出", - "intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出", - "avatar": "/imgs/workflow/output.png", - "flowNodeType": "pluginOutput", - "showStatus": false, - "position": { - "x": 1607.7142331269126, - "y": -151.8669210746189 - }, - "inputs": [ - { - "key": "time", - "valueType": "string", - "label": "time", - "renderTypeList": ["reference"], - "required": false, - "description": "", - "canEdit": true, - "editField": { - "key": true, - "description": true, - "valueType": true - }, - "value": ["WNUvWwYBUfEr", "HdIl1GWi0tnc"] - } - ], - "outputs": [] - }, - { - "nodeId": "WNUvWwYBUfEr", - "name": "文本加工", - "intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。", - "flowNodeType": "pluginModule", - "showStatus": false, - "position": { - "x": 1030.0794269310472, - "y": -350.61013802286885 - }, - "inputs": [ - { - "key": "system_addInputParam", - "valueType": "dynamic", - "label": "动态外部数据", - "renderTypeList": ["addInputParam"], - "required": false, - "description": "", - "canEdit": false, - "value": "", - "editField": { - "key": true - }, - "dynamicParamDefaultValue": { - "inputType": "reference", - "valueType": "string", - "required": true - } - }, - { - "key": "文本", - "valueType": "string", - "label": "文本", - "renderTypeList": ["textarea"], - "required": true, - "description": "", - "canEdit": false, - "value": "{{cTime}}", - "editField": { - "key": true - }, - "maxLength": "", - "dynamicParamDefaultValue": { - "inputType": "reference", - "valueType": "string", - "required": true - } - } - ], - "outputs": [ - { - "id": "HdIl1GWi0tnc", - "key": "text", - "valueType": "string", - "label": "text", - "type": "static", - "canEdit": false - } - ], - "pluginId": "community-textEditor" - } - ], - "edges": [ - { - "source": "lmpb9v2lo2lk", - "target": "WNUvWwYBUfEr", - "sourceHandle": "lmpb9v2lo2lk-source-right", - "targetHandle": "WNUvWwYBUfEr-target-left" - }, - { - "source": "WNUvWwYBUfEr", - "target": "i7uow4wj2wdp", - "sourceHandle": "WNUvWwYBUfEr-source-right", - "targetHandle": "i7uow4wj2wdp-target-left" - } - ] - } -} diff --git a/projects/app/data/pluginTemplates/textEditor.json b/projects/app/data/pluginTemplates/textEditor.json deleted file mode 100644 index b52917787..000000000 --- a/projects/app/data/pluginTemplates/textEditor.json +++ /dev/null @@ -1,314 +0,0 @@ -{ - "author": "FastGPT", - "version": "481", - "name": "文本加工", - "avatar": "/imgs/workflow/textEditor.svg", - "intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。", - "showStatus": false, - "weight": 100, - - "isTool": false, - "templateType": "tools", - - "workflow": { - "nodes": [ - { - "nodeId": "lmpb9v2lo2lk", - "name": "插件开始", - "intro": "自定义配置外部输入,使用插件时,仅暴露自定义配置的输入", - "avatar": "/imgs/workflow/input.png", - "flowNodeType": "pluginInput", - "showStatus": false, - "position": { - "x": 449.3089648771014, - "y": -139.7660480324482 - }, - "version": "481", - "inputs": [ - { - "key": "system_addInputParam", - "valueType": "dynamic", - "label": "自定义输入变量", - "renderTypeList": ["addInputParam"], - "required": false, - "description": "", - "canEdit": true, - "value": "", - "customInputConfig": { - "selectValueTypeList": ["string"], - "showDescription": false, - "showDefaultValue": false - } - }, - { - "key": "文本", - "valueType": "string", - "label": "文本", - "renderTypeList": ["textarea"], - "required": true, - "description": "", - "canEdit": true, - "value": "", - "maxLength": "" - } - ], - "outputs": [ - { - "id": "ILc8GS7iU53M", - "key": "文本", - "valueType": "string", - "label": "文本", - "type": "static" - }, - { - "id": "2LCxDnOSculb", - "key": "system_addInputParam", - "valueType": "dynamic", - "label": "system_addInputParam", - "type": "static" - } - ] - }, - { - "nodeId": "i7uow4wj2wdp", - "name": "插件输出", - "intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出", - "avatar": "/imgs/workflow/output.png", - "flowNodeType": "pluginOutput", - "showStatus": false, - "position": { - "x": 1607.7142331269126, - "y": -151.8669210746189 - }, - "version": "481", - "inputs": [ - { - "key": "text", - "valueType": "string", - "label": "text", - "renderTypeList": ["reference"], - "required": false, - "description": "", - "canEdit": true, - "editField": { - "key": true, - "description": true, - "valueType": true - }, - "value": ["CRT7oIEU8v2P", "vooswj3VxKW8"] - } - ], - "outputs": [ - { - "id": "HdIl1GWi0tnc", - "key": "text", - "valueType": "string", - "label": "text", - "type": "static" - } - ] - }, - { - "nodeId": "CRT7oIEU8v2P", - "name": "HTTP 请求", - "intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)", - "avatar": "/imgs/workflow/http.png", - "flowNodeType": "httpRequest468", - "showStatus": true, - "position": { - "x": 1070.8458389994719, - "y": -415.09022555407836 - }, - "version": "486", - "inputs": [ - { - "key": "system_addInputParam", - "renderTypeList": ["addInputParam"], - "valueType": "dynamic", - "label": "", - "required": false, - "description": "core.module.input.description.HTTP Dynamic Input", - "editField": { - "key": true, - "valueType": true - }, - "value": ["lmpb9v2lo2lk", "2LCxDnOSculb"], - "customInputConfig": { - "selectValueTypeList": [ - "string", - "number", - "boolean", - "object", - "arrayString", - "arrayNumber", - "arrayBoolean", - "arrayObject", - "any", - "chatHistory", - "datasetQuote", - "dynamic", - "selectApp", - "selectDataset" - ], - "showDescription": false, - "showDefaultValue": true - } - }, - { - "key": "system_httpMethod", - "renderTypeList": ["custom"], - "valueType": "string", - "label": "", - "value": "POST", - "required": true - }, - { - "key": "system_httpReqUrl", - "renderTypeList": ["hidden"], - "valueType": "string", - "label": "", - "description": "core.module.input.description.Http Request Url", - "placeholder": "https://api.ai.com/getInventory", - "required": false, - "value": "/api/plugins/textEditor/v2" - }, - { - "key": "system_httpHeader", - "renderTypeList": ["custom"], - "valueType": "any", - "value": [], - "label": "", - "description": "core.module.input.description.Http Request Header", - "placeholder": "core.module.input.description.Http Request Header", - "required": false - }, - { - "key": "system_httpParams", - "renderTypeList": ["hidden"], - "valueType": "any", - "value": [], - "label": "", - "required": false - }, - { - "key": "system_httpJsonBody", - "renderTypeList": ["hidden"], - "valueType": "any", - "value": "{\r\n \"text\":\"{{text}}\",\r\n \"customInputs\": {{customInputs}}\r\n}", - "label": "", - "required": false - }, - { - "key": "text", - "valueType": "string", - "label": "text", - "renderTypeList": ["reference"], - "description": "", - "canEdit": true, - "editField": { - "key": true, - "valueType": true - }, - "value": ["lmpb9v2lo2lk", "ILc8GS7iU53M"] - }, - { - "renderTypeList": ["reference"], - "valueType": "dynamic", - "canEdit": true, - "key": "customInputs", - "label": "customInputs", - "customInputConfig": { - "selectValueTypeList": [ - "string", - "number", - "boolean", - "object", - "arrayString", - "arrayNumber", - "arrayBoolean", - "arrayObject", - "any", - "chatHistory", - "datasetQuote", - "dynamic", - "selectApp", - "selectDataset" - ], - "showDescription": false, - "showDefaultValue": true - }, - "required": true, - "value": ["lmpb9v2lo2lk", "2LCxDnOSculb"] - } - ], - "outputs": [ - { - "id": "system_addOutputParam", - "key": "system_addOutputParam", - "type": "dynamic", - "valueType": "dynamic", - "label": "", - "customFieldConfig": { - "selectValueTypeList": [ - "string", - "number", - "boolean", - "object", - "arrayString", - "arrayNumber", - "arrayBoolean", - "arrayObject", - "any", - "chatHistory", - "datasetQuote", - "dynamic", - "selectApp", - "selectDataset" - ], - "showDescription": false, - "showDefaultValue": true - } - }, - { - "id": "error", - "key": "error", - "label": "请求错误", - "description": "HTTP请求错误信息,成功时返回空", - "valueType": "object", - "type": "static" - }, - { - "id": "httpRawResponse", - "key": "httpRawResponse", - "label": "原始响应", - "required": true, - "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。", - "valueType": "any", - "type": "static" - }, - { - "id": "vooswj3VxKW8", - "type": "dynamic", - "key": "text", - "valueType": "string", - "label": "text" - } - ] - } - ], - "edges": [ - { - "source": "lmpb9v2lo2lk", - "target": "CRT7oIEU8v2P", - "sourceHandle": "lmpb9v2lo2lk-source-right", - "targetHandle": "CRT7oIEU8v2P-target-left" - }, - { - "source": "CRT7oIEU8v2P", - "target": "i7uow4wj2wdp", - "sourceHandle": "CRT7oIEU8v2P-source-right", - "targetHandle": "i7uow4wj2wdp-target-left" - } - ] - } -} diff --git a/projects/app/data/pluginTemplates/v1/customFeedback.json b/projects/app/data/pluginTemplates/v1/customFeedback.json deleted file mode 100644 index b4461d9d3..000000000 --- a/projects/app/data/pluginTemplates/v1/customFeedback.json +++ /dev/null @@ -1,342 +0,0 @@ -{ - "author": "FastGPT", - "templateType": "other", - "name": "自定义反馈", - "avatar": "/imgs/module/customFeedback.svg", - "intro": "该模块被触发时,会给当前的对话记录增加一条反馈。可用于自动记录对话效果等。", - "showStatus": false, - "isTool": false, - "weight": 0, - "modules": [ - { - "moduleId": "w90mfp", - "name": "插件开始", - "flowType": "pluginInput", - "showStatus": false, - "position": { - "x": 515.1887815471657, - "y": -169.04905809653783 - }, - "inputs": [ - { - "key": "defaultFeedback", - "valueType": "string", - "label": "默认反馈内容", - "type": "textarea", - "required": false, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": true - }, - "connected": true - }, - { - "key": "customFeedback", - "valueType": "string", - "label": "自定义反馈内容", - "type": "target", - "required": false, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": true - }, - "connected": true - } - ], - "outputs": [ - { - "key": "defaultFeedback", - "valueType": "string", - "label": "默认反馈内容", - "type": "source", - "edit": true, - "targets": [ - { - "moduleId": "49de3g", - "key": "defaultFeedback" - } - ] - }, - { - "key": "customFeedback", - "valueType": "string", - "label": "自定义反馈内容", - "type": "source", - "edit": true, - "targets": [ - { - "moduleId": "49de3g", - "key": "customFeedback" - } - ] - } - ] - }, - { - "moduleId": "49de3g", - "name": "HTTP模块", - "flowType": "httpRequest468", - "showStatus": true, - "position": { - "x": 1086.8929621216014, - "y": -451.7550009773506 - }, - "inputs": [ - { - "key": "switch", - "type": "target", - "label": "core.module.input.label.switch", - "description": "core.module.input.description.Trigger", - "valueType": "any", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": false - }, - { - "key": "system_httpMethod", - "type": "custom", - "valueType": "string", - "label": "", - "value": "POST", - "list": [ - { - "label": "GET", - "value": "GET" - }, - { - "label": "POST", - "value": "POST" - } - ], - "required": true, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpReqUrl", - "type": "hidden", - "valueType": "string", - "label": "", - "description": "core.module.input.description.Http Request Url", - "placeholder": "https://api.ai.com/getInventory", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "value": "/api/plugins/customFeedback", - "connected": false - }, - { - "key": "system_httpHeader", - "type": "custom", - "valueType": "any", - "value": "", - "label": "", - "description": "core.module.input.description.Http Request Header", - "placeholder": "core.module.input.description.Http Request Header", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpParams", - "type": "hidden", - "valueType": "any", - "value": [], - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpJsonBody", - "type": "hidden", - "valueType": "any", - "value": "{\r\n \"appId\": \"{{appId}}\",\r\n \"chatId\": \"{{chatId}}\",\r\n \"responseChatItemId\": \"{{responseChatItemId}}\",\r\n \"defaultFeedback\": \"{{defaultFeedback}}\",\r\n \"customFeedback\": \"{{customFeedback}}\"\r\n}", - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "DYNAMIC_INPUT_KEY", - "type": "target", - "valueType": "any", - "label": "core.module.inputType.dynamicTargetInput", - "description": "core.module.input.description.dynamic input", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": true, - "hideInApp": true, - "connected": false - }, - { - "valueType": "string", - "label": "defaultFeedback", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "connected": true, - "key": "defaultFeedback" - }, - { - "key": "customFeedback", - "valueType": "string", - "label": "customFeedback", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "connected": true - }, - { - "key": "system_addInputParam", - "type": "addInputParam", - "valueType": "any", - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "inputType": "target", - "valueType": "string", - "required": true - }, - "connected": false - } - ], - "outputs": [ - { - "key": "finish", - "label": "core.module.output.label.running done", - "description": "core.module.output.description.running done", - "valueType": "boolean", - "type": "hidden", - "targets": [] - }, - { - "key": "system_addOutputParam", - "type": "addOutputParam", - "valueType": "any", - "label": "", - "targets": [], - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "outputType": "source", - "valueType": "string" - } - }, - { - "type": "source", - "valueType": "string", - "label": "response", - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "targets": [ - { - "moduleId": "s15f3v", - "key": "text" - } - ], - "key": "response" - } - ] - }, - { - "moduleId": "s15f3v", - "name": "指定回复", - "flowType": "answerNode", - "position": { - "x": 1705.6337348182756, - "y": -37.53826066726282 - }, - "inputs": [ - { - "key": "switch", - "type": "target", - "label": "core.module.input.label.switch", - "description": "core.module.input.description.Trigger", - "valueType": "any", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": false - }, - { - "key": "text", - "type": "textarea", - "valueType": "any", - "label": "core.module.input.label.Response content", - "description": "core.module.input.description.Response content", - "placeholder": "core.module.input.description.Response content", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": true - } - ], - "outputs": [ - { - "key": "finish", - "label": "core.module.output.label.running done", - "description": "core.module.output.description.running done", - "valueType": "boolean", - "type": "hidden", - "targets": [] - } - ] - } - ] -} diff --git a/projects/app/data/pluginTemplates/v1/getCurrentTime.json b/projects/app/data/pluginTemplates/v1/getCurrentTime.json deleted file mode 100644 index 2c7a4a24f..000000000 --- a/projects/app/data/pluginTemplates/v1/getCurrentTime.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "author": "FastGPT", - "templateType": "tools", - "name": "获取当前时间", - "avatar": "/imgs/module/getCurrentTime.svg", - "intro": "获取用户当前时区的时间。", - "showStatus": false, - "isTool": true, - "weight": 10, - "modules": [ - { - "moduleId": "m8dupj", - "name": "插件开始", - "intro": "自定义配置外部输入,使用插件时,仅暴露自定义配置的输入", - "avatar": "/imgs/module/input.png", - "flowType": "pluginInput", - "showStatus": false, - "position": { - "x": 187.94161749205568, - "y": 179.78772129776746 - }, - "inputs": [ - { - "key": "pluginStart", - "type": "hidden", - "valueType": "boolean", - "label": "插件开始运行", - "description": "插件开始运行时,会输出一个 True 的标识。有时候,插件不会有额外的的输入,为了顺利的进入下一个阶段,你可以将该值连接到下一个节点的触发器中。", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": true - } - ], - "outputs": [ - { - "key": "pluginStart", - "label": "插件开始运行", - "type": "source", - "valueType": "boolean", - "targets": [ - { - "moduleId": "cv13yt", - "key": "switch" - } - ] - } - ] - }, - { - "moduleId": "bjsa7r", - "name": "插件输出", - "intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出", - "avatar": "/imgs/module/output.png", - "flowType": "pluginOutput", - "showStatus": false, - "position": { - "x": 1176.9471084832217, - "y": 138.94098316727695 - }, - "inputs": [ - { - "key": "time", - "valueType": "string", - "label": "time", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": false, - "dataType": true, - "inputType": false - }, - "connected": true - } - ], - "outputs": [ - { - "key": "time", - "valueType": "string", - "label": "time", - "type": "source", - "edit": true, - "targets": [] - } - ] - }, - { - "moduleId": "cv13yt", - "name": "文本加工", - "intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。", - "avatar": "/imgs/module/textEditor.svg", - "flowType": "pluginModule", - "showStatus": false, - "position": { - "x": 600.7190079155914, - "y": 1.4754510232677944 - }, - "inputs": [ - { - "key": "pluginId", - "type": "hidden", - "label": "", - "value": "community-textEditor", - "valueType": "string", - "connected": false, - "showTargetInApp": false, - "showTargetInPlugin": false - }, - { - "key": "switch", - "type": "triggerAndFinish", - "label": "", - "description": "core.module.input.description.Trigger", - "valueType": "any", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": true - }, - { - "key": "textarea", - "valueType": "string", - "label": "文本内容", - "type": "textarea", - "required": true, - "description": "可以通过 {{key}} 的方式引用传入的变量。变量仅支持字符串或数字。", - "edit": false, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": true - }, - "connected": false, - "placeholder": "可以通过 {{key}} 的方式引用传入的变量。变量仅支持字符串或数字。", - "value": "{{cTime}}" - }, - { - "key": "DYNAMIC_INPUT_KEY", - "valueType": "any", - "label": "需要加工的输入", - "type": "addInputParam", - "required": false, - "description": "可动态的添加字符串类型变量,在文本编辑中通过 {{key}} 使用变量。非字符串类型,会自动转成字符串类型。", - "edit": false, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": false - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "inputType": "target", - "valueType": "string", - "required": true - }, - "connected": false - } - ], - "outputs": [ - { - "key": "text", - "valueType": "string", - "label": "core.module.output.label.text", - "type": "source", - "edit": false, - "targets": [ - { - "moduleId": "bjsa7r", - "key": "time" - } - ] - }, - { - "key": "finish", - "label": "", - "description": "", - "valueType": "boolean", - "type": "hidden", - "targets": [] - } - ] - } - ] -} diff --git a/projects/app/data/pluginTemplates/v1/textEditor.json b/projects/app/data/pluginTemplates/v1/textEditor.json deleted file mode 100644 index 9ea905dc0..000000000 --- a/projects/app/data/pluginTemplates/v1/textEditor.json +++ /dev/null @@ -1,331 +0,0 @@ -{ - "author": "FastGPT", - "templateType": "tools", - "name": "文本加工", - "avatar": "/imgs/module/textEditor.svg", - "intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。", - "showStatus": false, - "isTool": false, - "weight": 100, - "modules": [ - { - "moduleId": "w90mfp", - "name": "插件开始", - "flowType": "pluginInput", - "showStatus": false, - "position": { - "x": 616.4226348688949, - "y": -165.05298493910115 - }, - "inputs": [ - { - "key": "textarea", - "valueType": "string", - "label": "文本内容", - "type": "textarea", - "required": true, - "description": "可以通过 {{key}} 的方式引用传入的变量。变量仅支持字符串或数字。", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": true - }, - "connected": true - }, - { - "key": "DYNAMIC_INPUT_KEY", - "valueType": "any", - "label": "需要加工的输入", - "type": "addInputParam", - "required": false, - "description": "可动态的添加字符串类型变量,在文本编辑中通过 {{key}} 使用变量。非字符串类型,会自动转成字符串类型。", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": false - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "inputType": "target", - "valueType": "string", - "required": true - }, - "connected": true - } - ], - "outputs": [ - { - "key": "textarea", - "valueType": "string", - "label": "文本内容", - "type": "source", - "edit": true, - "targets": [ - { - "moduleId": "49de3g", - "key": "text" - } - ] - }, - { - "key": "DYNAMIC_INPUT_KEY", - "valueType": "any", - "label": "需要加工的输入", - "type": "source", - "edit": true, - "targets": [ - { - "moduleId": "49de3g", - "key": "DYNAMIC_INPUT_KEY" - } - ] - } - ] - }, - { - "moduleId": "tze1ju", - "name": "插件输出", - "flowType": "pluginOutput", - "showStatus": false, - "position": { - "x": 1607.7142331269126, - "y": -145.93201540017395 - }, - "inputs": [ - { - "key": "text", - "valueType": "string", - "label": "core.module.output.label.text", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": false, - "dataType": true, - "inputType": false - }, - "connected": true - } - ], - "outputs": [ - { - "key": "text", - "valueType": "string", - "label": "core.module.output.label.text", - "type": "source", - "edit": true, - "targets": [] - } - ] - }, - { - "moduleId": "49de3g", - "name": "HTTP模块", - "flowType": "httpRequest468", - "showStatus": true, - "position": { - "x": 1086.8929621216014, - "y": -451.7550009773506 - }, - "inputs": [ - { - "key": "switch", - "type": "target", - "label": "core.module.input.label.switch", - "description": "core.module.input.description.Trigger", - "valueType": "any", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": false - }, - { - "key": "system_httpMethod", - "type": "custom", - "valueType": "string", - "label": "", - "value": "POST", - "list": [ - { - "label": "GET", - "value": "GET" - }, - { - "label": "POST", - "value": "POST" - } - ], - "required": true, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpReqUrl", - "type": "hidden", - "valueType": "string", - "label": "", - "description": "core.module.input.description.Http Request Url", - "placeholder": "https://api.ai.com/getInventory", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "value": "/api/plugins/textEditor", - "connected": false - }, - { - "key": "system_httpHeader", - "type": "custom", - "valueType": "any", - "value": "", - "label": "", - "description": "core.module.input.description.Http Request Header", - "placeholder": "core.module.input.description.Http Request Header", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpParams", - "type": "hidden", - "valueType": "any", - "value": [], - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpJsonBody", - "type": "hidden", - "valueType": "any", - "value": "{\r\n \"text\": \"{{text}}\"\r\n}", - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "DYNAMIC_INPUT_KEY", - "type": "target", - "valueType": "any", - "label": "core.module.inputType.dynamicTargetInput", - "description": "core.module.input.description.dynamic input", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": true, - "hideInApp": true, - "connected": true - }, - { - "key": "text", - "valueType": "string", - "label": "text", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "connected": true - }, - { - "key": "system_addInputParam", - "type": "addInputParam", - "valueType": "any", - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "inputType": "target", - "valueType": "string", - "required": true - }, - "connected": false - } - ], - "outputs": [ - { - "key": "finish", - "label": "core.module.output.label.running done", - "description": "core.module.output.description.running done", - "valueType": "boolean", - "type": "hidden", - "targets": [] - }, - { - "key": "system_addOutputParam", - "type": "addOutputParam", - "valueType": "any", - "label": "", - "targets": [], - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "outputType": "source", - "valueType": "string" - } - }, - { - "type": "source", - "valueType": "string", - "key": "text", - "label": "core.module.output.label.text", - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "targets": [ - { - "moduleId": "tze1ju", - "key": "text" - } - ] - } - ] - } - ] -} diff --git a/projects/app/data/pluginTemplates/v1/tfSwitch.json b/projects/app/data/pluginTemplates/v1/tfSwitch.json deleted file mode 100644 index 6d3bd8eca..000000000 --- a/projects/app/data/pluginTemplates/v1/tfSwitch.json +++ /dev/null @@ -1,369 +0,0 @@ -{ - "abandon": true, - "author": "FastGPT", - "templateType": "tools", - "name": "判断器", - "avatar": "/imgs/module/tfSwitch.svg", - "intro": "根据传入的内容进行 True False 输出。默认情况下,当传入的内容为 false, undefined, null, 0, none 时,会输出 false。你也可以增加一些自定义的字符串来补充输出 false 的内容。非字符、非数字、非布尔类型,直接输出 True。", - "showStatus": false, - "isTool": false, - "weight": 10, - "modules": [ - { - "moduleId": "w90mfp", - "name": "插件开始", - "flowType": "pluginInput", - "showStatus": false, - "position": { - "x": 616.4226348688949, - "y": -165.05298493910115 - }, - "inputs": [ - { - "key": "input", - "valueType": "any", - "type": "target", - "label": "core.module.input.label.TFSwitch input tip", - "required": true, - "edit": true, - "connected": true - }, - { - "key": "rule", - "valueType": "string", - "label": "core.module.input.label.TFSwitch textarea", - "type": "textarea", - "required": false, - "description": "core.module.input.description.TFSwitch textarea", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true, - "inputType": true - }, - "connected": true - } - ], - "outputs": [ - { - "key": "input", - "valueType": "any", - "label": "core.module.input.label.TFSwitch input tip", - "type": "source", - "edit": true, - "targets": [ - { - "moduleId": "8kld99", - "key": "input" - } - ] - }, - { - "key": "rule", - "valueType": "string", - "label": "core.module.input.label.TFSwitch textarea", - "type": "source", - "edit": true, - "targets": [ - { - "moduleId": "8kld99", - "key": "rule" - } - ] - } - ] - }, - { - "moduleId": "tze1ju", - "name": "插件输出", - "flowType": "pluginOutput", - "showStatus": false, - "position": { - "x": 1985.3791673445353, - "y": -144.90535546692078 - }, - "inputs": [ - { - "key": "true", - "type": "target", - "valueType": "boolean", - "label": "True", - "required": true, - "edit": true, - "connected": true, - "description": "" - }, - { - "key": "false", - "valueType": "boolean", - "label": "False", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": false, - "dataType": true, - "inputType": false - }, - "connected": true - } - ], - "outputs": [ - { - "key": "true", - "valueType": "boolean", - "label": "True", - "type": "source", - "edit": true, - "targets": [] - }, - { - "key": "false", - "valueType": "boolean", - "label": "False", - "type": "source", - "edit": true, - "targets": [] - } - ] - }, - { - "moduleId": "8kld99", - "name": "HTTP模块", - "flowType": "httpRequest468", - "showStatus": true, - "position": { - "x": 1210.560012858087, - "y": -387.62433050951756 - }, - "inputs": [ - { - "key": "switch", - "type": "target", - "label": "core.module.input.label.switch", - "description": "core.module.input.description.Trigger", - "valueType": "any", - "showTargetInApp": true, - "showTargetInPlugin": true, - "connected": false - }, - { - "key": "system_httpMethod", - "type": "custom", - "valueType": "string", - "label": "", - "value": "POST", - "list": [ - { - "label": "GET", - "value": "GET" - }, - { - "label": "POST", - "value": "POST" - } - ], - "required": true, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpReqUrl", - "type": "hidden", - "valueType": "string", - "label": "", - "description": "core.module.input.description.Http Request Url", - "placeholder": "https://api.ai.com/getInventory", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "value": "/api/plugins/TFSwitch", - "connected": false - }, - { - "key": "system_httpHeader", - "type": "custom", - "valueType": "any", - "label": "", - "description": "core.module.input.description.Http Request Header", - "placeholder": "core.module.input.description.Http Request Header", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpParams", - "type": "hidden", - "valueType": "any", - "value": [], - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "system_httpJsonBody", - "type": "hidden", - "valueType": "any", - "value": "{\r\n \"input\": \"{{input}}\",\r\n \"rule\": \"{{rule}}\"\r\n}", - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "connected": false - }, - { - "key": "DYNAMIC_INPUT_KEY", - "type": "target", - "valueType": "any", - "label": "core.module.inputType.dynamicTargetInput", - "description": "core.module.input.description.dynamic input", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": true, - "hideInApp": true, - "connected": false - }, - { - "key": "input", - "valueType": "any", - "label": "input", - "type": "target", - "required": true, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "connected": true - }, - { - "key": "rule", - "valueType": "string", - "label": "rule", - "type": "target", - "required": false, - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "connected": true - }, - { - "key": "system_addInputParam", - "type": "addInputParam", - "valueType": "any", - "label": "", - "required": false, - "showTargetInApp": false, - "showTargetInPlugin": false, - "editField": { - "key": true, - "name": true, - "description": true, - "required": true, - "dataType": true - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "inputType": "target", - "valueType": "string", - "required": true - }, - "connected": false - } - ], - "outputs": [ - { - "key": "finish", - "label": "core.module.output.label.running done", - "description": "core.module.output.description.running done", - "valueType": "boolean", - "type": "hidden", - "targets": [] - }, - { - "key": "system_addOutputParam", - "type": "addOutputParam", - "valueType": "any", - "label": "", - "targets": [], - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "defaultEditField": { - "label": "", - "key": "", - "description": "", - "outputType": "source", - "valueType": "string" - } - }, - { - "type": "source", - "valueType": "boolean", - "key": "true", - "label": "true", - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "targets": [ - { - "moduleId": "tze1ju", - "key": "true" - } - ] - }, - { - "type": "source", - "valueType": "boolean", - "key": "false", - "label": "false", - "description": "", - "edit": true, - "editField": { - "key": true, - "name": true, - "description": true, - "dataType": true - }, - "targets": [ - { - "moduleId": "tze1ju", - "key": "false" - } - ] - } - ] - } - ] -} diff --git a/projects/app/data/test.mp3 b/projects/app/data/test.mp3 new file mode 100644 index 000000000..d513ac531 Binary files /dev/null and b/projects/app/data/test.mp3 differ diff --git a/projects/app/package.json b/projects/app/package.json index 95dff330e..217146eb3 100644 --- a/projects/app/package.json +++ b/projects/app/package.json @@ -1,6 +1,6 @@ { "name": "app", - "version": "4.8.19", + "version": "4.8.20", "private": false, "scripts": { "dev": "next dev", diff --git a/projects/app/src/components/Markdown/A.tsx b/projects/app/src/components/Markdown/A.tsx new file mode 100644 index 000000000..2d1609ecf --- /dev/null +++ b/projects/app/src/components/Markdown/A.tsx @@ -0,0 +1,105 @@ +import { eventBus, EventNameEnum } from '@/web/common/utils/eventbus'; +import { + Button, + Link, + Popover, + PopoverTrigger, + PopoverContent, + PopoverHeader, + PopoverBody, + PopoverArrow, + PopoverCloseButton +} from '@chakra-ui/react'; +import MyIcon from '@fastgpt/web/components/common/Icon'; +import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; +import { useRequest2 } from '@fastgpt/web/hooks/useRequest'; +import { useTranslation } from 'next-i18next'; +import React, { useMemo } from 'react'; +import { getQuoteData } from '@/web/core/dataset/api'; +import MyBox from '@fastgpt/web/components/common/MyBox'; +import RawSourceBox from '../core/dataset/RawSourceBox'; +import { getCollectionSourceData } from '@fastgpt/global/core/dataset/collection/utils'; +import Markdown from '.'; + +const A = ({ children, ...props }: any) => { + const { t } = useTranslation(); + + const { + data: quoteData, + loading, + runAsync + } = useRequest2(getQuoteData, { + manual: true + }); + + // empty href link + if (!props.href && typeof children?.[0] === 'string') { + const text = useMemo(() => String(children), [children]); + + return ( + + + + ); + } + + // Quote + if (props.href === 'QUOTE' && typeof children?.[0] === 'string') { + return ( + runAsync(String(children))} + > + + + + + + + + {quoteData?.collection && ( + + )} + + + + + + + + + + ); + } + + return {children}; +}; + +export default A; diff --git a/projects/app/src/components/Markdown/index.tsx b/projects/app/src/components/Markdown/index.tsx index 4aed17b97..4e6dbeb31 100644 --- a/projects/app/src/components/Markdown/index.tsx +++ b/projects/app/src/components/Markdown/index.tsx @@ -10,12 +10,7 @@ import RehypeExternalLinks from 'rehype-external-links'; import styles from './index.module.scss'; import dynamic from 'next/dynamic'; -import { Link, Button, Box } from '@chakra-ui/react'; -import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; -import { useTranslation } from 'next-i18next'; -import { EventNameEnum, eventBus } from '@/web/common/utils/eventbus'; -import MyIcon from '@fastgpt/web/components/common/Icon'; -import { MARKDOWN_QUOTE_SIGN } from '@fastgpt/global/core/chat/constants'; +import { Box } from '@chakra-ui/react'; import { CodeClassNameEnum } from './utils'; const CodeLight = dynamic(() => import('./CodeLight'), { ssr: false }); @@ -27,6 +22,7 @@ const IframeHtmlCodeBlock = dynamic(() => import('./codeBlock/iframe-html'), { s const ChatGuide = dynamic(() => import('./chat/Guide'), { ssr: false }); const QuestionGuide = dynamic(() => import('./chat/QuestionGuide'), { ssr: false }); +const A = dynamic(() => import('./A'), { ssr: false }); type Props = { source?: string; @@ -74,7 +70,10 @@ const MarkdownRender = ({ source = '', showAnimation, isDisabled, forbidZhFormat '$1$3 $2$4' ) // 处理引用标记 - .replace(/\n*(\[QUOTE SIGN\]\(.*\))/g, '$1'); + .replace(/\n*(\[QUOTE SIGN\]\(.*\))/g, '$1') + // 处理 [quote:id] 格式引用,将 [quote:675934a198f46329dfc6d05a] 转换为 [675934a198f46329dfc6d05a]() + .replace(/\[quote:?\s*([a-f0-9]{24})\](?!\()/gi, '[$1](QUOTE)') + .replace(/\[([a-f0-9]{24})\](?!\()/g, '[$1](QUOTE)'); // 还原 URL const finalText = textWithSpaces.replace( @@ -155,53 +154,6 @@ function Image({ src }: { src?: string }) { return ; } -function A({ children, ...props }: any) { - const { t } = useTranslation(); - - // empty href link - if (!props.href && typeof children?.[0] === 'string') { - const text = useMemo(() => String(children), [children]); - - return ( - - - - ); - } - - // quote link(未使用) - if (children?.length === 1 && typeof children?.[0] === 'string') { - const text = String(children); - if (text === MARKDOWN_QUOTE_SIGN && props.href) { - return ( - - getCollectionSourceAndOpen(props.href)} - /> - - ); - } - } - - return {children}; -} - function RewritePre({ children }: any) { const modifiedChildren = React.Children.map(children, (child) => { if (React.isValidElement(child)) { diff --git a/projects/app/src/components/core/ai/AISettingModal/index.tsx b/projects/app/src/components/core/ai/AISettingModal/index.tsx index 2d6b17e86..9f4c5ee58 100644 --- a/projects/app/src/components/core/ai/AISettingModal/index.tsx +++ b/projects/app/src/components/core/ai/AISettingModal/index.tsx @@ -307,12 +307,11 @@ const AIChatSettingsModal = ({ )} {showVisionSwitch && ( - + {t('app:llm_use_vision')} - {llmSupportVision ? ( ) : ( - + {t('app:llm_not_support_vision')} )} diff --git a/projects/app/src/components/core/ai/ModelTable/index.tsx b/projects/app/src/components/core/ai/ModelTable/index.tsx index eb1c81cc1..682e8aaf0 100644 --- a/projects/app/src/components/core/ai/ModelTable/index.tsx +++ b/projects/app/src/components/core/ai/ModelTable/index.tsx @@ -82,7 +82,7 @@ const ModelTable = () => { ) : ( - {item.charsPointsPrice} + {item.charsPointsPrice || 0} {`${t('common:support.wallet.subscription.point')} / 1K Tokens`} @@ -95,7 +95,7 @@ const ModelTable = () => { priceLabel: ( - {item.charsPointsPrice} + {item.charsPointsPrice || 0} {` ${t('common:support.wallet.subscription.point')} / 1K Tokens`} @@ -108,7 +108,7 @@ const ModelTable = () => { priceLabel: ( - {item.charsPointsPrice} + {item.charsPointsPrice || 0} {` ${t('common:support.wallet.subscription.point')} / 1K ${t('common:unit.character')}`} diff --git a/projects/app/src/pageComponents/account/model/ModelConfigTable.tsx b/projects/app/src/pageComponents/account/model/ModelConfigTable.tsx index 62a722932..33408ba8b 100644 --- a/projects/app/src/pageComponents/account/model/ModelConfigTable.tsx +++ b/projects/app/src/pageComponents/account/model/ModelConfigTable.tsx @@ -35,6 +35,7 @@ import { getModelConfigJson, getSystemModelDetail, getSystemModelList, + getTestModel, putSystemModel } from '@/web/core/ai/config'; import MyBox from '@fastgpt/web/components/common/MyBox'; @@ -52,14 +53,21 @@ import { useSystemStore } from '@/web/common/system/useSystemStore'; import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip'; import { putUpdateWithJson } from '@/web/core/ai/config'; import CopyBox from '@fastgpt/web/components/common/String/CopyBox'; +import MyIcon from '@fastgpt/web/components/common/Icon'; const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal')); const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { const { t } = useTranslation(); const { userInfo } = useUserStore(); - const { llmModelList, embeddingModelList, ttsModelList, sttModelList, reRankModelList } = - useSystemStore(); + const { + llmModelList, + embeddingModelList, + ttsModelList, + sttModelList, + reRankModelList, + feConfigs + } = useSystemStore(); const isRoot = userInfo?.username === 'root'; @@ -125,7 +133,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ) : ( - {item.charsPointsPrice} + {item.charsPointsPrice || 0} {`${t('common:support.wallet.subscription.point')} / 1K Tokens`} @@ -140,7 +148,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { priceLabel: ( - {item.charsPointsPrice} + {item.charsPointsPrice || 0} {` ${t('common:support.wallet.subscription.point')} / 1K Tokens`} @@ -155,7 +163,7 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { priceLabel: ( - {item.charsPointsPrice} + {item.charsPointsPrice || 0} {` ${t('common:support.wallet.subscription.point')} / 1K ${t('common:unit.character')}`} @@ -239,6 +247,10 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { ); }, [systemModelList]); + const { runAsync: onTestModel, loading: testingModel } = useRequest2(getTestModel, { + manual: true, + successToast: t('common:common.Success') + }); const { runAsync: updateModel, loading: updatingModel } = useRequest2(putSystemModel, { onSuccess: refreshModels }); @@ -275,8 +287,8 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { model: '', name: '', charsPointsPrice: 0, - inputPrice: 0, - outputPrice: 0, + inputPrice: undefined, + outputPrice: undefined, isCustom: true, isActive: true, @@ -291,7 +303,9 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { onClose: onCloseJsonConfig } = useDisclosure(); - const isLoading = loadingModels || loadingData || updatingModel; + const isLoading = loadingModels || loadingData || updatingModel || testingModel; + + const [showModelId, setShowModelId] = useState(true); return ( <> @@ -376,9 +390,20 @@ const ModelTable = ({ Tab }: { Tab: React.ReactNode }) => { - + - + {feConfigs?.isPlus && } - + {feConfigs?.isPlus && } - - - - + + + +
{t('common:model.name')} + setShowModelId(!showModelId)} + > + + {showModelId ? t('account:model.model_id') : t('common:model.name')} + + + + {t('common:model.model_type')}{t('common:model.billing')}{t('common:model.billing')} {
- - - {item.name} + + + {showModelId ? item.model : item.name} + + {item.contextToken && ( + + {Math.floor(item.contextToken / 1000)}k + + )} + {item.vision && ( + + {t('account:model.vision_tag')} + + )} + {item.toolChoice && ( + + {t('account:model.tool_choice_tag')} + + )} + {item.typeLabel} {item.priceLabel}{item.priceLabel} { + onTestModel(item.model)} + /> onEditModel(item.model)} /> {item.isCustom && ( @@ -545,24 +597,6 @@ const ModelEditModal = ({
{t('common:model.provider')} - {isCustom ? ( - setValue('provider', value)} - list={providerList.current} - {...InputStyles} - /> - ) : ( - - - {t(providerData.name)} - - )} -
@@ -578,6 +612,17 @@ const ModelEditModal = ({ )}
{t('common:model.provider')} + setValue('provider', value)} + list={providerList.current} + {...InputStyles} + /> +
diff --git a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderInput/templates/SettingQuotePrompt.tsx b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderInput/templates/SettingQuotePrompt.tsx index 846ed3105..1d8296aa8 100644 --- a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderInput/templates/SettingQuotePrompt.tsx +++ b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderInput/templates/SettingQuotePrompt.tsx @@ -79,6 +79,16 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo }>(); const quoteTemplateVariables = useMemo( () => [ + { + key: 'id', + label: 'id', + icon: 'core/app/simpleMode/variable' + }, + { + key: 'source', + label: t('common:core.dataset.search.Source name'), + icon: 'core/app/simpleMode/variable' + }, { key: 'q', label: 'q', @@ -90,13 +100,8 @@ const EditModal = ({ onClose, ...props }: RenderInputProps & { onClose: () => vo icon: 'core/app/simpleMode/variable' }, { - key: 'source', - label: t('common:core.dataset.search.Source name'), - icon: 'core/app/simpleMode/variable' - }, - { - key: 'sourceId', - label: t('common:core.dataset.search.Source id'), + key: 'updateTime', + label: t('app:source_updateTime'), icon: 'core/app/simpleMode/variable' }, { diff --git a/projects/app/src/pages/api/core/ai/model/list.ts b/projects/app/src/pages/api/core/ai/model/list.ts index 504668990..e19622be9 100644 --- a/projects/app/src/pages/api/core/ai/model/list.ts +++ b/projects/app/src/pages/api/core/ai/model/list.ts @@ -20,6 +20,11 @@ export type listResponse = { isActive: boolean; isCustom: boolean; + + // Tag + contextToken?: number; + vision?: boolean; + toolChoice?: boolean; }[]; async function handler( @@ -39,7 +44,13 @@ async function handler( inputPrice: model.inputPrice, outputPrice: model.outputPrice, isActive: model.isActive ?? false, - isCustom: model.isCustom ?? false + isCustom: model.isCustom ?? false, + + // Tag + contextToken: + 'maxContext' in model ? model.maxContext : 'maxToken' in model ? model.maxToken : undefined, + vision: 'vision' in model ? model.vision : undefined, + toolChoice: 'toolChoice' in model ? model.toolChoice : undefined })); } diff --git a/projects/app/src/pages/api/core/ai/model/test.ts b/projects/app/src/pages/api/core/ai/model/test.ts new file mode 100644 index 000000000..9895ac971 --- /dev/null +++ b/projects/app/src/pages/api/core/ai/model/test.ts @@ -0,0 +1,126 @@ +import type { ApiRequestProps, ApiResponseType } from '@fastgpt/service/type/next'; +import { NextAPI } from '@/service/middleware/entry'; +import { authSystemAdmin } from '@fastgpt/service/support/permission/user/auth'; +import { findModelFromAlldata } from '@fastgpt/service/core/ai/model'; +import { + EmbeddingModelItemType, + LLMModelItemType, + ReRankModelItemType, + STTModelType, + TTSModelType +} from '@fastgpt/global/core/ai/model.d'; +import { getAIApi } from '@fastgpt/service/core/ai/config'; +import { addLog } from '@fastgpt/service/common/system/log'; +import { getVectorsByText } from '@fastgpt/service/core/ai/embedding'; +import { reRankRecall } from '@fastgpt/service/core/ai/rerank'; +import { aiTranscriptions } from '@fastgpt/service/core/ai/audio/transcriptions'; +import { isProduction } from '@fastgpt/global/common/system/constants'; +import * as fs from 'fs'; + +export type testQuery = { model: string }; + +export type testBody = {}; + +export type testResponse = any; + +async function handler( + req: ApiRequestProps, + res: ApiResponseType +): Promise { + await authSystemAdmin({ req }); + + const { model } = req.query; + const modelData = findModelFromAlldata(model); + + if (!modelData) return Promise.reject('Model not found'); + + if (modelData.type === 'llm') { + return testLLMModel(modelData); + } + if (modelData.type === 'embedding') { + return testEmbeddingModel(modelData); + } + if (modelData.type === 'tts') { + return testTTSModel(modelData); + } + if (modelData.type === 'stt') { + return testSTTModel(modelData); + } + if (modelData.type === 'rerank') { + return testReRankModel(modelData); + } + + return Promise.reject('Model type not supported'); +} + +export default NextAPI(handler); + +const testLLMModel = async (model: LLMModelItemType) => { + const ai = getAIApi({}); + const response = await ai.chat.completions.create( + { + model: model.model, + messages: [{ role: 'user', content: 'hi' }], + stream: false, + max_tokens: 10 + }, + { + ...(model.requestUrl ? { path: model.requestUrl } : {}), + headers: { + ...(model.requestAuth ? { Authorization: `Bearer ${model.requestAuth}` } : {}) + } + } + ); + + const responseText = response.choices?.[0]?.message?.content; + + if (!responseText) { + return Promise.reject('Model response empty'); + } + + addLog.info(`Model test response: ${responseText}`); +}; + +const testEmbeddingModel = async (model: EmbeddingModelItemType) => { + return getVectorsByText({ + input: 'Hi', + model + }); +}; + +const testTTSModel = async (model: TTSModelType) => { + const ai = getAIApi(); + await ai.audio.speech.create( + { + model: model.model, + voice: model.voices[0]?.value as any, + input: 'Hi', + response_format: 'mp3', + speed: 1 + }, + model.requestUrl && model.requestAuth + ? { + path: model.requestUrl, + headers: { + Authorization: `Bearer ${model.requestAuth}` + } + } + : {} + ); +}; + +const testSTTModel = async (model: STTModelType) => { + const path = isProduction ? '/app/data/test.mp3' : 'data/test.mp3'; + const { text } = await aiTranscriptions({ + model: model.model, + fileStream: fs.createReadStream(path) + }); + addLog.info(`STT result: ${text}`); +}; + +const testReRankModel = async (model: ReRankModelItemType) => { + await reRankRecall({ + query: 'Hi', + documents: [{ id: '1', text: 'Hi' }] + }); +}; diff --git a/projects/app/src/pages/api/core/ai/model/updateWithJson.ts b/projects/app/src/pages/api/core/ai/model/updateWithJson.ts index 74e05546f..1efd3b109 100644 --- a/projects/app/src/pages/api/core/ai/model/updateWithJson.ts +++ b/projects/app/src/pages/api/core/ai/model/updateWithJson.ts @@ -39,6 +39,9 @@ async function handler( return Promise.reject(`${item.model} metadata.provider is required`); } item.metadata.model = item.model.trim(); + if (!item.metadata.name) { + item.metadata.name = item.model; + } } await mongoSessionRun(async (session) => { diff --git a/projects/app/src/pages/api/core/dataset/data/getQuoteData.ts b/projects/app/src/pages/api/core/dataset/data/getQuoteData.ts new file mode 100644 index 000000000..d99642979 --- /dev/null +++ b/projects/app/src/pages/api/core/dataset/data/getQuoteData.ts @@ -0,0 +1,34 @@ +import type { NextApiRequest } from 'next'; +import { NextAPI } from '@/service/middleware/entry'; +import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant'; +import { authDatasetData } from '@fastgpt/service/support/permission/dataset/auth'; +import { CollectionWithDatasetType } from '@fastgpt/global/core/dataset/type'; + +export type GetQuoteDataResponse = { + collection: CollectionWithDatasetType; + q: string; + a: string; +}; + +async function handler(req: NextApiRequest): Promise { + const { id: dataId } = req.query as { + id: string; + }; + + // 凭证校验 + const { datasetData, collection } = await authDatasetData({ + req, + authToken: true, + authApiKey: true, + dataId, + per: ReadPermissionVal + }); + + return { + collection, + q: datasetData.q, + a: datasetData.a + }; +} + +export default NextAPI(handler); diff --git a/projects/app/src/service/common/system/index.ts b/projects/app/src/service/common/system/index.ts index eb33103ce..83337c470 100644 --- a/projects/app/src/service/common/system/index.ts +++ b/projects/app/src/service/common/system/index.ts @@ -1,14 +1,12 @@ import { initHttpAgent } from '@fastgpt/service/common/middle/httpAgent'; -import fs, { existsSync, readdirSync } from 'fs'; +import fs, { existsSync } from 'fs'; import type { FastGPTFeConfigsType } from '@fastgpt/global/common/system/types/index.d'; import type { FastGPTConfigFileType } from '@fastgpt/global/common/system/types/index.d'; -import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants'; import { getFastGPTConfigFromDB } from '@fastgpt/service/common/system/config/controller'; import { FastGPTProUrl } from '@fastgpt/service/common/system/constants'; import { isProduction } from '@fastgpt/global/common/system/constants'; import { initFastGPTConfig } from '@fastgpt/service/common/system/tools'; import json5 from 'json5'; -import { SystemPluginTemplateItemType } from '@fastgpt/global/core/workflow/type'; import { defaultGroup, defaultTemplateTypes } from '@fastgpt/web/core/workflow/constants'; import { MongoPluginGroups } from '@fastgpt/service/core/app/plugin/pluginGroupSchema'; import { MongoTemplateTypes } from '@fastgpt/service/core/app/templates/templateTypeSchema'; @@ -48,14 +46,7 @@ export function initGlobalVariables() { /* Init system data(Need to connected db). It only needs to run once */ export async function getInitConfig() { - return Promise.all([ - initSystemConfig(), - getSystemVersion(), - loadSystemModels(), - - // abandon - getSystemPlugin() - ]); + return Promise.all([initSystemConfig(), getSystemVersion(), loadSystemModels()]); } const defaultFeConfigs: FastGPTFeConfigsType = { @@ -129,34 +120,6 @@ async function getSystemVersion() { } } -async function getSystemPlugin() { - if (global.communityPlugins && global.communityPlugins.length > 0) return; - - const basePath = - process.env.NODE_ENV === 'development' ? 'data/pluginTemplates' : '/app/data/pluginTemplates'; - // read data/pluginTemplates directory, get all json file - const files = readdirSync(basePath); - // filter json file - const filterFiles = files.filter((item) => item.endsWith('.json')); - - // read json file - const fileTemplates = await Promise.all( - filterFiles.map>(async (filename) => { - const content = await fs.promises.readFile(`${basePath}/${filename}`, 'utf-8'); - return { - ...json5.parse(content), - originCost: 0, - currentCost: 0, - id: `${PluginSourceEnum.community}-${filename.replace('.json', '')}` - }; - }) - ); - - fileTemplates.sort((a, b) => (b.weight || 0) - (a.weight || 0)); - - global.communityPlugins = fileTemplates; -} - export async function initSystemPluginGroups() { try { const { groupOrder, ...restDefaultGroup } = defaultGroup; diff --git a/projects/app/src/web/core/ai/config.ts b/projects/app/src/web/core/ai/config.ts index 30a2cc2f9..62afaad31 100644 --- a/projects/app/src/web/core/ai/config.ts +++ b/projects/app/src/web/core/ai/config.ts @@ -1,4 +1,4 @@ -import { GET, PUT, DELETE } from '@/web/common/api/request'; +import { GET, PUT, DELETE, POST } from '@/web/common/api/request'; import type { listResponse } from '@/pages/api/core/ai/model/list'; import type { updateBody } from '@/pages/api/core/ai/model/update'; import type { deleteQuery } from '@/pages/api/core/ai/model/delete'; @@ -16,3 +16,5 @@ export const deleteSystemModel = (data: deleteQuery) => DELETE('/core/ai/model/d export const getModelConfigJson = () => GET('/core/ai/model/getConfigJson'); export const putUpdateWithJson = (data: updateWithJsonBody) => PUT('/core/ai/model/updateWithJson', data); + +export const getTestModel = (model: String) => GET('/core/ai/model/test', { model }); diff --git a/projects/app/src/web/core/dataset/api.ts b/projects/app/src/web/core/dataset/api.ts index ac40e1a02..966b3361b 100644 --- a/projects/app/src/web/core/dataset/api.ts +++ b/projects/app/src/web/core/dataset/api.ts @@ -65,6 +65,7 @@ import type { listExistIdQuery, listExistIdResponse } from '@/pages/api/core/dataset/apiDataset/listExistId'; +import { GetQuoteDataResponse } from '@/pages/api/core/dataset/data/getQuoteData'; /* ======================== dataset ======================= */ export const getDatasets = (data: GetDatasetListBody) => @@ -203,6 +204,10 @@ export const putDatasetDataById = (data: UpdateDatasetDataProps) => export const delOneDatasetDataById = (id: string) => DELETE(`/core/dataset/data/delete`, { id }); +// Get quote data +export const getQuoteData = (id: string) => + GET(`/core/dataset/data/getQuoteData`, { id }); + /* ================ training ==================== */ export const postRebuildEmbedding = (data: rebuildEmbeddingBody) => POST(`/core/dataset/training/rebuildEmbedding`, data);