songquanpeng / one-api

OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
https://openai.justsong.cn/
MIT License
18.22k stars 4.12k forks source link

通义千问空请求. #1449

Open sparkssssssss opened 4 months ago

sparkssssssss commented 4 months ago

例行检查

问题描述 使用最新release 0.65 docker 部署,已经使用快一个月了,其中添加了多个第三方api,添加了deepseek官方api,一直正常,大部分都是通过模型重定向来使用的. 今日添加了通义千问,模型重定向 "gpt-3.5-turbo-0125": "qwen-long" 使用nextchat发起对话,不知道什么情况下,会触发空请求,对话返回如下,

{
  "error": true,
  "message": "empty response from server"
}

one-api中日志显示如下 Snipaste_2024-05-22_12-33-02

同时,在终端中测试直接访问通义千问官方api,如下正常 Snipaste_2024-05-22_13-59-47

next-chat中测试不知道什么情况下触发 但是我同时还在使用一个安卓第三方app https://github.com/Skythinker616/gpt-assistant-android 使用其他模型都正常,但是这个重定向的模型,必现,抓包看也没什么异常.但是响应确实是空的

[GIN] 2024/05/22 - 15:45:18 | 2024052215451850938572957121880 | 200 |  312.728997ms | xxx.xxx.xxx.xxx|    POST /v1/chat/completions
[INFO] 2024/05/22 - 15:45:18 | 2024052215451850938572957121880 | record consume log: userId=1, channelId=36, promptTokens=0, completionTokens=0, modelName=qwen-long, tokenName=b9JrzmS27iArvB, quota=0, content=模型倍率 30.00,分组倍率 1.00,补全倍率 1.00 

Snipaste_2024-05-22_15-48-25

复现步骤 https://github.com/Skythinker616/gpt-assistant-android 使用这个第三方app必现,next-chat有几率出现. 预期结果

相关截图 如果没有的话,请删除此节。

sparkssssssss commented 4 months ago

curl --location 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions' --header 'Authorization: Bearer sk-xxxxxxxx' --header 'Content-Type: application/json' --data '{"model":"qwen-long","n":1,"stream":true,"temperature":0.2,"messages":[{"role":"user","content":"测试"}],"frequency_penalty":0.0,"max_tokens":2048,"presence_penalty":0.0,"top_p":1.0}'

经过测试,应该通义千问还是兼容有点问题, 这些参数是客户端发起的时候,自带的在openai/deepseek上都正常,但是唯独放到通义千问上,会报错. 删掉"frequency_penalty":0.0,"max_tokens":2048,"presence_penalty":0.0,"top_p":1.0这些就正常了

mlkt commented 4 months ago

我也遇到这个问题

johnlanni commented 3 months ago

可以试试 higress : https://github.com/alibaba/higress/issues/1023

KagaJiankui commented 3 months ago

阿里云代理的零一万物、百川2等大模型上都存在类似的空请求bug, dashscope提供的openai兼容API似乎也存在

johnlanni commented 3 months ago

可以试一下 higress 实现的 openai 协议兼容,纯流式的,function call 也流式,不是直接用的 dashscope 的兼容 API,应该没有类似问题

KagaJiankui commented 3 months ago

在平常使用的Windows工作机上用docker compose部署失败, 仍然fetch failed, 偶尔遇到higress相关issue里的其他问题

johnlanni commented 3 months ago

@KagaJiankui 有具体问题可以在这里发一下:https://github.com/alibaba/higress/issues/1023