KenyonY / openai-forward

🚀 大语言模型高效转发服务 · An efficient forwarding service designed for LLMs. · OpenAI API Reverse Proxy
https://api.openai-forward.com
MIT License
839 stars 288 forks source link

405 Method Not Allowed #139

Closed Alenccu closed 3 months ago

Alenccu commented 4 months ago

Checklist

详细描述

通过命令已经启动服务,启动信息如下:

PS C:\Users\chen_\PycharmProjects\kylin_assistant> aifd run --webui ╭─────── 🤗 openai-forward (v0.8.1) is ready to serve! ────────╮ │ │ │ base url https://api.openai.com │ │ route prefix / │ │ api keys True │ │ forward keys True │ │ cache_routes {'/v1/chat/completions'} │ ╰───────────────────────────────────────────────────────────────╯ ╭────────────────────── ⏱️ Rate Limit configuration ───────────────────────╮ INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: 127.0.0.1:56286 - "GET /healthz HTTP/1.1" 200 OK WARNING: Static file serving is enabled, but no static folder found at D:\python3.10\Lib\site-packages\openai_forward\webui\static. To disable static file serving, set server.enableStaticServing to false.

You can now view your Streamlit app in your browser.

Network URL: http://192.168.0.104:8001 External URL: http://180.159.90.173:8001

然后通过设置环境代理: os.environ["http_proxy"] = "http://localhost:8000" os.environ["https_proxy"] = "http://localhost:8000"

后续代码调用 openai的Assistant API 提示报错: INFO: 127.0.0.1:56486 - "CONNECT / HTTP/1.1" 405 Method Not Allowed INFO: 127.0.0.1:56495 - "CONNECT / HTTP/1.1" 405 Method Not Allowed INFO: 127.0.0.1:56512 - "CONNECT / HTTP/1.1" 405 Method Not Allowed INFO: 127.0.0.1:56540 - "CONNECT / HTTP/1.1" 405 Method Not Allowed INFO: 127.0.0.1:56544 - "CONNECT / HTTP/1.1" 405 Method Not Allowed INFO: 127.0.0.1:56549 - "CONNECT / HTTP/1.1" 405 Method Not Allowed

请问如何解决?

KenyonY commented 4 months ago

你的环境变量代理 os.environ["http_proxy"] = "http://localhost:8000/" os.environ["https_proxy"] = "http://localhost:8000/" 是何用意?

如果希望通过代理访问openai服务,可以参考
https://github.com/KenyonY/openai-forward/blob/d0fab509b277920e88e528ebee0d74f25b7f1de1/.env.example#L46