ChatGPTNextWeb / ChatGPTNextWeb/NextChat

[Feature Request] 请求适配 Azure AI 的 DeepSeek-R1 模型

Open
#6,178 16 comments 10 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
88.8k
Forks
59.1k
PR merge metrics
No merged PRs in 30d

Description

### 🥰 Feature Description

目前,Azure(非 Azure OpenAI 服务)已支持 DeepSeek-R1 模型及其推理功能。非常希望能将其添加进 NextChat 中!

我的具体需求如下:

- 将 Azure 与 Azure OpenAI 独立,从而能正确调用 API
- 实现 DeepSeek-R1 推理时思考内容可折叠与计时

### 🧐 Proposed Solution

Azure 调用终结点与 Azure OpenAI 的调用十分类似,但是在 path 中没有 `deployments/{deployName}`:

```
https://{serviceName}.services.ai.azure.com/models/chat/completions?api-version={ApiVersion}
```

其 API-Key 放置于请求头 `api-key` 字段中,与 Azure OpenAI 相同

请求 JSON 与 Azure OpenAI 相同:

```json
{
"model": "模型名",
"stream": true,
"messages": [
{
"role": "system",
"content": "你是一个帮助用户查找信息的 AI 助手。"
},
{
"role": "user",
"content": "你好"
}
],
"temperature": 0.7,
"top_p": 0.95,
"frequency_penalty": 0,
"presence_penalty": 0,
"max_tokens": 800,
"stop": null
}
```

Azure DeepSeek-R1 返回的消息中,会将思考内容包括在 ` ` 块内

Azure 的所谓 ”模型名“ 是可以任意自取的,因此不能完全依靠名称来反向推导其 ServiceProvider,这会导致误判断。比如在 `getSummarizeModel()` 函数中:

https://github.com/ChatGPTNextWeb/NextChat/blob/bf265d33759dfada0d91248cbcb5ae22326e745f/app/store/chat.ts#L147-L148

### 📝 Additional Information

参考 API: [如何使用 DeepSeek-R1 推理模型](https://learn.microsoft.com/zh-cn/azure/ai-studio/how-to/deploy-models-deepseek?pivots=programming-language-python) (2025/02/07)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.