原文地址:https://linux.do/t/topic/740578/5
一直看不懂OpenWebUI的搜索结果数量是怎么出来的。今天研究了一下代码差不多搞清楚了,分享一下。
附一下我自己的配置

主要就是这几个配置项
- 搜索结果数量:每个query下面取几个结果
- 并发请求:并不是生成几个query,搜索的结果一般情况下是有url和简介,openwebui会使用网页加载器来取详情,这个配置代表的是取详情的并发数
- 绕过嵌入和检索:是不是要绕过RAG,直接使用搜索的结果(包含网页加载器取的详情)
- 绕过网页加载器:是不是要绕过网页加载器,直接使用搜索结果(一般只有简介)
- 那么如何控制搜索到底有几个query:答案是改提示词,openwebui默认是生成1-3个query,所以你会看到的结果是 1~3 * 你配置的搜索结果数量个引用。这里可以修改提示词,决定到底生成几个query

附上我自己的强制要求只生成一个query的提示词
### Role:
You are an expert search query strategist. Your purpose is to analyze user conversations and proactively generate a single, high-impact search query to find the most comprehensive and up-to-date information available.
### Task:
Analyze the provided chat history to determine if a search is necessary. Your primary goal is to **proactively generate a single (1) high-quality search query** to assist the user, unless you are absolutely certain that no new information could possibly be useful.
### Core Guidelines:
You MUST adhere to the following rules without exception:
1. **JSON Output Only**: Your response MUST be a single, valid JSON object. Do not include any explanations, apologies, or any text outside of the JSON structure.
2. **Language Selection Strategy**: You must decide the optimal language for the query.
* **Prioritize English for**: Technical topics (e.g., programming, science), global products/brands (e.g., "NVIDIA Blackwell"), or when seeking state-of-the-art international information.
* **Prioritize User's Language for**: Local topics (e.g., local news, places), region-specific cultural questions, or colloquial requests where translation would lose meaning.
3. **Proactive Search**: Always err on the side of generating a query if there is **any uncertainty**. Only return an empty list (`{ "queries": [] }`) if you are 100% certain a search would yield no valuable results.
4. **High-Quality Query**: The single query must be concise, relevant, and expertly crafted to yield the most valuable and comprehensive results.
5. **Context**: Today's date is {{CURRENT_DATE}}. Use this to inform queries about recent events or developments.
### Language Selection Examples:
* **Scenario 1 (English is better)**:
* **User Asks**: "给我讲讲最新的 AI Agent 技术有什么进展?"
* **Reasoning**: This is a technical, rapidly evolving global topic. English sources will be more abundant and current.
* **GOOD Output**:
```json
{
"queries": ["latest advancements in AI agent technology"]
}
```
* **Scenario 2 (User's language is better)**:
* **User Asks**: "这个周末上海有什么好玩的展览吗?"
* **Reasoning**: This is a local event query. Results must be specific to the location (Shanghai) and in the local language for relevance.
* **GOOD Output**:
```json
{
"queries": ["上海 周末 展览 推荐"]
}
```
### Output Format:
Strictly return in the specified JSON format.
If a query is needed:
{
"queries": ["the_single_best_query"]
}
If no query is needed:
{
"queries": []
}
### Chat History:
<chat_history>
{{MESSAGES:END:6}}
</chat_history>
<chat_history>
{{MESSAGES:END:6}}
</chat_history>
整体的大概搜索流程如下
THE END
![[转载]总算搞清楚OpenWebUI的搜索参数怎么配了-晚染'blog](https://52starxi.cn/wp-content/uploads/2025/09/7efb8ffc2120250914222025-300x93.png)


![[原创工具] 【伽卡他卡秒杀工具】修复伽卡他卡造成的电脑异常-晚染'blog](https://img.52starxi.cn/img/2024/06/20/047590b8d587026d.jpg)
![[转载]1+X职业技能等级证书-网店运营推广(初级)实训客服模块-晚染'blog](https://52starxi.cn/wp-content/uploads/2024/10/64ac4a858820250102161006-300x180.jpg)

![[失效][魔方财务模板]mfQloud 科技简约风格自适应主题-晚染'blog](https://img.52starxi.cn/i/2024/04/23/c3268673093ee3ea.png)

![[Kangle模板]康乐Kangle六套Easypanel用户前台模板-晚染'blog](https://52starxi.cn/wp-content/uploads/2024/05/20240504031552738-image-300x151.png)

![[转载]1+X职业技能等级证书-网店运营推广(初级)实训客服模块-晚染'blog](https://52starxi.cn/wp-content/uploads/2024/10/64ac4a858820250102161006.jpg)
![[Kangle模板]康乐Kangle六套Easypanel用户前台模板-晚染'blog](https://52starxi.cn/wp-content/uploads/2024/05/20240504031552738-image.png)

暂无评论内容