Skip to content

Commit 0b875ef

Browse files
committed
添加简化模型映射功能,允许用户选择只返回基础模型,更新相关配置和文档。移除不必要的API路径前缀配置,优化模型获取逻辑,增强代码可读性和维护性。
1 parent 55b9ac8 commit 0b875ef

26 files changed

Lines changed: 415 additions & 847 deletions

.env.example

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# API 路径,不填则为空(http://localhost:3000)
2-
# 示例(/api) 则访问 http://localhost:3000/api
3-
API_PREFIX=
4-
51

62
# 如果需要修改Docker暴露端口,请修改ports中的参数
73
# 示例(8080:3000) 则访问 http://localhost:8080
@@ -43,6 +39,11 @@ OUTPUT_THINK=true
4339
# 搜索信息显示模式
4440
SEARCH_INFO_MODE=table
4541

42+
# 简化模型映射
43+
# true: 只返回基础模型,不包含thinking、search、image等变体
44+
# false: 返回完整模型列表,包含所有变体
45+
SIMPLE_MODEL_MAP=false
46+
4647
# Redis链接(如果使用redis模式,则必填,当redis使用tls时将redis://替换为rediss://)
4748
REDIS_URL=
4849

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
```bash
2727
# 🌐 服务配置
28-
API_PREFIX= # API 路径前缀 (可选)
2928
LISTEN_ADDRESS=localhost # 监听地址
3029
SERVICE_PORT=3000 # 服务端口
3130

@@ -41,6 +40,7 @@ PM2_MAX_MEMORY=1G # PM2内存限制 (100M/1G/2G等)
4140
# 🔍 功能配置
4241
SEARCH_INFO_MODE=table # 搜索信息展示模式 (table/text)
4342
OUTPUT_THINK=true # 是否输出思考过程 (true/false)
43+
SIMPLE_MODEL_MAP=false # 简化模型映射 (true/false)
4444

4545
# 🗄️ 数据存储
4646
DATA_SAVE_MODE=none # 数据保存模式 (none/file/redis)
@@ -54,14 +54,14 @@ CACHE_MODE=default # 图片缓存模式 (default/file)
5454

5555
| 参数 | 说明 | 示例 |
5656
|------|------|------|
57-
| `API_PREFIX` | API 路径前缀,不填则为根路径 | `/api``http://localhost:3000/api` |
5857
| `LISTEN_ADDRESS` | 服务监听地址 | `localhost``0.0.0.0` |
5958
| `SERVICE_PORT` | 服务运行端口 | `3000` |
6059
| `API_KEY` | API 访问密钥,支持多密钥配置。第一个为管理员密钥(可访问前端管理页面),其他为普通密钥(仅可调用API)。多个密钥用逗号分隔 | `sk-admin123,sk-user456,sk-user789` |
6160
| `PM2_INSTANCES` | PM2进程数量 | `1`/`4`/`max` |
6261
| `PM2_MAX_MEMORY` | PM2内存限制 | `100M`/`1G`/`2G` |
6362
| `SEARCH_INFO_MODE` | 搜索结果展示格式 | `table``text` |
6463
| `OUTPUT_THINK` | 是否显示 AI 思考过程 | `true``false` |
64+
| `SIMPLE_MODEL_MAP` | 简化模型映射,只返回基础模型不包含变体 | `true``false` |
6565
| `DATA_SAVE_MODE` | 数据持久化方式 | `none`/`file`/`redis` |
6666
| `REDIS_URL` | Redis 数据库连接 | `redis://localhost:6379` |
6767
| `CACHE_MODE` | 图片缓存存储方式 | `default`/`file` |

docker-compose-redis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ services:
99
- ./data:/app/data
1010
- ./logs:/app/logs
1111
environment:
12-
# API 路径,不填则为空(http://localhost:3000)
13-
# 示例(/api) 则访问 http://localhost:3000/api
14-
- API_PREFIX=
1512
# 如果需要修改Docker暴露端口,请修改ports中的参数
1613
# 示例(8080:3000) 则访问 http://localhost:8080
1714
- SERVICE_PORT=3000
@@ -32,6 +29,8 @@ services:
3229
- SEARCH_INFO_MODE=table
3330
# 是否输出思考过程
3431
- OUTPUT_THINK=true
32+
# 简化模型映射 (true: 只返回基础模型, false: 返回完整模型列表)
33+
- SIMPLE_MODEL_MAP=false
3534
# redis 连接地址(必填)
3635
- REDIS_URL=redis://redis:6379
3736
# 数据保存模式

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ services:
99
- ./data/data.json:/app/data/data.json
1010
- ./logs:/app/logs
1111
environment:
12-
# API 路径,不填则为空(http://localhost:3000)
13-
# 示例(/api) 则访问 http://localhost:3000/api
14-
- API_PREFIX=
1512
# 如果需要修改Docker暴露端口,请修改ports中的参数
1613
# 示例(8080:3000) 则访问 http://localhost:8080
1714
- SERVICE_PORT=3000
@@ -32,6 +29,8 @@ services:
3229
- SEARCH_INFO_MODE=table
3330
# 是否输出思考过程
3431
- OUTPUT_THINK=true
32+
# 简化模型映射 (true: 只返回基础模型, false: 返回完整模型列表)
33+
- SIMPLE_MODEL_MAP=false
3534
# redis 连接地址(如果使用redis模式,则必填,当redis使用tls时将redis://替换为rediss://)
3635
- REDIS_URL=
3736
# 数据保存模式

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qwen2api",
3-
"version": "2025.08.22.14.22",
3+
"version": "2025.08.23.14.00",
44
"main": "src/server.js",
55
"scripts": {
66
"start": "node src/start.js",
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)