Commit 4d90b720 by YeYuheng Committed by GitHub

docs: update docs and fix portal tool calls (#7194)

parent 7e333e85
...@@ -5,7 +5,7 @@ description: FastGPT AI settings explained ...@@ -5,7 +5,7 @@ description: FastGPT AI settings explained
import { Alert } from '@/components/docs/Alert'; import { Alert } from '@/components/docs/Alert';
AI settings control how AI Chat nodes behave in apps and Workflows, including model selection, response length, image recognition, response format, and reasoning display. This guide explains what each option in the settings modal means and how to choose values for common scenarios. AI settings control how AI Chat nodes behave in apps and Workflows, including model selection, response length, multimodal recognition, response format, and reasoning display. This guide explains what each option in the settings modal means and how to choose values for common scenarios.
## Where to Find It ## Where to Find It
...@@ -14,28 +14,30 @@ In the app editor, find the **AI Settings** section, select an AI model, and cli ...@@ -14,28 +14,30 @@ In the app editor, find the **AI Settings** section, select an AI model, and cli
In a Workflow, click the AI model configuration for the **AI Chat** node. You can open the same settings modal from the settings button on the right. In a Workflow, click the AI model configuration for the **AI Chat** node. You can open the same settings modal from the settings button on the right.
<Alert icon="🤖" context="success"> <Alert icon="🤖" context="success">
If you do not have specific requirements, selecting a suitable AI model and keeping the other settings at their defaults is usually enough. If you do not have specific requirements, selecting a suitable AI model and keeping the other
settings at their defaults is usually enough.
</Alert> </Alert>
| | | | | | | |
| --- | --- | --- | | ------------------------------- | ------------------------------- | ------------------------------- |
| ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) | | ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) |
## Why Some Options May Be Hidden ## Why Some Options May Be Hidden
Not every option is always shown. The modal only displays settings supported by the selected model. For example, if a model does not support image recognition, the image recognition switch is hidden. If a model does not support reasoning settings, those options are hidden as well. Not every option is always shown. The modal only displays settings supported by the selected model. For example, if a model does not support multimodal recognition, multimodal options are hidden. If a model does not support reasoning settings, those options are hidden as well.
## Basic Settings ## Basic Settings
### AI Model ### AI Model
Select the AI model used by the current app or node. Different models vary in response quality, cost, context length, and tool calling capability. Select the AI model used by the current app or node. Different models vary in response quality, cost, context length, tool calling capability, and multimodal capability.
The model section displays three types of information: The model section displays several types of information:
- **Credit cost**: A reference cost for model calls. Input content and model output are usually priced separately. - **Credit cost**: A reference cost for model calls. Input content and model output are usually priced separately.
- **Max context**: The amount of content the model can reference in one request. A larger context window is better for long documents and long conversations. - **Max context**: The amount of content the model can reference in one request. A larger context window is better for long documents and long conversations.
- **Tool calling**: If supported, the model can use selected app tools to query data, run calculations, or call external capabilities. - **Tool calling**: If supported, the model can use selected app tools to query data, run calculations, or call external capabilities.
- **Multimodal capability**: If the model supports image, audio, or video input, you can enable the corresponding multimodal recognition capability in AI Settings. Different models may support different media types. Use the capabilities shown in the settings modal as the source of truth.
### Max Histories ### Max Histories
...@@ -85,13 +87,24 @@ For regular chat, customer support, and Knowledge Base Q&A, keep the default. Ch ...@@ -85,13 +87,24 @@ For regular chat, customer support, and Knowledge Base Q&A, keep the default. Ch
If you select `json_schema`, you also need to provide the corresponding schema. This option is suitable when the model must return content in a fixed structure. If you select `json_schema`, you also need to provide the corresponding schema. This option is suitable when the model must return content in a fixed structure.
### Image Recognition ### Multimodal Recognition
If the selected model supports image recognition, this setting controls whether the AI can read images. If the selected model is configured with multimodal capability, this setting controls whether the AI can read images, audio, or video from user input.
When enabled, the AI can read user-uploaded images or image content from file links. For example, if a user uploads a screenshot, poster, or table image, the model can answer based on the image content. The available types depend on the model itself. If a model only supports images, only image recognition can be enabled. If it supports images, audio, or video, you can select the needed types.
If the modal shows that the selected model does not support image recognition, switch to a model that supports it. When enabled, the AI Chat node converts matching uploaded files, or matching media links in the user's question, into model-readable input before sending the request. For example:
- Image recognition: for screenshots, table images, product images, posters, and similar image content.
- Audio recognition: for models that can understand uploaded audio content.
- Video recognition: for models that can understand uploaded video content.
Keep these limits in mind:
1. Even after a type is enabled, the request is filtered again by the actual model capability before it is sent. Unsupported media types are not sent to the model.
2. Media links in the user's question are only parsed when "Extract multimodal files from links" is enabled. Currently, extraction is attempted only when the user's question is under 500 characters, with at most 4 media links processed at a time.
3. Regular document files are not sent directly to the LLM as multimodal input. Documents still need to be parsed into text first.
4. Multimodal recognition depends on the model's own capability. If the modal says the model does not support multimodal recognition, switch to a model that supports the needed media type.
### Hide AI Output ### Hide AI Output
...@@ -115,7 +128,7 @@ Reasoning effort follows OpenAI's `reasoning_effort` convention, with ai-proxy a ...@@ -115,7 +128,7 @@ Reasoning effort follows OpenAI's `reasoning_effort` convention, with ai-proxy a
<summary>OpenAI-Compatible Enum and Default Budget Mapping</summary> <summary>OpenAI-Compatible Enum and Default Budget Mapping</summary>
| FastGPT option | OpenAI-compatible value | Default budget | | FastGPT option | OpenAI-compatible value | Default budget |
| --- | --- | --- | | -------------- | ----------------------------------------- | --------------------- |
| Default | Do not explicitly send `reasoning_effort` | Use the model default | | Default | Do not explicitly send `reasoning_effort` | Use the model default |
| None | `none` | `0` | | None | `none` | `0` |
| Minimal | `minimal` | `1024` | | Minimal | `minimal` | `1024` |
...@@ -132,7 +145,7 @@ If an upstream provider only supports a token budget instead of discrete effort ...@@ -132,7 +145,7 @@ If an upstream provider only supports a token budget instead of discrete effort
<summary>OpenAI / OpenAI Responses</summary> <summary>OpenAI / OpenAI Responses</summary>
| Target format | Output field | Mapping | | Target format | Output field | Mapping |
| --- | --- | --- | | ------------------------- | ------------------ | ------------------------------------------------- |
| OpenAI Chat / Completions | `reasoning_effort` | Writes `none/minimal/low/medium/high/xhigh` as-is | | OpenAI Chat / Completions | `reasoning_effort` | Writes `none/minimal/low/medium/high/xhigh` as-is |
| OpenAI Responses | `reasoning.effort` | Writes `none/minimal/low/medium/high/xhigh` as-is | | OpenAI Responses | `reasoning.effort` | Writes `none/minimal/low/medium/high/xhigh` as-is |
...@@ -146,7 +159,7 @@ OpenAI Chat / Completions only parses `reasoning_effort`. When Gemini, Claude, o ...@@ -146,7 +159,7 @@ OpenAI Chat / Completions only parses `reasoning_effort`. When Gemini, Claude, o
Gemini native requests are parsed from `generationConfig.thinkingConfig`, including `thinkingLevel`, `thinkingBudget`, and `includeThoughts`. When writing to Gemini upstreams, ai-proxy chooses either `thinkingLevel` or `thinkingBudget` based on the model family. Gemini native requests are parsed from `generationConfig.thinkingConfig`, including `thinkingLevel`, `thinkingBudget`, and `includeThoughts`. When writing to Gemini upstreams, ai-proxy chooses either `thinkingLevel` or `thinkingBudget` based on the model family.
| OpenAI-compatible value | Gemini 3+ Pro | Gemini 3+ non-Pro | gemini-2.5-pro | gemini-2.5-flash | gemini-2.5-flash-lite | | OpenAI-compatible value | Gemini 3+ Pro | Gemini 3+ non-Pro | gemini-2.5-pro | gemini-2.5-flash | gemini-2.5-flash-lite |
| --- | --- | --- | --- | --- | --- | | ----------------------- | -------------------- | ----------------------- | ---------------------- | ---------------------- | ---------------------- |
| `none` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=128` | `thinkingBudget=0` | `thinkingBudget=0` | | `none` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=128` | `thinkingBudget=0` | `thinkingBudget=0` |
| `minimal` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=1024` | `thinkingBudget=1024` | `thinkingBudget=1024` | | `minimal` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=1024` | `thinkingBudget=1024` | `thinkingBudget=1024` |
| `low` | `thinkingLevel=low` | `thinkingLevel=low` | `thinkingBudget=2048` | `thinkingBudget=2048` | `thinkingBudget=2048` | | `low` | `thinkingLevel=low` | `thinkingLevel=low` | `thinkingBudget=2048` | `thinkingBudget=2048` | `thinkingBudget=2048` |
...@@ -164,7 +177,7 @@ Gemini 2.5 models clamp the budget to the model's supported range. Some Gemini m ...@@ -164,7 +177,7 @@ Gemini 2.5 models clamp the budget to the model's supported range. Some Gemini m
Claude native requests are parsed from `thinking` and `output_config`. When writing to Anthropic, AWS Bedrock Claude, or Vertex AI Claude, the payload still follows Claude's thinking format. Claude native requests are parsed from `thinking` and `output_config`. When writing to Anthropic, AWS Bedrock Claude, or Vertex AI Claude, the payload still follows Claude's thinking format.
| OpenAI-compatible value | Legacy / budget mode | Adaptive mode | | OpenAI-compatible value | Legacy / budget mode | Adaptive mode |
| --- | --- | --- | | ----------------------- | ---------------------------------------------- | ---------------------------------------------------------------------- |
| `none` | `thinking.type=disabled` | `thinking.type=disabled`; may be removed for some adaptive-only models | | `none` | `thinking.type=disabled` | `thinking.type=disabled`; may be removed for some adaptive-only models |
| `minimal` | `thinking.type=enabled`, `budget_tokens=1024` | `thinking.type=adaptive`, `output_config.effort=low` | | `minimal` | `thinking.type=enabled`, `budget_tokens=1024` | `thinking.type=adaptive`, `output_config.effort=low` |
| `low` | `thinking.type=enabled`, `budget_tokens=2048` | `thinking.type=adaptive`, `output_config.effort=low` | | `low` | `thinking.type=enabled`, `budget_tokens=2048` | `thinking.type=adaptive`, `output_config.effort=low` |
...@@ -180,7 +193,7 @@ Budget mode ensures `budget_tokens < max_tokens` and raises too-small budgets to ...@@ -180,7 +193,7 @@ Budget mode ensures `budget_tokens < max_tokens` and raises too-small budgets to
<summary>Ali DashScope / Qwen / QwQ / GLM / Kimi-Compatible Models</summary> <summary>Ali DashScope / Qwen / QwQ / GLM / Kimi-Compatible Models</summary>
| OpenAI-compatible value | Models with `thinking_budget` support | Models without budget support | | OpenAI-compatible value | Models with `thinking_budget` support | Models without budget support |
| --- | --- | --- | | ----------------------- | ------------------------------------------------- | ----------------------------- |
| `none` | `enable_thinking=false`; remove `thinking_budget` | `enable_thinking=false` | | `none` | `enable_thinking=false`; remove `thinking_budget` | `enable_thinking=false` |
| `minimal` | `enable_thinking=true`, `thinking_budget=1024` | `enable_thinking=true` | | `minimal` | `enable_thinking=true`, `thinking_budget=1024` | `enable_thinking=true` |
| `low` | `enable_thinking=true`, `thinking_budget=2048` | `enable_thinking=true` | | `low` | `enable_thinking=true`, `thinking_budget=2048` | `enable_thinking=true` |
...@@ -198,7 +211,7 @@ ai-proxy currently treats `qwen3-*`, `qwq-*`, and Ali-compatible models whose na ...@@ -198,7 +211,7 @@ ai-proxy currently treats `qwen3-*`, `qwq-*`, and Ali-compatible models whose na
These providers currently preserve only the on/off meaning. They do not preserve budget or fine-grained effort levels. These providers currently preserve only the on/off meaning. They do not preserve budget or fine-grained effort levels.
| Provider | OpenAI-compatible value | Upstream field | | Provider | OpenAI-compatible value | Upstream field |
| --- | --- | --- | | --------------------------------------------- | ------------------------------- | --------------------------------------------------- |
| Zhipu / DeepSeek / Doubao | `none` | `thinking.type=disabled` | | Zhipu / DeepSeek / Doubao | `none` | `thinking.type=disabled` |
| Zhipu / DeepSeek / Doubao | `minimal/low/medium/high/xhigh` | `thinking.type=enabled` | | Zhipu / DeepSeek / Doubao | `minimal/low/medium/high/xhigh` | `thinking.type=enabled` |
| Moonshot / Kimi models with switch support | `none` | `thinking.type=disabled`; remove `reasoning_effort` | | Moonshot / Kimi models with switch support | `none` | `thinking.type=disabled`; remove `reasoning_effort` |
......
...@@ -5,7 +5,7 @@ description: FastGPT AI 配置说明 ...@@ -5,7 +5,7 @@ description: FastGPT AI 配置说明
import { Alert } from '@/components/docs/Alert'; import { Alert } from '@/components/docs/Alert';
AI 配置用于调整应用或工作流中 AI 对话节点的模型、回复长度、图片识别、回复格式和思考展示等行为。本文主要介绍配置弹窗中的各项含义,以及常见场景下的选择方式。 AI 配置用于调整应用或工作流中 AI 对话节点的模型、回复长度、多模态识别、回复格式和思考展示等行为。本文主要介绍配置弹窗中的各项含义,以及常见场景下的选择方式。
## 配置入口 ## 配置入口
...@@ -18,24 +18,25 @@ AI 配置用于调整应用或工作流中 AI 对话节点的模型、回复长 ...@@ -18,24 +18,25 @@ AI 配置用于调整应用或工作流中 AI 对话节点的模型、回复长
</Alert> </Alert>
| | | | | | | |
| --- | --- | --- | | ------------------------------- | ------------------------------- | ------------------------------- |
| ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) | | ![alt text](/imgs/image-51.png) | ![alt text](/imgs/image-52.png) | ![alt text](/imgs/image-53.png) |
## 配置会不会都显示? ## 配置会不会都显示?
不会。弹窗会根据当前模型的能力显示可用配置。例如,模型不支持图片识别时,不会提供图片识别开关;模型不支持思考配置时,也不会显示对应选项。 不会。弹窗会根据当前模型的能力显示可用配置。例如,模型不支持多模态识别时,不会提供多模态识别选项;模型不支持思考配置时,也不会显示对应选项。
## 基础配置 ## 基础配置
### AI 模型 ### AI 模型
用于选择当前应用或节点使用的 AI 模型。不同模型在回答能力、价格、可处理内容长度、工具调用能力等方面会有差异。 用于选择当前应用或节点使用的 AI 模型。不同模型在回答能力、价格、可处理内容长度、工具调用能力、多模态能力等方面会有差异。
模型下面会显示三类信息: 模型下面会显示几类信息:
- **积分价格**:模型调用时的积分消耗参考,通常会区分输入内容和模型回复。 - **积分价格**:模型调用时的积分消耗参考,通常会区分输入内容和模型回复。
- **最大上下文**:模型单次请求可参考的内容长度。数值越大,越适合长文档、长对话等场景。 - **最大上下文**:模型单次请求可参考的内容长度。数值越大,越适合长文档、长对话等场景。
- **工具调用**:如果显示支持,说明该模型可以配合应用中选择的工具完成查询、计算或外部能力调用。 - **工具调用**:如果显示支持,说明该模型可以配合应用中选择的工具完成查询、计算或外部能力调用。
- **多模态能力**:如果模型支持图片、音频或视频输入,可以在 AI 配置中开启对应的多模态识别能力。不同模型支持的媒体类型可能不同,具体以配置弹窗中显示的能力为准。
### 记忆轮数 ### 记忆轮数
...@@ -85,13 +86,24 @@ Top_p 也是控制回复随机性的参数,作用和温度有一定重叠。 ...@@ -85,13 +86,24 @@ Top_p 也是控制回复随机性的参数,作用和温度有一定重叠。
如果选择 `json_schema`,还需要填写对应的格式要求。该选项适合需要模型按固定结构返回内容的场景。 如果选择 `json_schema`,还需要填写对应的格式要求。该选项适合需要模型按固定结构返回内容的场景。
### 图片识别 ### 多模态识别
如果模型支持图片识别,这里可以控制 AI 是否读取图片。 如果当前模型配置了多模态能力,这里可以控制 AI 是否读取用户输入中的图片、音频或视频内容。
打开后,AI 可以读取用户上传的图片,或识别文件链接中的图片内容。例如用户上传截图、海报或表格图片时,模型可以结合图片内容进行回答。 可选择的类型取决于模型本身的能力。模型只支持图片时,只能开启图片识别;模型同时支持图片、音频或视频时,可以按需选择对应类型。
如果弹窗里显示“该模型不支持图片识别”,需要换成支持图片识别的模型。 打开后,AI 对话节点会在请求模型前,将用户上传的对应类型文件,或用户问题中的对应媒体链接,转换为模型可识别的输入。例如:
- 图片识别:用于识别截图、表格图片、商品图、海报等图片内容。
- 音频识别:用于让支持音频输入的模型理解用户上传的音频内容。
- 视频识别:用于让支持视频输入的模型理解用户上传的视频内容。
需要注意:
1. 即使开启了某类识别,请求发送前也会再次根据模型能力过滤,不支持的类型不会发送给模型。
2. 用户问题中的媒体链接需要开启“提取链接中的多模态文件”后才会尝试解析。当前仅在用户问题少于 500 字时尝试提取,且一次最多处理 4 个媒体链接。
3. 普通文档文件不会作为多模态输入直接发送给 LLM,文档内容仍需要通过文件解析转成文本。
4. 多模态识别依赖模型本身能力。如果弹窗里显示“该模型不支持多模态识别”,需要换成支持对应多模态输入的模型。
### 隐藏 AI 输出 ### 隐藏 AI 输出
...@@ -115,7 +127,7 @@ Top_p 也是控制回复随机性的参数,作用和温度有一定重叠。 ...@@ -115,7 +127,7 @@ Top_p 也是控制回复随机性的参数,作用和温度有一定重叠。
<summary>OpenAI 兼容枚举与默认 budget 映射</summary> <summary>OpenAI 兼容枚举与默认 budget 映射</summary>
| FastGPT 选项 | OpenAI 兼容值 | 默认 budget | | FastGPT 选项 | OpenAI 兼容值 | 默认 budget |
| --- | --- | --- | | ------------ | ----------------------------- | -------------- |
| 默认 | 不显式传递 `reasoning_effort` | 使用模型默认值 | | 默认 | 不显式传递 `reasoning_effort` | 使用模型默认值 |
| 不思考 | `none` | `0` | | 不思考 | `none` | `0` |
| 极简思考 | `minimal` | `1024` | | 极简思考 | `minimal` | `1024` |
...@@ -132,7 +144,7 @@ Top_p 也是控制回复随机性的参数,作用和温度有一定重叠。 ...@@ -132,7 +144,7 @@ Top_p 也是控制回复随机性的参数,作用和温度有一定重叠。
<summary>OpenAI / OpenAI Responses</summary> <summary>OpenAI / OpenAI Responses</summary>
| 目标格式 | 写入字段 | 映射方式 | | 目标格式 | 写入字段 | 映射方式 |
| --- | --- | --- | | ------------------------- | ------------------ | --------------------------------------------- |
| OpenAI Chat / Completions | `reasoning_effort` | `none/minimal/low/medium/high/xhigh` 原样写入 | | OpenAI Chat / Completions | `reasoning_effort` | `none/minimal/low/medium/high/xhigh` 原样写入 |
| OpenAI Responses | `reasoning.effort` | `none/minimal/low/medium/high/xhigh` 原样写入 | | OpenAI Responses | `reasoning.effort` | `none/minimal/low/medium/high/xhigh` 原样写入 |
...@@ -146,7 +158,7 @@ OpenAI Chat / Completions 模式只解析 `reasoning_effort`。当 Gemini、Clau ...@@ -146,7 +158,7 @@ OpenAI Chat / Completions 模式只解析 `reasoning_effort`。当 Gemini、Clau
Gemini 原生请求会从 `generationConfig.thinkingConfig` 中解析 `thinkingLevel`、`thinkingBudget` 和 `includeThoughts`。写给 Gemini 上游时,ai-proxy 会根据模型系列选择 `thinkingLevel` 或 `thinkingBudget`。 Gemini 原生请求会从 `generationConfig.thinkingConfig` 中解析 `thinkingLevel`、`thinkingBudget` 和 `includeThoughts`。写给 Gemini 上游时,ai-proxy 会根据模型系列选择 `thinkingLevel` 或 `thinkingBudget`。
| OpenAI 兼容值 | Gemini 3+ Pro | Gemini 3+ 非 Pro | gemini-2.5-pro | gemini-2.5-flash | gemini-2.5-flash-lite | | OpenAI 兼容值 | Gemini 3+ Pro | Gemini 3+ 非 Pro | gemini-2.5-pro | gemini-2.5-flash | gemini-2.5-flash-lite |
| --- | --- | --- | --- | --- | --- | | ------------- | -------------------- | ----------------------- | ---------------------- | ---------------------- | ---------------------- |
| `none` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=128` | `thinkingBudget=0` | `thinkingBudget=0` | | `none` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=128` | `thinkingBudget=0` | `thinkingBudget=0` |
| `minimal` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=1024` | `thinkingBudget=1024` | `thinkingBudget=1024` | | `minimal` | `thinkingLevel=low` | `thinkingLevel=minimal` | `thinkingBudget=1024` | `thinkingBudget=1024` | `thinkingBudget=1024` |
| `low` | `thinkingLevel=low` | `thinkingLevel=low` | `thinkingBudget=2048` | `thinkingBudget=2048` | `thinkingBudget=2048` | | `low` | `thinkingLevel=low` | `thinkingLevel=low` | `thinkingBudget=2048` | `thinkingBudget=2048` | `thinkingBudget=2048` |
...@@ -164,13 +176,13 @@ Gemini 2.5 系列会按模型允许范围 clamp budget。部分 Gemini 模型不 ...@@ -164,13 +176,13 @@ Gemini 2.5 系列会按模型允许范围 clamp budget。部分 Gemini 模型不
Claude 原生请求会解析 `thinking` 和 `output_config`。写给 Anthropic 官方、AWS Bedrock Claude 或 Vertex AI Claude 时,字段形态仍遵循 Claude 的 thinking 规则。 Claude 原生请求会解析 `thinking` 和 `output_config`。写给 Anthropic 官方、AWS Bedrock Claude 或 Vertex AI Claude 时,字段形态仍遵循 Claude 的 thinking 规则。
| OpenAI 兼容值 | 旧式 / budget 模式 | adaptive 模式 | | OpenAI 兼容值 | 旧式 / budget 模式 | adaptive 模式 |
| --- | --- | --- | | ------------- | ----------------------------------------------- | --------------------------------------------------------------- |
| `none` | `thinking.type=disabled` | `thinking.type=disabled`,部分 adaptive-only 模型可能移除该字段 | | `none` | `thinking.type=disabled` | `thinking.type=disabled`,部分 adaptive-only 模型可能移除该字段 |
| `minimal` | `thinking.type=enabled`, `budget_tokens=1024` | `thinking.type=adaptive`, `output_config.effort=low` | | `minimal` | `thinking.type=enabled` , `budget_tokens=1024` | `thinking.type=adaptive` , `output_config.effort=low` |
| `low` | `thinking.type=enabled`, `budget_tokens=2048` | `thinking.type=adaptive`, `output_config.effort=low` | | `low` | `thinking.type=enabled` , `budget_tokens=2048` | `thinking.type=adaptive` , `output_config.effort=low` |
| `medium` | `thinking.type=enabled`, `budget_tokens=8192` | `thinking.type=adaptive`, `output_config.effort=medium` | | `medium` | `thinking.type=enabled` , `budget_tokens=8192` | `thinking.type=adaptive` , `output_config.effort=medium` |
| `high` | `thinking.type=enabled`, `budget_tokens=16384` | `thinking.type=adaptive`, `output_config.effort=high` | | `high` | `thinking.type=enabled` , `budget_tokens=16384` | `thinking.type=adaptive` , `output_config.effort=high` |
| `xhigh` | `thinking.type=enabled`, `budget_tokens=32768` | `thinking.type=adaptive`, `output_config.effort=max` | | `xhigh` | `thinking.type=enabled` , `budget_tokens=32768` | `thinking.type=adaptive` , `output_config.effort=max` |
budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提升到上游可接受的最小值。 budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提升到上游可接受的最小值。
...@@ -180,13 +192,13 @@ budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提 ...@@ -180,13 +192,13 @@ budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提
<summary>Ali DashScope / Qwen / QwQ / GLM / Kimi 兼容模型</summary> <summary>Ali DashScope / Qwen / QwQ / GLM / Kimi 兼容模型</summary>
| OpenAI 兼容值 | 支持 `thinking_budget` 的模型 | 不支持 budget 的模型 | | OpenAI 兼容值 | 支持 `thinking_budget` 的模型 | 不支持 budget 的模型 |
| --- | --- | --- | | ------------- | ------------------------------------------------ | ----------------------- |
| `none` | `enable_thinking=false`,移除 `thinking_budget` | `enable_thinking=false` | | `none` | `enable_thinking=false`,移除 `thinking_budget` | `enable_thinking=false` |
| `minimal` | `enable_thinking=true`, `thinking_budget=1024` | `enable_thinking=true` | | `minimal` | `enable_thinking=true` , `thinking_budget=1024` | `enable_thinking=true` |
| `low` | `enable_thinking=true`, `thinking_budget=2048` | `enable_thinking=true` | | `low` | `enable_thinking=true` , `thinking_budget=2048` | `enable_thinking=true` |
| `medium` | `enable_thinking=true`, `thinking_budget=8192` | `enable_thinking=true` | | `medium` | `enable_thinking=true` , `thinking_budget=8192` | `enable_thinking=true` |
| `high` | `enable_thinking=true`, `thinking_budget=16384` | `enable_thinking=true` | | `high` | `enable_thinking=true` , `thinking_budget=16384` | `enable_thinking=true` |
| `xhigh` | `enable_thinking=true`, `thinking_budget=32768` | `enable_thinking=true` | | `xhigh` | `enable_thinking=true` , `thinking_budget=32768` | `enable_thinking=true` |
当前 ai-proxy 会把 `qwen3-*`、`qwq-*`、模型名包含 `glm` 或 `kimi` 的 Ali-compatible 模型视为支持 `thinking_budget`。`qwen3-*` 非流式请求会被强制关闭 thinking,`qwq-*` 请求会被强制改为流式。 当前 ai-proxy 会把 `qwen3-*`、`qwq-*`、模型名包含 `glm` 或 `kimi` 的 Ali-compatible 模型视为支持 `thinking_budget`。`qwen3-*` 非流式请求会被强制关闭 thinking,`qwq-*` 请求会被强制改为流式。
...@@ -198,7 +210,7 @@ budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提 ...@@ -198,7 +210,7 @@ budget 模式会保证 `budget_tokens < max_tokens`,并把过小的 budget 提
这些平台当前主要保留开关语义,不保留 budget 或细粒度 effort。 这些平台当前主要保留开关语义,不保留 budget 或细粒度 effort。
| 平台 | OpenAI 兼容值 | 写给上游的字段 | | 平台 | OpenAI 兼容值 | 写给上游的字段 |
| --- | --- | --- | | -------------------------------- | ------------------------------- | --------------------------------------------------- |
| Zhipu / DeepSeek / Doubao | `none` | `thinking.type=disabled` | | Zhipu / DeepSeek / Doubao | `none` | `thinking.type=disabled` |
| Zhipu / DeepSeek / Doubao | `minimal/low/medium/high/xhigh` | `thinking.type=enabled` | | Zhipu / DeepSeek / Doubao | `minimal/low/medium/high/xhigh` | `thinking.type=enabled` |
| Moonshot / Kimi 支持开关的模型 | `none` | `thinking.type=disabled`,并移除 `reasoning_effort` | | Moonshot / Kimi 支持开关的模型 | `none` | `thinking.type=disabled`,并移除 `reasoning_effort` |
......
...@@ -3,8 +3,7 @@ title: File Input ...@@ -3,8 +3,7 @@ title: File Input
description: FastGPT file input feature overview description: FastGPT file input feature overview
--- ---
Starting from version 4.8.9, FastGPT supports configuring file and image uploads in both `Basic Mode` and `Workflows`. This guide covers how to use the file input feature and explains how document parsing works under the hood. Starting from version 4.8.9, FastGPT supports configuring file uploads in both `Basic Mode` and `Workflows`. This guide covers how to use file input and explains the difference between document parsing and multimodal file handling.
## Using in Basic Mode ## Using in Basic Mode
...@@ -31,7 +30,7 @@ In Workflows, find the `File Input` option in the system configuration panel and ...@@ -31,7 +30,7 @@ In Workflows, find the `File Input` option in the system configuration panel and
There are many ways to use files in Workflows. The simplest approach, shown below, connects document parsing via tool calling — achieving the same result as Basic Mode. There are many ways to use files in Workflows. The simplest approach, shown below, connects document parsing via tool calling — achieving the same result as Basic Mode.
| | | | | |
| --------------------- | --------------------- | | ---------------------- | ---------------------- |
| ![](/imgs/image-5.png) | ![](/imgs/image-6.png) | | ![](/imgs/image-5.png) | ![](/imgs/image-6.png) |
You can also use Workflows to extract or analyze document content, then pass the results to HTTP requests or other modules to build a document processing pipeline. You can also use Workflows to extract or analyze document content, then pass the results to HTTP requests or other modules to build a document processing pipeline.
...@@ -40,7 +39,7 @@ You can also use Workflows to extract or analyze document content, then pass the ...@@ -40,7 +39,7 @@ You can also use Workflows to extract or analyze document content, then pass the
## How Document Parsing Works ## How Document Parsing Works
Unlike image recognition, LLMs currently cannot parse documents directly. All document "understanding" is achieved by converting documents to text and injecting it into the prompt. The following FAQs explain how this works — understanding the mechanics helps you use document parsing more effectively in Workflows. Unlike multimodal recognition, LLMs currently cannot parse regular documents directly. All document "understanding" is achieved by converting documents to text and injecting it into the prompt. The following FAQs explain how this works — understanding the mechanics helps you use document parsing more effectively in Workflows.
### How are uploaded files stored in the database? ### How are uploaded files stored in the database?
...@@ -48,31 +47,37 @@ In FastGPT's chat history, messages with role=user store their value in this str ...@@ -48,31 +47,37 @@ In FastGPT's chat history, messages with role=user store their value in this str
```ts ```ts
type UserChatItemValueItemType = { type UserChatItemValueItemType = {
type: 'text' | 'file' type: 'text' | 'file';
text?: { text?: {
content: string; content: string;
}; };
file?: { file?: {
type: 'img' | 'doc' type: 'image' | 'audio' | 'video' | 'file';
name?: string; name?: string;
key?: string;
url: string; url: string;
}; };
}; };
``` ```
Uploaded images and documents are stored as URLs — the parsed document content is not stored. Uploaded files are stored as URLs — parsed document content is not stored.
### How are images, audio, and video handled?
The document parsing node does not parse multimodal files such as images, audio, or video. These files should be handled by an LLM that supports the corresponding multimodal capability, with multimodal recognition enabled in [AI Settings](./ai_settings).
### How are images handled? In practice, file input has two different handling paths:
The document parsing node does not process images. Image URLs are filtered out. For image recognition, use an LLM that supports vision. 1. Document parsing: handles document files such as PDF, Word, Excel, Markdown, and HTML, converts their content to text, and provides that text to the AI.
2. Multimodal recognition: handles media files such as images, audio, and video. FastGPT converts them into model-readable input, and a model with the corresponding capability reads them.
### How does the document parsing node work? ### How does the document parsing node work?
The document parsing node accepts an `array<string>` input (file URLs) and outputs a `string` (the parsed content). The document parsing node accepts an `array<string>` input (file URLs) and outputs a `string` (the parsed content).
* The node only parses URLs with document-type file extensions. If you upload both documents and images, images are ignored. - The node only parses URLs with document-type file extensions. If you upload both documents and multimodal files, multimodal files are ignored.
* **The document parsing node only processes files from the current workflow run, not files from chat history.** - **The document parsing node only processes files from the current workflow run, not files from chat history.**
* How multiple documents are concatenated: - How multiple documents are concatenated:
Multiple files are concatenated using the following template — filename + content, separated by `\n******\n`: Multiple files are concatenated using the following template — filename + content, separated by `\n******\n`:
......
...@@ -3,14 +3,13 @@ title: 鏂囦欢杈撳叆鍔熻兘浠嬬粛 ...@@ -3,14 +3,13 @@ title: 鏂囦欢杈撳叆鍔熻兘浠嬬粛
description: FastGPT 文件输入功能介绍 description: FastGPT 文件输入功能介绍
--- ---
从 4.8.9 版本起,FastGPT 支持在`简易模式`和`工作流`中,配置用户上传文件、图片功能。下面先简单介绍下如何使用文件输入功能,最后是介绍下文件解析的工作原理。 从 4.8.9 版本起,FastGPT 支持在 `简易模式` 和 `工作流` 中,配置用户上传文件功能。下面先简单介绍下如何使用文件输入功能,最后介绍文档解析和多模态文件处理的区别。
## 简易模式中使用 ## 简易模式中使用
简易模式打开文件上传后,会使用工具调用模式,也就是由模型自行决策,是否需要读取文件内容。 简易模式打开文件上传后,会使用工具调用模式,也就是由模型自行决策,是否需要读取文件内容。
可以找到左侧文件上传的配置项,点击其右侧的`开启`/`关闭`按键,即可打开配置弹窗。 可以找到左侧文件上传的配置项,点击其右侧的 `开启` / `关闭` 按键,即可打开配置弹窗。
![打开文件上传](/imgs/fileinpu-1.png) ![打开文件上传](/imgs/fileinpu-1.png)
...@@ -24,14 +23,14 @@ description: FastGPT 鏂囦欢杈撳叆鍔熻兘浠嬬粛 ...@@ -24,14 +23,14 @@ description: FastGPT 鏂囦欢杈撳叆鍔熻兘浠嬬粛
## 工作流中使用 ## 工作流中使用
工作流中,可以在系统配置中,找到`文件输入`配置项,点击其右侧的`开启`/`关闭`按键,即可打开配置弹窗。 工作流中,可以在系统配置中,找到 `文件输入` 配置项,点击其右侧的 `开启` / `关闭` 按键,即可打开配置弹窗。
![打开文件上传](/imgs/fileinpu-4.jpg) ![打开文件上传](/imgs/fileinpu-4.jpg)
在工作流中,使用文件的方式很多,最简单的就是类似下图中,直接通过工具调用接入文档解析,实现和简易模式一样的效果。 在工作流中,使用文件的方式很多,最简单的就是类似下图中,直接通过工具调用接入文档解析,实现和简易模式一样的效果。
| | | | | |
| --------------------- | --------------------- | | ---------------------- | ---------------------- |
| ![](/imgs/image-5.png) | ![](/imgs/image-6.png) | | ![](/imgs/image-5.png) | ![](/imgs/image-6.png) |
当然,你也可以在工作流中,对文档进行内容提取、内容分析等,然后将分析的结果传递给 HTTP 或者其他模块,从而实现文件处理的 SOP。 当然,你也可以在工作流中,对文档进行内容提取、内容分析等,然后将分析的结果传递给 HTTP 或者其他模块,从而实现文件处理的 SOP。
...@@ -40,7 +39,7 @@ description: FastGPT 鏂囦欢杈撳叆鍔熻兘浠嬬粛 ...@@ -40,7 +39,7 @@ description: FastGPT 鏂囦欢杈撳叆鍔熻兘浠嬬粛
## 文档解析工作原理 ## 文档解析工作原理
不同于图片识别,LLM 模型目前没有支持直接解析文档的能力,所有的文档“理解”都是通过文档转文字后拼接 prompt 实现。这里通过几个 FAQ 来解释文档解析的工作原理,理解文档解析的原理,可以更好的在工作流中使用文档解析功能。 不同于多模态识别,LLM 模型目前没有支持直接解析普通文档的能力,所有的文档“理解”都是通过文档转文字后拼接 prompt 实现。这里通过几个 FAQ 来解释文档解析的工作原理,理解文档解析的原理,可以更好的在工作流中使用文档解析功能。
### 上传的文件如何存储在数据库中 ### 上传的文件如何存储在数据库中
...@@ -48,31 +47,37 @@ FastGPT 鐨勫璇濊褰曞瓨鍌ㄧ粨鏋勪腑锛宺ole=user 鐨勬秷鎭紝value 鍊间細鎸変 ...@@ -48,31 +47,37 @@ FastGPT 鐨勫璇濊褰曞瓨鍌ㄧ粨鏋勪腑锛宺ole=user 鐨勬秷鎭紝value 鍊间細鎸変
```ts ```ts
type UserChatItemValueItemType = { type UserChatItemValueItemType = {
type: 'text' | 'file' type: 'text' | 'file';
text?: { text?: {
content: string; content: string;
}; };
file?: { file?: {
type: 'img' | 'doc' type: 'image' | 'audio' | 'video' | 'file';
name?: string; name?: string;
key?: string;
url: string; url: string;
}; };
}; };
``` ```
也就是说,上传的图片和文档,都会以 URL 的形式存储在库中,并不会存储`解析后的文档内容`。 也就是说,上传的文件都会以 URL 的形式存储在库中,并不会存储 `解析后的文档内容`。
### 图片、音频、视频如何处理
文档解析节点不会解析图片、音频、视频等多模态文件。这类文件需要交给支持对应多模态能力的 LLM 处理,并在 [AI 配置说明](./ai_settings) 中开启多模态识别。
### 图片如何处理 因此,文件输入中要区分两类处理方式:
文档解析节点不会处理图片,图片链接会被过滤,图片识别请直接使用支持图片识别的 LLM 模型。 1. 文档解析:处理 PDF、Word、Excel、Markdown、HTML 等文档文件,将内容转成文本后提供给 AI。
2. 多模态识别:处理图片、音频、视频等媒体文件,FastGPT 会将其转换为模型可接收的输入,再由支持对应能力的模型读取。
### 文档解析节点如何工作 ### 文档解析节点如何工作
文档解析依赖文档解析节点,这个节点会接收一个`array<string>`类型的输入,对应的是文件输入的 URL;输出的是一个`string`,对应的是文档解析后的内容。 文档解析依赖文档解析节点,这个节点会接收一个 `array<string>` 类型的输入,对应的是文件输入的 URL;输出的是一个 `string`,对应的是文档解析后的内容。
* 在文档解析节点中,只会解析`文档`类型的 URL,它是通过文件 URL 解析出来的`文名件后缀`去判断的。如果你同时选择了文档和图片,图片会被忽略。 - 在文档解析节点中,只会解析 `文档` 类型的 URL,它是通过文件 URL 解析出来的 `文件后缀` 去判断的。如果你同时选择了文档和多模态文件,多模态文件会被忽略。
* **文档解析节点,只会解析本轮工作流接收的文件,不会解析历史记录的文件。** - **文档解析节点,只会解析本轮工作流接收的文件,不会解析历史记录的文件。**
* 多个文档内容如何拼接的 - 多个文档内容如何拼接的
按下列的模板,对多个文件进行拼接,即文件名+文件内容的形式组成一个字符串,不同文档之间通过分隔符:`\n******\n` 进行分割。 按下列的模板,对多个文件进行拼接,即文件名+文件内容的形式组成一个字符串,不同文档之间通过分隔符:`\n******\n` 进行分割。
...@@ -83,11 +88,11 @@ ${content} ...@@ -83,11 +88,11 @@ ${content}
</Content> </Content>
``` ```
### AI节点中如何使用文档解析 ### AI 节点中如何使用文档解析
在 AI 节点(AI对话/工具调用)中,新增了一个文档链接的输入,可以直接引用文档的地址,从而实现文档内容的引用。 在 AI 节点(AI 对话/工具调用)中,新增了一个文档链接的输入,可以直接引用文档的地址,从而实现文档内容的引用。
它接收一个`Array<string>`类型的输入,最终这些 url 会被解析,并进行提示词拼接,放置在 role=system 的消息中。提示词模板如下: 它接收一个 `Array<string>` 类型的输入,最终这些 URL 会被解析,并进行提示词拼接,放置在 role=system 的消息中。提示词模板如下:
``` ```
将 <FilesContent></FilesContent> 中的内容作为本次对话的参考: 将 <FilesContent></FilesContent> 中的内容作为本次对话的参考:
...@@ -96,7 +101,7 @@ ${content} ...@@ -96,7 +101,7 @@ ${content}
</FilesContent> </FilesContent>
``` ```
# 4.8.13版本起,关于文件上传的更新 # 4.8.13 版本起,关于文件上传的更新
由于与 4.8.9 版本有些差异,尽管我们做了向下兼容,避免工作流立即不可用。但是请尽快的按新版本规则进行调整工作流,后续将会去除兼容性代码。 由于与 4.8.9 版本有些差异,尽管我们做了向下兼容,避免工作流立即不可用。但是请尽快的按新版本规则进行调整工作流,后续将会去除兼容性代码。
......
--- ---
title: Knowledge Base Search Methods and Parameters title: Knowledge Base Search Methods and Parameters
description: description: This section covers FastGPT's knowledge base architecture, including its QA
This section covers FastGPT's knowledge base architecture, including its QA
storage format and multi-vector mapping, to help you build better knowledge bases. It also explains each search parameter. This guide focuses on practical usage rather than in-depth theory. storage format and multi-vector mapping, to help you build better knowledge bases. It also explains each search parameter. This guide focuses on practical usage rather than in-depth theory.
--- ---
...@@ -9,9 +8,9 @@ description: ...@@ -9,9 +8,9 @@ description:
FastGPT uses an Embedding-based RAG approach for its knowledge base. To use FastGPT effectively, you need a basic understanding of how `Embedding` vectors work and their characteristics. FastGPT uses an Embedding-based RAG approach for its knowledge base. To use FastGPT effectively, you need a basic understanding of how `Embedding` vectors work and their characteristics.
Human text, images, videos, and other media cannot be directly understood by computers. To determine whether two pieces of text are similar or related, they typically need to be converted into a computer-readable format — vectors are one such method. Human text, images, and other media cannot be directly understood by computers. To determine whether two pieces of text are similar or related, they typically need to be converted into a computer-readable format — vectors are one such method.
A vector is essentially an array of numbers. The "distance" between two vectors can be calculated using mathematical formulas — the smaller the distance, the more similar the vectors. This maps back to text, images, videos, and other media to measure similarity between them. Vector search leverages this principle. A vector is essentially an array of numbers. The "distance" between two vectors can be calculated using mathematical formulas — the smaller the distance, the more similar the vectors. This maps back to text, images, and other media to measure similarity between them. Vector search leverages this principle.
Since text comes in many types with countless combinations, exact matching is hard to guarantee when converting to vectors for similarity comparison. In vector-based knowledge bases, a `top-k` recall approach is typically used — finding the top `k` most similar results and passing them to an LLM for further `semantic evaluation`, `logical reasoning`, and `summarization`, enabling knowledge base Q&A. This makes vector search the most critical step in the process. Since text comes in many types with countless combinations, exact matching is hard to guarantee when converting to vectors for similarity comparison. In vector-based knowledge bases, a `top-k` recall approach is typically used — finding the top `k` most similar results and passing them to an LLM for further `semantic evaluation`, `logical reasoning`, and `summarization`, enabling knowledge base Q&A. This makes vector search the most critical step in the process.
...@@ -19,7 +18,6 @@ Many factors affect vector search accuracy, including: vector model quality, dat ...@@ -19,7 +18,6 @@ Many factors affect vector search accuracy, including: vector model quality, dat
Retriever precision is relatively straightforward to address, and training vector models is more complex, so optimizing data and query quality becomes a key focus. Retriever precision is relatively straightforward to address, and training vector models is more complex, so optimizing data and query quality becomes a key focus.
### Improving Vector Search Accuracy ### Improving Vector Search Accuracy
1. Better tokenization and chunking: When a text segment has complete and singular structure and semantics, accuracy improves. Many systems optimize their tokenizers to preserve data completeness. 1. Better tokenization and chunking: When a text segment has complete and singular structure and semantics, accuracy improves. Many systems optimize their tokenizers to preserve data completeness.
...@@ -40,7 +38,7 @@ In FastGPT, a knowledge base consists of three parts: libraries, collections, an ...@@ -40,7 +38,7 @@ In FastGPT, a knowledge base consists of three parts: libraries, collections, an
FastGPT uses `PostgreSQL`'s `PG Vector` extension as the vector retriever, with `HNSW` indexing. `PostgreSQL` is used solely for vector search (this engine can be swapped for other databases), while `MongoDB` handles all other data storage. FastGPT uses `PostgreSQL`'s `PG Vector` extension as the vector retriever, with `HNSW` indexing. `PostgreSQL` is used solely for vector search (this engine can be swapped for other databases), while `MongoDB` handles all other data storage.
In `MongoDB`'s `dataset.datas` collection, vector source data is stored along with an `indexes` field that records corresponding vector IDs. This is an array, meaning a single data entry can map to multiple vectors. In `MongoDB`'s `dataset.datas` collection, vector source data is stored along with an `indexes` field that records corresponding vector IDs. This is an array, meaning a single data entry can map to multiple vectors. In addition to default text indexes, image content can also generate image description indexes or image vector indexes when the configured models support it.
In `PostgreSQL`, a `vector` field stores the vectors. During search, vectors are recalled first, then their IDs are used to look up the original data in `MongoDB`. If multiple vectors map to the same source data, they are merged and the highest vector score is used. In `PostgreSQL`, a `vector` field stores the vectors. During search, vectors are recalled first, then their IDs are used to look up the original data in `MongoDB`. If multiple vectors map to the same source data, they are merged and the highest vector score is used.
...@@ -54,20 +52,68 @@ You can add multiple vectors to a longer text so that if any one vector is match ...@@ -54,20 +52,68 @@ You can add multiple vectors to a longer text so that if any one vector is match
This means you can continuously improve data chunk accuracy through annotation. This means you can continuously improve data chunk accuracy through annotation.
### Search Pipeline ### Overall Search Strategy
A Knowledge Base search is not simply "user question -> vector database -> result." Depending on the input and search parameters, FastGPT combines text, images, semantic recall, full-text recall, query optimization, and reranking, then fuses multiple result paths into the final quoted content.
1. Use `Query Optimization` for coreference resolution and query expansion, improving multi-turn conversation search capability and semantic richness. 1. Use `Query Optimization` for coreference resolution and query expansion, improving multi-turn conversation search capability and semantic richness.
2. Use `Concat Query` to improve `Rerank` accuracy during multi-turn conversations. 2. Use `Semantic Search`, `Full-Text Search`, or `Hybrid Search` to recall candidate content.
3. Use `RRF` (Reciprocal Rank Fusion) to merge results from multiple search channels. 3. If the input contains images, use image description search or image vector search depending on model capability.
4. Use `Rerank` for secondary sorting to improve precision. 4. Use `RRF` (Reciprocal Rank Fusion) to merge results from multiple search channels.
5. Use `Rerank` for secondary sorting to improve text result relevance.
6. Apply similarity filtering and the reference limit to produce the final quoted content sent to the model.
![](/imgs/dataset_search_process.png) ![](/imgs/dataset_search_process.png)
### Image Search Method
In Knowledge Base search, images can participate in retrieval in addition to text questions. FastGPT handles images differently depending on the configured model capabilities.
Image search mainly works in two ways:
1. Image description search: If an available vision model is configured, the system can understand the image first, generate a text description, and use that description in regular text retrieval.
2. Image vector search: If the selected embedding model supports image input, the system can generate vectors for images directly and match them against image vectors in the Knowledge Base.
Image search is not a separate system outside the Knowledge Base. It adds an image-input path to the existing Knowledge Base search pipeline.
Common usage patterns include:
- Text-to-image search: enter text to find semantically related image content.
- Image-to-image search: enter an image to find visually or semantically similar image content.
- Text + image search: enter both text and an image, using the text question as an additional constraint on image search results.
Image search quality usually depends on image clarity, whether the image content is easy for the model to understand, whether a vision model is configured, and whether the embedding model supports image vectors.
Whether an image can be retrieved does not only depend on uploading an image at search time. It also depends on which indexes were created during ingestion:
| Knowledge Base capability | Text-only query | Image-only query | Text + image query |
| ------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------- |
| Regular embedding model, no vision model | Normal text retrieval | Usually unavailable | Mainly uses the text part |
| Regular embedding model with a vision model | Normal text retrieval | Converts the image into a description, then uses text retrieval | Text + image description participate in retrieval |
| Image-capable embedding model, no vision model | Normal text retrieval | Image vector retrieval | Text retrieval + image vector retrieval |
| Image-capable embedding model with a vision model | Text retrieval, including image descriptions | Image description + image vector retrieval | Text + image description + image vector retrieval |
So when image-to-image search performs poorly, do not only adjust search parameters. Also check whether the Knowledge Base is configured with a vision model or an image-capable embedding model, and whether valid image indexes were generated during ingestion.
### Result Ranking and Fusion
FastGPT fuses results from different recall paths instead of using only one path. Common paths include text vector recall, full-text recall, image description recall, image vector recall, and reranked results.
Keep these points in mind:
1. `Semantic Search` relies more on vector similarity and is better for natural-language questions and semantically related content.
2. `Full-Text Search` relies more on keyword matches and is better for IDs, model numbers, proper nouns, error codes, and other exact queries.
3. `Hybrid Search` uses both semantic recall and full-text recall, then merges the results with `RRF`.
4. `Rerank` re-sorts candidate text results and works best when the question is clear and there are enough candidates.
5. Image search adds image description or image vector results, which are then fused with text-side results.
This means final quoted content may not be strictly sorted by a single vector similarity score. Content matched by multiple recall paths is usually more likely to rank higher.
## Search Parameters ## Search Parameters
| | | | | | | |
| --- |---| --- | | ------------------------------------- | ------------------------------------- | ------------------------------------- |
|![](/imgs/dataset_search_params1.png)| ![](/imgs/dataset_search_params2.png) | ![](/imgs/dataset_search_params3.png) | | ![](/imgs/dataset_search_params1.png) | ![](/imgs/dataset_search_params2.png) | ![](/imgs/dataset_search_params3.png) |
### Search Modes ### Search Modes
...@@ -76,11 +122,13 @@ This means you can continuously improve data chunk accuracy through annotation. ...@@ -76,11 +122,13 @@ This means you can continuously improve data chunk accuracy through annotation.
Semantic search calculates the vector distance between the user's query and knowledge base content to determine "similarity" — mathematical similarity, not linguistic. Semantic search calculates the vector distance between the user's query and knowledge base content to determine "similarity" — mathematical similarity, not linguistic.
Pros: Pros:
- Understands similar semantics - Understands similar semantics
- Cross-language understanding (e.g., Chinese query matching English content) - Cross-language understanding (e.g., Chinese query matching English content)
- Multimodal understanding (text, images, audio/video, etc.) - Multimodal understanding (text, images, etc., depending on model capability)
Cons: Cons:
- Depends on model training quality - Depends on model training quality
- Inconsistent accuracy - Inconsistent accuracy
- Affected by keywords and sentence completeness - Affected by keywords and sentence completeness
...@@ -115,6 +163,8 @@ A value between `0-1` that filters out low-relevance search results. ...@@ -115,6 +163,8 @@ A value between `0-1` that filters out low-relevance search results.
This only takes effect when using `Semantic Search` or `Result Reranking`. This only takes effect when using `Semantic Search` or `Result Reranking`.
Note that minimum relevance is a filtering threshold, not the final sorting rule. After query optimization, hybrid search, image search, or result reranking is enabled, final results may be fused from multiple recall paths and may not be strictly sorted by a single vector similarity score.
### Query Optimization ### Query Optimization
#### Background #### Background
...@@ -132,3 +182,20 @@ When the user asks "What's the second point?", the system searches for "What's t ...@@ -132,3 +182,20 @@ When the user asks "What's the second point?", the system searches for "What's t
#### How It Works #### How It Works
Before performing `data retrieval`, the model first performs `coreference resolution` and `query expansion`. This resolves ambiguous references and enriches the query's semantic content. You can view the optimized query in the conversation details after each interaction. Before performing `data retrieval`, the model first performs `coreference resolution` and `query expansion`. This resolves ambiguous references and enriches the query's semantic content. You can view the optimized query in the conversation details after each interaction.
Query Optimization adds an extra model call before the actual search. It often improves retrieval in multi-turn conversations, but it also increases total latency. If the current question is already clear, or response speed is more important, decide whether to enable it based on actual results.
### Common Tuning Tips
If search results are not as expected, start from the symptom. Avoid changing every parameter at once.
| Symptom | What to check or adjust first |
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| No results found | Confirm the data has finished training; lower the minimum relevance; increase the reference limit; check whether the question is too short or missing a subject |
| Results are too broad or off-topic | Raise the minimum relevance; reduce the reference limit; improve chunking; check whether recalled content contains too many unrelated chunks |
| IDs, model numbers, or proper nouns are inaccurate | Use full-text or hybrid search; reduce semantic search weight; avoid overusing query optimization for exact ID queries |
| Natural-language questions do not retrieve well | Use semantic or hybrid search; enable query optimization; add more accurate indexes to the data |
| Query optimization makes search slower | Query optimization adds an extra model call. Use a faster optimization model, or enable it only for follow-up questions and short queries |
| Rerank still gives poor ordering | Check whether the user question is complete; make sure enough candidates are recalled; adjust minimum relevance and reference limit |
| Image-to-image search is weak | Confirm the embedding model supports image input; confirm image vector indexes were generated during ingestion; check whether the image is clear and has an obvious subject |
| Text + image search is unstable | Clarify whether text or image should be more important; if you only want visual similarity, reduce extra text constraints |
--- ---
title: 知识库搜索方案和参数 title: 知识库搜索方案和参数
description: description: 本节会详细介绍 FastGPT 知识库结构设计,理解其 QA
本节会详细介绍 FastGPT 知识库结构设计,理解其 QA
的存储格式和多向量映射,以便更好的构建知识库。同时会介绍每个搜索参数的功能。这篇介绍主要以使用为主,详细原理不多介绍。 的存储格式和多向量映射,以便更好的构建知识库。同时会介绍每个搜索参数的功能。这篇介绍主要以使用为主,详细原理不多介绍。
--- ---
## 理解向量 ## 理解向量
FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 FastGPT 需要简单的理解`Embedding`向量是如何工作的及其特点。 FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 FastGPT 需要简单的理解 `Embedding` 向量是如何工作的及其特点。
人类的文字、图片、视频等媒介是无法直接被计算机理解的,要想让计算机理解两段文字是否有相似性、相关性,通常需要将它们转成计算机可以理解的语言,向量是其中的一种方式。 人类的文字、图片等媒介是无法直接被计算机理解的,要想让计算机理解两段文字是否有相似性、相关性,通常需要将它们转成计算机可以理解的语言,向量是其中的一种方式。
向量可以简单理解为一个数字数组,两个向量之间可以通过数学公式得出一个`距离`,距离越小代表两个向量的相似度越大。从而映射到文字、图片、视频等媒介上,可以用来判断两个媒介之间的相似度。向量搜索便是利用了这个原理。 向量可以简单理解为一个数字数组,两个向量之间可以通过数学公式得出一个 `距离`,距离越小代表两个向量的相似度越大。从而映射到文字、图片等媒介上,可以用来判断两个媒介之间的相似度。向量搜索便是利用了这个原理。
而由于文字是有多种类型,并且拥有成千上万种组合方式,因此在转成向量进行相似度匹配时,很难保障其精确性。在向量方案构建的知识库中,通常使用`topk`召回的方式,也就是查找前`k`个最相似的内容,丢给大模型去做更进一步的`语义判断`、`逻辑推理`和`归纳总结`,从而实现知识库问答。因此,在知识库问答中,向量搜索的环节是最为重要的。 而由于文字是有多种类型,并且拥有成千上万种组合方式,因此在转成向量进行相似度匹配时,很难保障其精确性。在向量方案构建的知识库中,通常使用 `topk` 召回的方式,也就是查找前 `k` 个最相似的内容,丢给大模型去做更进一步的 `语义判断`、`逻辑推理` 和 `归纳总结`,从而实现知识库问答。因此,在知识库问答中,向量搜索的环节是最为重要的。
影响向量搜索精度的因素非常多,主要包括:向量模型的质量、数据的质量(长度,完整性,多样性)、检索器的精度(速度与精度之间的取舍)。与数据质量对应的就是检索词的质量。 影响向量搜索精度的因素非常多,主要包括:向量模型的质量、数据的质量(长度,完整性,多样性)、检索器的精度(速度与精度之间的取舍)。与数据质量对应的就是检索词的质量。
检索器的精度比较容易解决,向量模型的训练略复杂,因此数据和检索词质量优化成了一个重要的环节。 检索器的精度比较容易解决,向量模型的训练略复杂,因此数据和检索词质量优化成了一个重要的环节。
### 提高向量搜索精度的方法 ### 提高向量搜索精度的方法
1. 更好分词分段:当一段话的结构和语义是完整的,并且是单一的,精度也会提高。因此,许多系统都会优化分词器,尽可能的保障每组数据的完整性。 1. 更好分词分段:当一段话的结构和语义是完整的,并且是单一的,精度也会提高。因此,许多系统都会优化分词器,尽可能的保障每组数据的完整性。
2. 精简`index`的内容,减少向量内容的长度:当`index`的内容更少,更准确时,检索精度自然会提高。但与此同时,会牺牲一定的检索范围,适合答案较为严格的场景。 2. 精简 `index` 的内容,减少向量内容的长度:当 `index` 的内容更少,更准确时,检索精度自然会提高。但与此同时,会牺牲一定的检索范围,适合答案较为严格的场景。
3. 丰富`index`的数量,可以为同一个`chunk`内容增加多组`index`。 3. 丰富 `index` 的数量,可以为同一个 `chunk` 内容增加多组 `index`。
4. 优化检索词:在实际使用过程中,用户的问题通常是模糊的或是缺失的,并不一定是完整清晰的问题。因此优化用户的问题(检索词)很大程度上也可以提高精度。 4. 优化检索词:在实际使用过程中,用户的问题通常是模糊的或是缺失的,并不一定是完整清晰的问题。因此优化用户的问题(检索词)很大程度上也可以提高精度。
5. 微调向量模型:由于市面上直接使用的向量模型都是通用型模型,在特定领域的检索精度并不高,因此微调向量模型可以很大程度上提高专业领域的检索效果。 5. 微调向量模型:由于市面上直接使用的向量模型都是通用型模型,在特定领域的检索精度并不高,因此微调向量模型可以很大程度上提高专业领域的检索效果。
...@@ -32,17 +30,17 @@ FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 Fast ...@@ -32,17 +30,17 @@ FastGPT 采用了 RAG 中的 Embedding 方案构建知识库,要使用好 Fast
### 数据存储结构 ### 数据存储结构
在 FastGPT 中,整个知识库由库、集合和数据 3 部分组成。集合可以简单理解为一个`文件`。一个`库`中可以包含多个`集合`,一个`集合`中可以包含多组`数据`。最小的搜索单位是`库`,也就是说,知识库搜索时,是对整个`库`进行搜索,而集合仅是为了对数据进行分类管理,与搜索效果无关。(起码目前还是) 在 FastGPT 中,整个知识库由库、集合和数据 3 部分组成。集合可以简单理解为一个 `文件`。一个 `库` 中可以包含多个 `集合`,一个 `集合` 中可以包含多组 `数据`。最小的搜索单位是 `库`,也就是说,知识库搜索时,是对整个 `库` 进行搜索,而集合仅是为了对数据进行分类管理,与搜索效果无关。(起码目前还是)
![](/imgs/dataset_tree.png) ![](/imgs/dataset_tree.png)
### 向量存储结构 ### 向量存储结构
FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引为`HNSW`。且`PostgresSQL`仅用于向量检索(该引擎可以替换成其它数据库),`MongoDB`用于其他数据的存取。 FastGPT 采用了 `PostgresSQL` 的 `PG Vector` 插件作为向量检索器,索引为 `HNSW`。且 `PostgresSQL` 仅用于向量检索(该引擎可以替换成其它数据库),`MongoDB` 用于其他数据的存取。
在`MongoDB`的`dataset.datas`表中,会存储向量原数据的信息,同时有一个`indexes`字段,会记录其对应的向量ID,这是一个数组,也就是说,一组数据可以对应多个向量。 在 `MongoDB` 的 `dataset.datas` 表中,会存储向量原数据的信息,同时有一个 `indexes` 字段,会记录其对应的向量 ID,这是一个数组,也就是说,一组数据可以对应多个向量。除默认文本索引外,如果模型能力支持,图片内容也可以生成图片描述索引或图片向量索引。
在`PostgresSQL`的表中,设置一个`vector`字段用于存储向量。在检索时,会先召回向量,再根据向量的ID,去`MongoDB`中寻找原数据内容,如果对应了同一组原数据,则进行合并,向量得分取最高得分。 在 `PostgresSQL` 的表中,设置一个 `vector` 字段用于存储向量。在检索时,会先召回向量,再根据向量的 ID,去 `MongoDB` 中寻找原数据内容,如果对应了同一组原数据,则进行合并,向量得分取最高得分。
![](/imgs/datasetSetting1.png) ![](/imgs/datasetSetting1.png)
...@@ -54,20 +52,68 @@ FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引 ...@@ -54,20 +52,68 @@ FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引
意味着,你可以通过标注数据块的方式,不断提高数据块的精度。 意味着,你可以通过标注数据块的方式,不断提高数据块的精度。
### 检索方案 ### 整体检索方案
一次知识库检索不是简单的“用户问题 -> 向量库 -> 返回结果”。FastGPT 会根据输入内容和搜索参数,将文本、图片、语义召回、全文召回、问题优化和重排等能力组合起来,最后再把多路结果融合成引用内容。
1. 通过`问题优化`实现指代消除和问题扩展,从而增加连续对话的检索能力以及语义丰富度。 1. 通过 `问题优化` 实现指代消除和问题扩展,从而增加连续对话的检索能力以及语义丰富度。
2. 通过`Concat query`来增加`Rerank`连续对话的时,排序的准确性。 2. 通过 `语义检索`、`全文检索` 或 `混合检索` 召回候选内容。
3. 通过`RRF`合并方式,综合多个渠道的检索效果。 3. 如果输入中包含图片,会根据模型能力额外进行图片描述检索或图片向量检索。
4. 通过`Rerank`来二次排序,提高精度。 4. 通过 `RRF` 合并方式,综合多个渠道的检索效果。
5. 通过 `Rerank` 来二次排序,提高文本结果的相关性。
6. 最终经过相似度过滤和引用上限裁剪,得到返回给模型的引用内容。
![](/imgs/dataset_search_process.png) ![](/imgs/dataset_search_process.png)
### 图片检索方案
在知识库搜索中,除了文本问题外,也可以让图片参与检索。FastGPT 会根据当前模型能力,对图片进行不同处理。
图片检索主要有两种方式:
1. 图片描述检索:如果配置了可用的视觉模型,系统可以先理解图片内容,并生成一段文本描述,再使用这段描述参与普通文本检索。
2. 图片向量检索:如果当前向量模型支持图片输入,系统可以直接对图片生成向量,并与知识库中的图片向量进行相似度匹配。
因此,图片检索不是独立于知识库之外的一套能力,而是在原有知识库搜索链路上增加了图片输入的处理路径。
常见使用方式包括:
- 文搜图:输入文字,搜索语义相关的图片内容。
- 图搜图:输入图片,搜索视觉或语义相似的图片内容。
- 图文混合搜索:同时输入文字和图片,让文字问题对图片搜索结果进行补充约束。
图片检索效果通常取决于图片清晰度、图片内容是否容易被模型理解、是否配置了视觉模型,以及向量模型是否支持图片向量。
需要注意的是,图片能否被检索到,不只取决于搜索时是否上传了图片,也取决于入库时是否建立了对应索引:
| 知识库能力 | 纯文本查询 | 纯图片查询 | 图文混合查询 |
| ------------------------------ | -------------------------- | ------------------------------ | ---------------------------------- |
| 普通向量模型,无视觉模型 | 正常文本检索 | 基本不可用 | 主要使用文字部分 |
| 普通向量模型,有视觉模型 | 正常文本检索 | 图片先转成描述,再参与文本检索 | 文字 + 图片描述共同参与检索 |
| 支持图片的向量模型,无视觉模型 | 正常文本检索 | 图片向量检索 | 文本检索 + 图片向量检索 |
| 支持图片的向量模型,有视觉模型 | 文本检索,也可命中图片描述 | 图片描述 + 图片向量双路检索 | 文本 + 图片描述 + 图片向量多路检索 |
所以,图搜图效果不理想时,除了调整搜索参数,也要确认当前知识库是否配置了视觉模型或支持图片的向量模型,以及图片入库时是否生成了有效的图片索引。
### 结果排序与融合
FastGPT 会把不同召回路径的结果进行融合,而不是简单采用某一路结果。常见路径包括文本向量召回、全文召回、图片描述召回、图片向量召回和重排结果。
因此,最终排序需要这样理解:
1. `语义检索` 更依赖向量相似度,适合自然语言问题和语义相近内容。
2. `全文检索` 更依赖关键词命中,适合编号、型号、专有名词、错误码等精确查询。
3. `混合检索` 会同时使用语义召回和全文召回,再通过 `RRF` 融合结果。
4. `Rerank` 会对候选文本进行二次排序,更适合文本问题明确、候选结果较多的场景。
5. 图片检索会额外引入图片描述或图片向量结果,最终和文本侧结果一起融合。
这意味着,最终引用内容不一定严格按照单一向量相似度排序。某条内容如果同时被多路召回命中,通常会更容易排在前面。
## 搜索参数 ## 搜索参数
| | | | | | | |
| --- |---| --- | | ------------------------------------- | ------------------------------------- | ------------------------------------- |
|![](/imgs/dataset_search_params1.png)| ![](/imgs/dataset_search_params2.png) | ![](/imgs/dataset_search_params3.png) | | ![](/imgs/dataset_search_params1.png) | ![](/imgs/dataset_search_params2.png) | ![](/imgs/dataset_search_params3.png) |
### 搜索模式 ### 搜索模式
...@@ -76,11 +122,13 @@ FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引 ...@@ -76,11 +122,13 @@ FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引
语义检索是通过向量距离,计算用户问题与知识库内容的距离,从而得出“相似度”,当然这并不是语文上的相似度,而是数学上的。 语义检索是通过向量距离,计算用户问题与知识库内容的距离,从而得出“相似度”,当然这并不是语文上的相似度,而是数学上的。
优点: 优点:
- 相近语义理解 - 相近语义理解
- 跨多语言理解(例如输入中文问题匹配英文知识点) - 跨多语言理解(例如输入中文问题匹配英文知识点)
- 多模态理解(文本,图片,音视频等) - 多模态理解(文本、图片等,取决于模型能力)
缺点: 缺点:
- 依赖模型训练效果 - 依赖模型训练效果
- 精度不稳定 - 精度不稳定
- 受关键词和句子完整度影响 - 受关键词和句子完整度影响
...@@ -97,7 +145,7 @@ FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引 ...@@ -97,7 +145,7 @@ FastGPT 采用了`PostgresSQL`的`PG Vector`插件作为向量检索器,索引
#### 结果重排 #### 结果重排
利用`ReRank`模型对搜索结果进行重排,绝大多数情况下,可以有效提高搜索结果的准确率。不过,重排模型与问题的完整度(主谓语齐全)有一些关系,通常会先走问题优化后再进行搜索-重排。重排后可以得到一个`0-1`的得分,代表着搜索内容与问题的相关度,该分数通常比向量的得分更加精确,可以根据得分进行过滤。 利用 `ReRank` 模型对搜索结果进行重排,绝大多数情况下,可以有效提高搜索结果的准确率。不过,重排模型与问题的完整度(主谓语齐全)有一些关系,通常会先走问题优化后再进行搜索 - 重排。重排后可以得到一个 `0-1` 的得分,代表着搜索内容与问题的相关度,该分数通常比向量的得分更加精确,可以根据得分进行过滤。
FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结果进行合并,得到最终的搜索结果。 FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结果进行合并,得到最终的搜索结果。
...@@ -105,15 +153,17 @@ FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结 ...@@ -105,15 +153,17 @@ FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结
#### 引用上限 #### 引用上限
每次搜索最多引用`n`个`tokens`的内容。 每次搜索最多引用 `n` 个 `tokens` 的内容。
之所以不采用`top k`,是发现在混合知识库(问答库、文档库)时,不同`chunk`的长度差距很大,会导致`top k`的结果不稳定,因此采用了`tokens`的方式进行引用上限的控制。 之所以不采用 `top k`,是发现在混合知识库(问答库、文档库)时,不同 `chunk` 的长度差距很大,会导致 `top k` 的结果不稳定,因此采用了 `tokens` 的方式进行引用上限的控制。
#### 最低相关度 #### 最低相关度
一个`0-1`的数值,会过滤掉一些低相关度的搜索结果。 一个 `0-1` 的数值,会过滤掉一些低相关度的搜索结果。
该值仅在 `语义检索` 或使用 `结果重排` 时生效。
该值仅在`语义检索`或使用`结果重排`时生效。 需要注意的是,最低相关度是过滤阈值,不是最终排序规则。开启问题优化、混合检索、图片检索或结果重排后,最终结果可能会经过多路召回融合,不一定严格按照单一向量相似度排序。
### 问题优化 ### 问题优化
...@@ -125,10 +175,27 @@ FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结 ...@@ -125,10 +175,27 @@ FastGPT 会使用 `RRF` 对重排结果、向量搜索结果、全文检索结
![](/imgs/coreferenceResolution2.webp) ![](/imgs/coreferenceResolution2.webp)
用户在提问“第二点是什么”的时候,只会去知识库里查找“第二点是什么”,压根查不到内容。实际上需要查询的是“QA结构是什么”。因此我们需要引入一个【问题优化】模块,来对用户当前的问题进行补全,从而使得知识库搜索能够搜索到合适的内容。使用补全后效果如下: 用户在提问“第二点是什么”的时候,只会去知识库里查找“第二点是什么”,压根查不到内容。实际上需要查询的是“QA 结构是什么”。因此我们需要引入一个【问题优化】模块,来对用户当前的问题进行补全,从而使得知识库搜索能够搜索到合适的内容。使用补全后效果如下:
![](/imgs/coreferenceResolution3.webp) ![](/imgs/coreferenceResolution3.webp)
#### 实现方式 #### 实现方式
在进行`数据检索`前,会先让模型进行`指代消除`与`问题扩展`,一方面可以可以解决指代对象不明确问题,同时可以扩展问题的语义丰富度。你可以通过每次对话后的对话详情,查看补全的结果。 在进行 `数据检索` 前,会先让模型进行 `指代消除` 与 `问题扩展`,一方面可以可以解决指代对象不明确问题,同时可以扩展问题的语义丰富度。你可以通过每次对话后的对话详情,查看补全的结果。
问题优化会在正式检索前增加一次模型调用,因此通常会提升连续对话检索效果,但也会增加整体耗时。如果当前问题本身已经非常明确,或对响应速度要求更高,可以根据实际效果决定是否开启。
### 常见调参建议
如果搜索结果不符合预期,可以先根据现象定位问题,不建议一次性调整所有参数。
| 现象 | 优先检查和调整 |
| -------------------------- | -------------------------------------------------------------------------------------------- |
| 搜不到内容 | 确认数据是否已完成训练;适当降低最低相关度;提高引用上限;检查问题是否过短或缺少主体 |
| 结果太泛、答非所问 | 提高最低相关度;减少引用上限;优化数据分块;检查召回内容是否包含过多无关片段 |
| 编号、型号、专有名词搜不准 | 使用全文检索或混合检索;降低语义检索权重;避免对精确编号类问题过度使用问题优化 |
| 自然语言问法搜不准 | 使用语义检索或混合检索;开启问题优化;补充更准确的数据索引 |
| 开启问题优化后变慢 | 问题优化会额外调用模型,可以换更快的优化模型,或只在多轮追问、短问题场景中开启 |
| Rerank 后仍然排序不准 | 确认用户问题是否完整;检查召回候选是否足够;适当调整最低相关度和引用上限 |
| 图搜图效果弱 | 确认向量模型是否支持图片输入;确认入库时是否生成图片向量索引;检查图片是否清晰、主体是否明确 |
| 图文混合结果不稳定 | 明确文字和图片哪个更重要;如果只想找视觉相似图片,减少额外文字约束 |
...@@ -291,8 +291,8 @@ ...@@ -291,8 +291,8 @@
"content/self-host/upgrading/4-14/41481.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/4-14/41481.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-14/4149.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/4-14/4149.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-14/4149.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/4-14/4149.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/4-15/41500.en.mdx": "2026-06-25T14:51:00+08:00", "content/self-host/upgrading/4-15/41500.en.mdx": "2026-06-27T11:15:35+08:00",
"content/self-host/upgrading/4-15/41500.mdx": "2026-06-25T14:51:00+08:00", "content/self-host/upgrading/4-15/41500.mdx": "2026-06-27T11:15:35+08:00",
"content/self-host/upgrading/4-15/41501.mdx": "2026-06-23T21:09:39+08:00", "content/self-host/upgrading/4-15/41501.mdx": "2026-06-23T21:09:39+08:00",
"content/self-host/upgrading/4-15/41502.en.mdx": "2026-05-25T11:21:30+08:00", "content/self-host/upgrading/4-15/41502.en.mdx": "2026-05-25T11:21:30+08:00",
"content/self-host/upgrading/4-15/41502.mdx": "2026-06-23T13:54:06+08:00", "content/self-host/upgrading/4-15/41502.mdx": "2026-06-23T13:54:06+08:00",
...@@ -302,8 +302,8 @@ ...@@ -302,8 +302,8 @@
"content/self-host/upgrading/4-15/41504.mdx": "2026-06-15T23:34:43+08:00", "content/self-host/upgrading/4-15/41504.mdx": "2026-06-15T23:34:43+08:00",
"content/self-host/upgrading/4-15/41505.en.mdx": "2026-06-23T13:54:06+08:00", "content/self-host/upgrading/4-15/41505.en.mdx": "2026-06-23T13:54:06+08:00",
"content/self-host/upgrading/4-15/41505.mdx": "2026-06-24T13:53:05+08:00", "content/self-host/upgrading/4-15/41505.mdx": "2026-06-24T13:53:05+08:00",
"content/self-host/upgrading/4-15/41506.en.mdx": "2026-06-26T17:03:31+08:00", "content/self-host/upgrading/4-15/41506.en.mdx": "2026-06-27T11:15:35+08:00",
"content/self-host/upgrading/4-15/41506.mdx": "2026-06-26T17:03:31+08:00", "content/self-host/upgrading/4-15/41506.mdx": "2026-06-27T11:15:35+08:00",
"content/self-host/upgrading/outdated/40.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/outdated/40.en.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/outdated/40.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/outdated/40.mdx": "2026-04-26T21:08:47+08:00",
"content/self-host/upgrading/outdated/41.en.mdx": "2026-04-26T21:08:47+08:00", "content/self-host/upgrading/outdated/41.en.mdx": "2026-04-26T21:08:47+08:00",
......

13.1 KB | W: | H:

910 KB | W: | H:

document/public/imgs/datasetSetting1.png
document/public/imgs/datasetSetting1.png
document/public/imgs/datasetSetting1.png
document/public/imgs/datasetSetting1.png
  • 2-up
  • Swipe
  • Onion skin

226 KB | W: | H:

889 KB | W: | H:

document/public/imgs/dataset_search_params1.png
document/public/imgs/dataset_search_params1.png
document/public/imgs/dataset_search_params1.png
document/public/imgs/dataset_search_params1.png
  • 2-up
  • Swipe
  • Onion skin

210 KB | W: | H:

872 KB | W: | H:

document/public/imgs/dataset_search_params2.png
document/public/imgs/dataset_search_params2.png
document/public/imgs/dataset_search_params2.png
document/public/imgs/dataset_search_params2.png
  • 2-up
  • Swipe
  • Onion skin

221 KB | W: | H:

901 KB | W: | H:

document/public/imgs/dataset_search_params3.png
document/public/imgs/dataset_search_params3.png
document/public/imgs/dataset_search_params3.png
document/public/imgs/dataset_search_params3.png
  • 2-up
  • Swipe
  • Onion skin

91.6 KB | W: | H:

1010 KB | W: | H:

document/public/imgs/dataset_search_process.png
document/public/imgs/dataset_search_process.png
document/public/imgs/dataset_search_process.png
document/public/imgs/dataset_search_process.png
  • 2-up
  • Swipe
  • Onion skin

24.4 KB | W: | H:

945 KB | W: | H:

document/public/imgs/dataset_tree.png
document/public/imgs/dataset_tree.png
document/public/imgs/dataset_tree.png
document/public/imgs/dataset_tree.png
  • 2-up
  • Swipe
  • Onion skin

501 KB | W: | H:

778 KB | W: | H:

document/public/imgs/image-45.png
document/public/imgs/image-45.png
document/public/imgs/image-45.png
document/public/imgs/image-45.png
  • 2-up
  • Swipe
  • Onion skin

94.5 KB | W: | H:

212 KB | W: | H:

document/public/imgs/image-53.png
document/public/imgs/image-53.png
document/public/imgs/image-53.png
document/public/imgs/image-53.png
  • 2-up
  • Swipe
  • Onion skin
Subproject commit 23a105e56fcb7a4e7e0c161e23488290ef297a21 Subproject commit 7eac10c397a78a1aae5bfc860dd5c3d86c33626d
...@@ -243,7 +243,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { ...@@ -243,7 +243,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
chatId, chatId,
offset: 0, offset: 0,
limit, limit,
field: `obj value nodeOutputs` field: `obj value memories nodeOutputs`
}), }),
getAppLatestVersion(app._id, app), getAppLatestVersion(app._id, app),
MongoChat.findOne( MongoChat.findOne(
......
...@@ -245,7 +245,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { ...@@ -245,7 +245,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
chatId, chatId,
offset: 0, offset: 0,
limit, limit,
field: `obj value nodeOutputs` field: `obj value memories nodeOutputs`
}), }),
getAppLatestVersion(app._id, app), getAppLatestVersion(app._id, app),
MongoChat.findOne( MongoChat.findOne(
......
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
const readSource = (path: string) => readFileSync(resolve(process.cwd(), path), 'utf8');
describe('chat completions history fields', () => {
it.each(['src/pages/api/v1/chat/completions.ts', 'src/pages/api/v2/chat/completions.ts'])(
'%s keeps agent loop memories when loading histories',
(path) => {
const source = readSource(path);
expect(source).toContain('field: `obj value memories nodeOutputs`');
}
);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment