Skip to content

Commit 002f1c4

Browse files
authored
Merge pull request #493 from lyingbug/main
Custom Agent System
2 parents e9a2a7b + 9d5450b commit 002f1c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+10183
-1952
lines changed

CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,68 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.2.6] - 2025-12-29
6+
7+
### 🚀 New Features
8+
- **NEW**: Custom Agent System
9+
- Support for creating, configuring, and selecting custom agents
10+
- Agent feature indicators display with MCP service capability support
11+
- Built-in agent sorting logic ensuring multi-turn conversation auto-enabled in agent mode
12+
- Agent knowledge base selection modes: all/specified/disabled
13+
14+
- **NEW**: Helm Chart for Kubernetes Deployment
15+
- Complete Helm chart for Kubernetes deployment
16+
- Neo4j template support for GraphRAG functionality
17+
- Versioned image tags and official images compatibility
18+
19+
- **NEW**: Enhanced FAQ Management
20+
- FAQ entry retrieval API supporting single entry query by ID
21+
- FAQ list sorting by update time (ascending/descending)
22+
- Enhanced FAQ search with field-specific search (standard question/similar questions/answer/all)
23+
- Batch update exclusion for FAQ entries in ByTag operations
24+
- Tag deletion with content_only mode to delete only tag contents
25+
26+
- **NEW**: Multi-Platform Model Adaptation
27+
- Support for multiple platform model configurations
28+
- Title generation model configuration
29+
- Knowledge base selection mode without mandatory rerank model check
30+
31+
- **NEW**: Korean Language Support
32+
- Added Korean (한국어) internationalization support
33+
34+
### ⚡ Improvements
35+
- **IMPROVED**: Knowledge Base Operations
36+
- Async knowledge base deletion with background cleanup via ProcessKBDelete
37+
- Multi-knowledge base search support with specified file ID filtering
38+
- Optimized knowledge chunk pagination with type-specific search and sorting logic
39+
- Enhanced SearchKnowledgeRequest structure with backward compatibility
40+
41+
- **IMPROVED**: Prompt Template System
42+
- Restructured prompt template system with multi-scenario template configuration
43+
- Unified system prompts with optimized agent selector interface
44+
45+
- **IMPROVED**: Tag Management
46+
- Enhanced tag deletion with ID exclusion support
47+
- Async index deletion task for optimized deletion flow
48+
- Batch TagID update functionality
49+
- Optimized tag name batch queries for improved efficiency
50+
51+
- **IMPROVED**: API Documentation
52+
- Updated API documentation links to new paths
53+
- Added knowledge search API documentation
54+
- Enhanced FAQ and tag deletion interface documentation
55+
- Removed hardcoded host configuration from Swagger docs
56+
57+
### 🐛 Bug Fixes
58+
- **FIXED**: Tag ID handling logic for empty strings and UntaggedTagID conditions
59+
- **FIXED**: JSON query compatibility for different database types (MySQL/PostgreSQL)
60+
- **FIXED**: GORM batch insert issue where zero-value fields (IsEnabled, Flags) were ignored
61+
- **FIXED**: Helm chart versioned image tags and runAsNonRoot compatibility
62+
63+
### 🔧 Refactoring
64+
- **REFACTORED**: Removed security validation and length limits, simplified input processing logic
65+
- **REFACTORED**: Enhanced agent configuration with improved selection and state management
66+
567
## [0.2.5] - 2025-12-22
668

769
### 🚀 New Features
@@ -397,6 +459,7 @@ All notable changes to this project will be documented in this file.
397459
- Docker Compose for quick startup and service orchestration.
398460
- MCP server support for integrating with MCP-compatible clients.
399461

462+
[0.2.6]: https://github.com/Tencent/WeKnora/tree/v0.2.6
400463
[0.2.5]: https://github.com/Tencent/WeKnora/tree/v0.2.5
401464
[0.2.4]: https://github.com/Tencent/WeKnora/tree/v0.2.4
402465
[0.2.3]: https://github.com/Tencent/WeKnora/tree/v0.2.3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
2323
</a>
2424
<a href="./CHANGELOG.md">
25-
<img alt="Version" src="https://img.shields.io/badge/version-0.2.5-2e6cc4?labelColor=d4eaf7">
25+
<img alt="Version" src="https://img.shields.io/badge/version-0.2.6-2e6cc4?labelColor=d4eaf7">
2626
</a>
2727
</p>
2828

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
2323
</a>
2424
<a href="./CHANGELOG.md">
25-
<img alt="版本" src="https://img.shields.io/badge/version-0.2.5-2e6cc4?labelColor=d4eaf7">
25+
<img alt="版本" src="https://img.shields.io/badge/version-0.2.6-2e6cc4?labelColor=d4eaf7">
2626
</a>
2727
</p>
2828

README_JA.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<img src="https://img.shields.io/badge/License-MIT-ffffff?labelColor=d4eaf7&color=2e6cc4" alt="License">
2323
</a>
2424
<a href="./CHANGELOG.md">
25-
<img alt="バージョン" src="https://img.shields.io/badge/version-0.2.5-2e6cc4?labelColor=d4eaf7">
25+
<img alt="バージョン" src="https://img.shields.io/badge/version-0.2.6-2e6cc4?labelColor=d4eaf7">
2626
</a>
2727
</p>
2828

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.5
1+
0.2.6

config/config.yaml

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ conversation:
2323
- 使用礼貌、专业的语气
2424
2525
## 用户的问题是:
26-
{{.Query}}
26+
{{query}}
2727
enable_rewrite: true
2828
enable_query_expansion: true
2929
enable_rerank: true
@@ -82,15 +82,10 @@ conversation:
8282
改写后: 国外手机号是否可以注册微信账号
8383
rewrite_prompt_user: |
8484
## 历史对话背景
85-
{{range .Conversation}}
86-
------BEGIN------
87-
用户的问题是:{{.Query}}
88-
助手的回答是:{{.Answer}}
89-
------END------
90-
{{end}}
85+
{{conversation}}
9186
9287
## 需要改写的用户问题
93-
{{.Query}}
88+
{{query}}
9489
9590
## 改写后的问题
9691
keywords_extraction_prompt: |
@@ -134,7 +129,7 @@ conversation:
134129
Output: iPhone, 连接WiFi, 使用iPhone连接WiFi
135130
136131
# Real Data
137-
USER: {{.Query}}
132+
USER: {{query}}
138133
139134
keywords_extraction_prompt_user: |
140135
Output:
@@ -182,7 +177,6 @@ conversation:
182177
prompt: |
183178
你是一个专业的智能信息检索助手,名为WeKnora。你犹如专业的高级秘书,依据检索到的信息回答用户问题,不能利用任何先验知识。
184179
当用户提出问题时,助手会基于特定的信息进行解答。助手首先在心中思考推理过程,然后向用户提供答案。
185-
context_template: |
186180
## 回答问题规则
187181
- 仅根据检索到的信息中的事实进行回复,不得运用任何先验知识,保持回应的客观性和准确性。
188182
- 复杂问题和答案的按Markdown分结构展示,总述部分不需要拆分
@@ -195,18 +189,7 @@ conversation:
195189
- 以Markdown图文格式输出你的最终结果
196190
- 输出内容要保证简短且全面,条理清晰,信息明确,不重复。
197191
198-
## 当前时间是:
199-
{{.CurrentTime}} {{.CurrentWeek}}
200-
201-
## 检索到的信息如下:
202-
------BEGIN------
203-
{{range .Contexts}}
204-
{{.}}
205-
{{end}}
206-
------END------
207-
208-
## 用户当前的问题是:
209-
{{.Query}}
192+
context_template: "{{query}}"
210193
extract_entities_prompt: |
211194
## 任务
212195
用户提供的文本中,提取所有符合以下实体类型的实体:
@@ -495,11 +478,11 @@ conversation:
495478
generate_questions_prompt: |
496479
你是一个专业的问题生成助手。你的任务是根据给定的【主要内容】生成用户可能会问的相关问题。
497480
498-
{{.Context}}
481+
{{context}}
499482
## 主要内容(请基于此内容生成问题)
500-
文档名称:{{.DocName}}
483+
文档名称:{{doc_name}}
501484
文档内容:
502-
{{.Content}}
485+
{{content}}
503486
504487
## 核心要求
505488
- 生成的问题必须与【主要内容】直接相关
@@ -508,7 +491,7 @@ conversation:
508491
- 问题应该是用户在实际场景中可能会提出的自然问题
509492
- 问题应该多样化,覆盖内容的不同方面
510493
- 每个问题应该简洁明了,长度控制在30字以内
511-
- 生成的问题数量为 {{.QuestionCount}} 个
494+
- 生成的问题数量为 {{question_count}} 个
512495
513496
## 问题类型建议
514497
- 定义类:什么是...?...是什么?
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# 上下文模板
2+
templates:
3+
- id: "default_context"
4+
name: "标准模板"
5+
description: "标准的上下文格式化模板"
6+
has_knowledge_base: true
7+
content: |
8+
请根据以下参考资料回答用户问题。
9+
10+
参考资料:
11+
{{contexts}}
12+
13+
用户问题:{{query}}
14+
15+
请基于上述参考资料进行回答。如果参考资料不足以回答问题,请明确告知。
16+
17+
- id: "detailed_context"
18+
name: "详细模板"
19+
description: "包含详细说明的上下文模板"
20+
has_knowledge_base: true
21+
content: |
22+
## 任务说明
23+
请根据提供的参考资料,准确、全面地回答用户问题。
24+
25+
## 参考资料
26+
{{contexts}}
27+
28+
## 用户问题
29+
{{query}}
30+
31+
## 回答要求
32+
1. 仅基于参考资料回答,不要编造信息
33+
2. 如果多个资料有冲突,请综合分析
34+
3. 适当引用来源,增强可信度
35+
4. 如果资料不足,请明确说明
36+
37+
当前时间:{{current_time}} {{current_week}}
38+
39+
- id: "simple_context"
40+
name: "简洁模板"
41+
description: "简洁的上下文模板"
42+
has_knowledge_base: true
43+
content: |
44+
参考资料:
45+
{{contexts}}
46+
47+
问题:{{query}}
48+
49+
请回答上述问题。
50+
51+
- id: "qa_context"
52+
name: "问答模板"
53+
description: "问答场景专用模板"
54+
has_knowledge_base: true
55+
content: |
56+
你需要回答一个问题。以下是可能相关的资料:
57+
58+
{{contexts}}
59+
60+
用户的问题是:{{query}}
61+
62+
请基于以上资料回答问题。回答要求:
63+
- 直接回答问题,不要重复问题
64+
- 如果资料中没有相关信息,请说明
65+
- 保持回答简洁准确
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# 兜底提示词模板
2+
templates:
3+
- id: "default_fallback"
4+
name: "标准兜底"
5+
description: "标准的兜底回复模板"
6+
content: |
7+
抱歉,我在知识库中没有找到与您问题直接相关的内容。
8+
9+
您可以尝试:
10+
1. 换一种方式描述您的问题
11+
2. 提供更多具体信息
12+
3. 咨询相关领域的专业人员
13+
14+
如果您有其他问题,我很乐意继续为您服务。
15+
16+
- id: "polite_fallback"
17+
name: "礼貌兜底"
18+
description: "更加礼貌友好的兜底回复"
19+
content: |
20+
非常抱歉,目前我无法为您提供这个问题的准确答案。这可能是因为:
21+
- 该问题超出了我的知识范围
22+
- 知识库中暂无相关内容
23+
24+
建议您:
25+
1. 尝试用不同的关键词重新提问
26+
2. 将问题拆分为更具体的小问题
27+
3. 联系人工客服获取帮助
28+
29+
感谢您的理解,期待能在其他问题上帮助到您!
30+
31+
- id: "brief_fallback"
32+
name: "简洁兜底"
33+
description: "简短的兜底回复"
34+
content: "抱歉,我暂时无法回答这个问题。请尝试换一种方式提问,或联系人工客服。"
35+
36+
- id: "model_fallback"
37+
name: "模型兜底"
38+
description: "交给模型继续生成的兜底提示词"
39+
content: |
40+
知识库中没有找到与用户问题直接相关的内容。请根据你的通用知识,尽可能帮助用户解答问题。
41+
42+
注意事项:
43+
1. 明确告知用户这是基于通用知识的回答,而非知识库内容
44+
2. 如果问题涉及特定领域或需要最新信息,建议用户查阅官方资料
45+
3. 保持回答的准确性和客观性
46+
47+
用户问题:{{query}}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# 改写系统提示词模板
2+
templates:
3+
- id: "default_rewrite_system"
4+
name: "标准改写"
5+
description: "标准的问题改写系统提示词"
6+
content: |
7+
你是一个专业的问题改写助手。你的任务是将用户的后续问题改写为独立、完整的问题,使其可以脱离对话上下文独立理解。
8+
9+
改写规则:
10+
1. 消解代词指代(如"它"、"这个"、"他们"等)
11+
2. 补全省略的主语或宾语
12+
3. 保持原问题的核心意图不变
13+
4. 改写后的问题应该简洁清晰
14+
15+
只输出改写后的问题,不要输出其他内容。
16+
17+
- id: "strict_rewrite_system"
18+
name: "严格改写"
19+
description: "严格要求的问题改写模板"
20+
content: |
21+
你是问题改写专家。请将用户问题改写为完整、独立的问题。
22+
23+
严格要求:
24+
1. 必须消解所有代词和指代
25+
2. 必须补全所有省略内容
26+
3. 不得改变原问题意图
27+
4. 不得添加原问题没有的内容
28+
5. 改写结果必须是一个问句
29+
30+
直接输出改写后的问题,不要有任何解释。
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# 改写用户提示词模板
2+
templates:
3+
- id: "default_rewrite_user"
4+
name: "标准格式"
5+
description: "标准的改写用户提示词格式"
6+
content: |
7+
## 历史对话背景
8+
{{conversation}}
9+
10+
## 需要改写的用户问题
11+
{{query}}
12+
13+
## 改写后的问题
14+
15+
- id: "detailed_rewrite_user"
16+
name: "详细格式"
17+
description: "详细的改写用户提示词格式"
18+
content: |
19+
## 历史对话背景
20+
以下是用户与助手的对话历史,请仔细阅读以理解上下文:
21+
22+
{{conversation}}
23+
24+
## 当前用户问题
25+
{{query}}
26+
27+
## 任务要求
28+
请根据以上对话历史,将当前问题改写为一个独立、完整、可以脱离上下文理解的问题。
29+
30+
## 改写后的问题

0 commit comments

Comments
 (0)