问题描述:
采用fastgpt对接one-api,均采用docker部署,报错:Connection error
fastgpt完整日志:ERROR] 2023-12-20 08:09:58 sse error: Connection error.: {"stack":"Error: Connection error.\n at tx.makeRequest (/app/projects/app/.next/server/chunks/5092.js:23:79572)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Object.k [as chatNode] (/app/projects/app/.next/server/chunks/7050.js:90:1025)\n at async M (/app/projects/app/.next/server/chunks/7050.js:90:5284)\n at async Promise.all (index 0)\n at async Promise.all (index 0)\n at async b (/app/projects/app/.next/server/chunks/7050.js:90:6369)\n at async /app/projects/app/.next/server/chunks/1282.js:1:3122"}
one-api无报错
原因:
Fastgpt使用docker部署使用了桥接模式,详细说明原理请看Docker容器网络模式
解决办法:
查看oneapi加入的桥接网络是什么 然后让Fastgpt也加入
修改Fastgpt的参数OPENAI_BASE_URL=http://oneapi的ip地址(172开头)/v1
然后创造容器并运行