Open billzhen870 opened 2 weeks ago
一开始是我配置mp使用我自己搭建的chatgpt api面板,使用new-api项目,但是端点似乎不对,返回的好像是是html页面,以下是mp返回的回复:
请求ChatGPT出现错误:HTTP code 200 from API (<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" href="/logo.png" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#ffffff" /> <meta name="description" content="OpenAI 接口聚合管理,支持多种渠道包括 Azure,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用" /> <title>New API</title> <script type="module" crossorigin src="/assets/index-B2YIG8my.js"></script> <link rel="modulepreload" crossorigin href="/assets/react-core-DZI3yyBa.js"> <link rel="modulepreload" crossorigin href="/assets/semi-ui-DIp7qNKk.js"> <link rel="modulepreload" crossorigin href="/assets/tools-BkrCZif-.js"> <link rel="modulepreload" crossorigin href="/assets/react-components-BO-Z0JS4.js"> <link rel="modulepreload" crossorigin href="/assets/semantic-DzZK5CjC.js"> <link rel="stylesheet" crossorigin href="/assets/semi-ui-BHSGR6vC.css"> <link rel="stylesheet" crossorigin href="/assets/index-CF9WWvgQ.css"> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> </body> </html> )
询问了chatgpt后怀疑是端点问题,使用curl测试curl -X POST https://api.example.com/v1的返回结果与mp返回的一致,而要访问curl -X POST https://api.example.com/v1/chat/completions或者curl -X POST https://api.example.com/v1/completions才能得到正确的返回结果。 尝试了自己修改openai.py中的openai.api_base = self._api_url + "/v1"为openai.api_base = self._api_url + "/v1/chat/completions",但是不知是不是我操作使得未能加载修改后的插件,报错依旧是一样的。
curl -X POST https://api.example.com/v1
curl -X POST https://api.example.com/v1/chat/completions
curl -X POST https://api.example.com/v1/completions
openai.api_base = self._api_url + "/v1"
openai.api_base = self._api_url + "/v1/chat/completions"
然后查看issue,发现有人想要支持4o,有人想要自定义提示词。 所以希望能增加修改这些自定义配置的选项。
另外,增加修改api端点,也能使mp支持使用许多国产大模型,因为他们的api调用是兼容openai格式的,不过端点可能不一致
一开始是我配置mp使用我自己搭建的chatgpt api面板,使用new-api项目,但是端点似乎不对,返回的好像是是html页面,以下是mp返回的回复:
询问了chatgpt后怀疑是端点问题,使用curl测试
curl -X POST https://api.example.com/v1
的返回结果与mp返回的一致,而要访问curl -X POST https://api.example.com/v1/chat/completions
或者curl -X POST https://api.example.com/v1/completions
才能得到正确的返回结果。 尝试了自己修改openai.py中的openai.api_base = self._api_url + "/v1"
为openai.api_base = self._api_url + "/v1/chat/completions"
,但是不知是不是我操作使得未能加载修改后的插件,报错依旧是一样的。然后查看issue,发现有人想要支持4o,有人想要自定义提示词。 所以希望能增加修改这些自定义配置的选项。