You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.en.md
+95Lines changed: 95 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,8 @@ Some unique features have been added:
32
32
33
33
[✓] Implement SSO login through the auth proxy feature (need to integrate a third-party authentication reverse proxy, it can support login protocols such as LDAP/OIDC/SAML)
34
34
35
+
[✓] Web Search functionality (Real-time web search based on Tavily API)
36
+
35
37
> [!CAUTION]
36
38
> This project is only published on GitHub, based on the MIT license, free and for open source learning usage. And there will be no any form of account selling, paid service, discussion group, discussion group and other behaviors. Beware of being deceived.
37
39
@@ -72,6 +74,13 @@ Some unique features have been added:
@@ -347,6 +356,92 @@ Recommended for current IdP to use LDAP protocol, using [authelia](https://www.a
347
356
348
357
Recommended for current IdP to use OIDC protocol, using [oauth2-proxy](https://oauth2-proxy.github.io/oauth2-proxy)
349
358
359
+
## Web Search Functionality
360
+
361
+
> [!TIP]
362
+
> Web Search functionality is based on [Tavily API](https://tavily.com/) implementation, allowing ChatGPT to access the latest web information to answer questions.
363
+
364
+
### Features
365
+
366
+
- **Real-time Web Search**: Get the latest web information based on Tavily API
367
+
- **Intelligent Query Extraction**: Automatically extract the most relevant search keywords from user questions
368
+
- **Search Result Integration**: Seamlessly integrate search results into AI conversations
369
+
- **Per-session Control**: Each conversation can independently enable or disable search functionality
370
+
- **Search History**: Save search queries and results to database
371
+
- **Configurable System Messages**: Support custom search-related system prompt messages
372
+
373
+
### Configuration
374
+
375
+
#### 1. Get Tavily API Key
376
+
377
+
1. Visit [Tavily Official Website](https://tavily.com/) to register an account
378
+
2. Obtain API Key
379
+
380
+
#### 2. Administrator Configuration
381
+
382
+
1. Login to the system as an administrator
383
+
2. Go to system settings page
384
+
3. Find "Web Search Configuration" option
385
+
4. Fill in the following configurations:
386
+
- **Enable Status**: Turn on/off global search functionality
387
+
- **API Key**: Enter Tavily API Key
388
+
- **Search Query System Message**: Prompt template for extracting search keywords
389
+
- **Search Result System Message**: Prompt template for processing search results
390
+
391
+
#### 3. System Message Templates
392
+
393
+
**Search Query Extraction Template** (for extracting search keywords from user questions):
394
+
```
395
+
You are a search query extraction assistant. Extract the most relevant search query from user's question and wrap it with <search_query></search_query> tags.
396
+
Current time: {current_time}
397
+
```
398
+
399
+
**Search Result Processing Template** (for processing conversations with search results):
400
+
```
401
+
You are a helpful assistant with access to real-time web search results. Use the provided search information to give accurate and up-to-date responses.
402
+
Current time: {current_time}
403
+
```
404
+
405
+
### Usage
406
+
407
+
#### User Operations
408
+
409
+
1. **Enable Search Functionality**:
410
+
- In the conversation interface, find the search toggle button
411
+
- Click to enable web search functionality for the current session
412
+
413
+
2. **Ask Questions for Real-time Information**:
414
+
- After enabling search, directly ask ChatGPT questions that require real-time information
415
+
- The system will automatically search for relevant information and integrate it into the response
416
+
417
+
3. **View Search History**:
418
+
- Search queries and results are saved in the database
419
+
- You can view specific search records through the database
420
+
421
+
#### Workflow
422
+
423
+
1. **User Question**: User asks a question in a search-enabled session
424
+
2. **Query Extraction**: System uses AI to extract search keywords from the question
425
+
3. **Web Search**: Call Tavily API for real-time search
426
+
4. **Result Integration**: Provide search results as context to AI
427
+
5. **Generate Response**: AI generates more accurate responses based on search results
428
+
429
+
### Technical Implementation
430
+
431
+
- **Search Engine**: Tavily API
432
+
- **Query Extraction**: Use OpenAI API to intelligently extract keywords
433
+
- **Result Format**: JSON format to store complete search results
434
+
- **Data Storage**: MongoDB stores search queries and results
435
+
- **Timeout Setting**: Search request timeout is 300 seconds
436
+
437
+
### Notes
438
+
439
+
- Web Search functionality requires additional Tavily API costs
440
+
- Search functionality will increase response time
441
+
- It is recommended to enable selectively based on actual needs
442
+
- Administrators can control the global search functionality status
443
+
- Each session can independently control whether to use search functionality
> Web Search 功能基于 [Tavily API](https://tavily.com/) 实现,可以让 ChatGPT 获取最新的网络信息来回答问题。
374
+
375
+
### 功能特性
376
+
377
+
-**实时网络搜索**: 基于 Tavily API 获取最新的网络信息
378
+
-**智能查询提取**: 自动从用户问题中提取最相关的搜索关键词
379
+
-**搜索结果整合**: 将搜索结果无缝整合到 AI 对话中
380
+
-**按会话控制**: 每个对话可以独立开启或关闭搜索功能
381
+
-**搜索历史记录**: 保存搜索查询和结果到数据库
382
+
-**可配置系统消息**: 支持自定义搜索相关的系统提示消息
383
+
384
+
### 配置方式
385
+
386
+
#### 1. 获取 Tavily API Key
387
+
388
+
1. 访问 [Tavily 官网](https://tavily.com/) 注册账号
389
+
2. 获取 API Key
390
+
391
+
#### 2. 管理员配置
392
+
393
+
1. 以管理员身份登录系统
394
+
2. 进入系统设置页面
395
+
3. 找到 "Web Search 配置" 选项
396
+
4. 填写以下配置:
397
+
-**启用状态**: 开启/关闭全局搜索功能
398
+
-**API Key**: 填入 Tavily API Key
399
+
-**搜索查询系统消息**: 用于提取搜索关键词的提示模板
400
+
-**搜索结果系统消息**: 用于处理搜索结果的提示模板
401
+
402
+
#### 3. 系统消息模板
403
+
404
+
**搜索查询提取模板** (用于从用户问题中提取搜索关键词):
405
+
```
406
+
You are a search query extraction assistant. Extract the most relevant search query from user's question and wrap it with <search_query></search_query> tags.
407
+
Current time: {current_time}
408
+
```
409
+
410
+
**搜索结果处理模板** (用于处理包含搜索结果的对话):
411
+
```
412
+
You are a helpful assistant with access to real-time web search results. Use the provided search information to give accurate and up-to-date responses.
0 commit comments