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.57k stars 4.19k forks source link

我自己写的第三方接口,使用的是标准的openai接收和返回结构,在oneapi中测试没有问题,但在与fastgpt通讯中一直返回为空,不知道我写的json格式是否有问题还其他什么原因 #621

Closed dazhizun closed 12 months ago

dazhizun commented 12 months ago

例行检查

问题描述 我自己写的第三方接口,使用的是标准的openai接收和返回结构,在oneapi中测试没有问题,但在与fastgpt通讯中一直返回为空,不知道我写的json格式是否有问题还其他什么原因

接收结构用的是: curl https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ] }'

返回结构用的是: { "id": "chatcmpl-123", "object": "chat.completion", "created": 1677652288, "model": "gpt-3.5-turbo-0613", "choices": [{ "index": 0, "message": { "role": "assistant", "content": "\n\nHello there, how may I assist you today?", }, "finish_reason": "stop" }], "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 } }

预期结果 fastgpt有返回结果

相关截图 这是我自己写的接口POST测试图 微信截图_20231023135321

这是POST自己搭建的ONEAPI渠道测试图 微信截图_20231023135431

这是渠道测试成功截图 微信截图_20231023135549

微信截图_20231023135620

这是fastgpt返回消息为空截图 微信截图_20231023135704

经测试其他的接口没有问题,但是我写的也是按照标准的openai接口写出来的 微信截图_20231023140850

dazhizun commented 12 months ago

已搞定

2212582443 commented 4 months ago

请问你找到问题在哪儿了吗?我也遇到了类似的问题,使用第三方接口时返回结果有概率为空

dazhizun commented 4 months ago

流格式问题,去找个流格式模板套一下

---原始邮件--- 发件人: @.> 发送时间: 2024年6月6日(周四) 下午2:18 收件人: @.>; 抄送: @.>;"State @.>; 主题: Re: [songquanpeng/one-api] 我自己写的第三方接口,使用的是标准的openai接收和返回结构,在oneapi中测试没有问题,但在与fastgpt通讯中一直返回为空,不知道我写的json格式是否有问题还其他什么原因 (Issue #621)

请问你找到问题在哪儿了吗?我也遇到了类似的问题,使用第三方接口时返回结果有概率为空

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>