Files
map-client-vue/docs/aliyun-qwen-models.md
douboer cb2f9ea76f feat: 增强模型选择日志和验证
- 在 chatService 中添加模型选择详细日志
- 在 modelServiceManager 中添加请求/响应确认日志
- 创建模型选择验证指南文档
- 帮助用户确认所选模型是否被正确使用

新增日志:
- 🎯 用户选择的模型
-  找到匹配服务
- 🔍 最终选择确认
- 📋 请求体 model 字段
- �� 最终发送确认
-  API 响应模型确认

用户现在可以在控制台清晰看到:
- 选择了哪个模型
- 找到了哪个服务
- 实际发送了什么模型参数
- API 返回了什么模型
- 请求模型和响应模型是否一致
2025-10-15 10:06:42 +08:00

188 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 阿里云通义千问模型使用指南
## 支持的模型
项目已内置支持以下阿里云通义千问模型:
### 1. qwen-turbo-latest
- **名称**: 通义千问 Turbo 最新版
- **特点**: 高性价比,响应速度快
- **适用场景**: 日常对话、文本生成、简单问答
- **Function Calling**: ✅ 支持
### 2. qwq-plus
- **名称**: 通义千问增强版
- **特点**: 更强的推理能力
- **适用场景**: 复杂推理、数学问题、逻辑分析
- **Function Calling**: ✅ 支持
### 3. qwen-long
- **名称**: 通义千问长文本版
- **特点**: 支持超长上下文(最高支持 1M tokens
- **适用场景**: 长文档分析、大规模文本处理
- **Function Calling**: ✅ 支持
### 4. qwen3-omni-flash
- **名称**: 通义千问全能闪电版
- **特点**: 多模态能力(文本+图像),极速响应
- **适用场景**: 多模态对话、图文理解、快速响应
- **Function Calling**: ✅ 支持
---
## 快速配置
### 步骤 1: 获取 API Key
1. 访问 [阿里云百炼平台](https://bailian.console.aliyun.com/)
2. 创建应用或使用现有应用
3. 获取 API Key
### 步骤 2: 配置服务
1. 打开 MCP Client Vue 应用
2. 进入 **"模型服务"** 设置
3. 点击 **"添加服务"**
4. 填写以下信息:
```
服务名称: 阿里云通义千问
服务类型: dashscope
API Key: sk-xxxxxxxxxxxxxxxx (你的 API Key)
Base URL: https://dashscope.aliyuncs.com/compatible-mode/v1
```
5. 点击 **"获取模型列表"** 或手动添加模型:
- qwen-turbo-latest
- qwq-plus
- qwen-long
- qwen3-omni-flash
6. 点击 **"测试连接"** 验证配置
7. 启用服务
---
## 使用方法
### 在对话中使用
1. 进入对话界面
2. 在模型选择下拉框中选择阿里云模型(例如:`qwen-turbo-latest`
3. 开始对话
### 配合 MCP 工具使用
1.**"MCP 设置"** 中添加并连接工具服务器
2. 在对话界面选择阿里云模型
3. 选择对应的 MCP 服务器
4. 发送需要工具辅助的消息
5. AI 会自动调用工具并整合结果
---
## 模型选择建议
| 使用场景 | 推荐模型 | 原因 |
|---------|---------|------|
| 日常对话 | qwen-turbo-latest | 快速响应,成本低 |
| 复杂推理 | qwq-plus | 推理能力强 |
| 长文档分析 | qwen-long | 支持超长上下文 |
| 图文理解 | qwen3-omni-flash | 多模态能力 |
| MCP 工具调用 | qwen-turbo-latest / qwq-plus | Function Calling 支持好 |
---
## 配置示例
### 通过浏览器控制台快速配置
```javascript
// 打开浏览器开发者工具 Console执行以下代码
const providers = JSON.parse(localStorage.getItem('model-providers') || '[]')
providers.push({
id: 'aliyun-' + Date.now(),
name: '阿里云通义千问',
type: 'dashscope',
apiKey: 'sk-your-api-key-here', // 替换为你的 API Key
baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
models: [
'qwen-turbo-latest',
'qwq-plus',
'qwen-long',
'qwen3-omni-flash'
],
defaultModel: 'qwen-turbo-latest',
enabled: true,
maxTokens: 8000,
temperature: 0.7,
timeout: 60000
})
localStorage.setItem('model-providers', JSON.stringify(providers))
location.reload()
```
---
## 技术说明
### API 端点
- **Base URL**: `https://dashscope.aliyuncs.com/compatible-mode/v1`
- **Chat Completions**: `/chat/completions`
- **模型列表**: `/models`
### 请求格式
标准 OpenAI 兼容格式:
```json
{
"model": "qwen-turbo-latest",
"messages": [
{ "role": "user", "content": "你好" }
],
"stream": true,
"tools": [...] // 可选Function Calling
}
```
### 认证方式
```
Authorization: Bearer sk-xxxxxxxxxxxxxxxx
```
---
## 常见问题
### Q: 模型列表为空?
A: 如果 API 无法获取模型列表,系统会自动使用预定义的 4 个推荐模型。
### Q: 是否支持流式输出?
A: ✅ 完全支持,与 OpenAI 流式格式兼容。
### Q: 是否支持 Function Calling
A: ✅ 所有 4 个模型都支持 Function Calling可以完美配合 MCP 工具使用。
### Q: qwen-long 的上下文窗口有多大?
A: 支持最高 1M tokens 的超长上下文。
### Q: 如何切换模型?
A: 在对话界面的模型下拉框中直接选择即可。
---
## 相关链接
- [阿里云百炼平台](https://bailian.console.aliyun.com/)
- [通义千问 API 文档](https://help.aliyun.com/zh/dashscope/)
- [Function Calling 文档](https://help.aliyun.com/zh/dashscope/developer-reference/function-call)
---
**配置完成后即可使用阿里云强大的 AI 能力!** 🚀