juzeon / poe-openai-proxy

A wrapper that lets you use the reverse-engineered Python library poe-api library as if it was the OpenAI API for ChatGPT. You can connect your favorite OpenAI API based apps to this proxy and enjoy the ChatGPT API for free!
GNU General Public License v3.0
423 stars 98 forks source link

docker部署报错 #26

Open Longxin789 opened 1 year ago

Longxin789 commented 1 year ago

[poe-openai-proxy-external-1]容器日志 Traceback (most recent call last): File "/app/api.py", line 30, in config = toml.load(config_path) File "/usr/local/lib/python3.9/site-packages/toml/decoder.py", line 133, in load with io.open(_getpath(f), encoding='utf-8') as ffile: IsADirectoryError: [Errno 21] Is a directory: '/app/../config.toml' Traceback (most recent call last): File "/app/api.py", line 30, in config = toml.load(config_path) File "/usr/local/lib/python3.9/site-packages/toml/decoder.py", line 133, in load with io.open(_getpath(f), encoding='utf-8') as ffile: IsADirectoryError: [Errno 21] Is a directory: '/app/../config.toml' [poe-openai-proxy-api-1]容器日志 panic: read config.toml: is a directory

goroutine 1 [running]: github.com/juzeon/poe-openai-proxy/conf.Setup() /app/conf/conf.go:45 +0x5be main.main() /app/main.go:12 +0x1d panic: read config.toml: is a directory

goroutine 1 [running]: github.com/juzeon/poe-openai-proxy/conf.Setup() /app/conf/conf.go:45 +0x5be main.main() /app/main.go:12 +0x1d panic: read config.toml: is a directory

goroutine 1 [running]: github.com/juzeon/poe-openai-proxy/conf.Setup() /app/conf/conf.go:45 +0x5be main.main() /app/main.go:12 +0x1d 通过你的教程创建好配置文件后,通过命令部署docker,显示是成功的。下面是命令里面的显示: ✔ Network poe-openai-proxy_default Created 0.3s ✔ Container poe-openai-proxy-external-1 Started 2.7s ✔ Container poe-openai-proxy-api-1 Started 3.2s 但是通过宝塔查看容器发现是停止状态,并且端口未进行使用,无法启动,提示启动失败,查看日志就是上面的信息,帮忙看看是什么问题!!

juzeon commented 1 year ago
panic: read config.toml: is a directory

请检查一下是否正确配置了config.toml文件,应该和main.go放在相同目录下。

Longxin789 commented 1 year ago

是在同一目录下,然后配置里面我只将http://localhost:5100改成了http://external:5100,其他均为默认

Longxin789 commented 1 year ago

另外我发现主目录里面会自动创建一个config.toml文件夹,就算删除启动命令也会重新创建

Longxin789 commented 1 year ago

@juzeon

juzeon commented 1 year ago

先更新下docker版本?

如果还不行,可以试试改一下Dockerfile,把整个目录挂载进去,而不是只有config.toml这一个文件。

Longxin789 commented 1 year ago

直接按照教程来的,docker是最新的,这个挂载他不就是一个目录吗

juzeon commented 1 year ago

尝试参考一下这里是否有解决方案:https://stackoverflow.com/questions/34134343/single-file-volume-mounted-as-directory-in-docker

Longxin789 commented 1 year ago

不行,老客疼,搭建其他chatweb都可以的

Longxin789 commented 1 year ago

终于成功启动了,但是api返回{ "error": true, "message": "Failed to fetch" } 是什么原因 @juzeon

Longxin789 commented 1 year ago

这是现在的日志 INFO: registering client: ok [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.

[GIN-debug] GET /models --> github.com/juzeon/poe-openai-proxy/router.Setup.func1 (3 handlers) [GIN-debug] GET /v1/models --> github.com/juzeon/poe-openai-proxy/router.Setup.func1 (3 handlers) [GIN-debug] POST /chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func2 (3 handlers) [GIN-debug] POST /v1/chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func2 (3 handlers) [GIN-debug] OPTIONS /chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func3 (3 handlers) [GIN-debug] OPTIONS /v1/chat/completions --> github.com/juzeon/poe-openai-proxy/router.Setup.func3 (3 handlers) [GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value. Please check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details. [GIN-debug] Listening and serving HTTP on :3700 [GIN] 2023/06/14 - 11:16:01 | 404 | 500ns | 18.136.166.78 | GET "/v1/chat/completions" [GIN] 2023/06/14 - 11:16:03 | 404 | 700ns | 18.136.166.78 | GET "/v1/chat/completions"

Longxin789 commented 1 year ago
juzeon commented 1 year ago
[GIN] 2023/06/14 - 11:16:01 | 404 | 500ns | 18.136.166.78 | GET "/v1/chat/completions"
[GIN] 2023/06/14 - 11:16:03 | 404 | 700ns | 18.136.166.78 | GET "/v1/chat/completions"

看日志请求成GET了。不支持GET,需要使用POST。

Longxin789 commented 1 year ago

get是我直接访问的网页,而调用接口,那里没有记录

Longxin789 commented 1 year ago

@juzeon 比如我在这个网站调用api。https://bettergpt.chat/ 我api地址填的是http://IP:3700/v1/chat/completions 密钥空白 然后就是返回Failed to fetch 日志没有记录

juzeon commented 1 year ago

F12 Network看看网络请求记录,检查一下是否调用了正确的接口。如有错误,检查一下错误是什么。

Longxin789 commented 1 year ago

可以了,感谢大佬

Longxin789 commented 1 year ago

@juzeon 如何使用多个token

Longxin789 commented 1 year ago

查看了以往的记录,知道怎么使用了,感谢

yyx20202020 commented 1 year ago

可以了,感谢大佬

您好,我跟你一样的问题,显示Failed to fetch,一直没解决;请问你怎么解决的啊