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.53k stars 4.18k forks source link

Oneapi添加渠道本地大模型,显示Connection refused #1635

Open hamiduan opened 3 months ago

hamiduan commented 3 months ago

例行检查

你的版本 [ x] 私有部署版本, 具体版本号: Chatglm3-6b-base,image: ghcr.io/labring/fastgpt:v4.8.5,image: ghcr.io/songquanpeng/one-api:latest 系统:Windows11+WSL2+Ubuntu 22.04 问题描述 大模型baseurl接入oneapi后显示connection refuesed.

大模型:版本Chatglm3-6b-base,WSL2上运行,api_server设置uvicorn.run(app, host='127.0.0.1', port=8000, workers=1), post可访问127.0.0.1:8000,且有响应。 image

Fastgpt:Docker运行,端口:9091:3000, - OPENAI_BASE_URL=http://172.20.0.1:3000/v1,- Network: http://172.21.0.7:3000/

Oneapi:Docker运行,端口:3001:3000,- Network: 172.21.0.1, 渠道部署 Base url: 127.0.0.1:8000, 密钥:sk-fastgpt 报错:“utils.js:77 do request failed: Post "http://127.0.0.1:8000/v1/chat/completions": dial tcp 127.0.0.1:8000: connect: connection refused” image

测试过包括localhost, 0.0.0.0, 127.0.0.1, ipconfig下的ip地址等,皆无效。 image

Windows和WSL防火墙已down(启动wsl前,.wslconfig 文件已删除) 猜想:docker compose用桥接模式连接FastGPT,要如何将本地模型加入网络中? 求助大佬,感谢!

复现步骤 搭设并连接大模型,在docker上架设fastgpt+oneapi,在oneapi渠道上添加大模型base url。 参考教程:

  1. 本地化部署Fastgpt+One-API+ChatGLM3-6b知识库:https://blog.csdn.net/lachesis617/article/details/136275517
  2. FastGPT:https://doc.fastgpt.in/docs/development/intro/
  3. ChatGLM-3-6B 技术文档:https://zhipu-ai.feishu.cn/wiki/WvQbwIJ9tiPAxGk8ywDck6yfnof

预期结果 oneapi渠道连接本地chatglm3

HughesZhang2021 commented 3 months ago

same problem...

tommy-zhou commented 2 months ago

用内网IP地址进行访问试试看呢!

我直接跑是OK的,如下 【运行演示-OpenAI接口管理与分发开源应用OneAPI分享】 https://b23.tv/qVIZT2b

longzhiwen1989 commented 2 months ago

我也遇到过这个问题,端口8000放行之后就能连上模型,但是现在开始报status code 404,继续研究中。。。

hamiduan commented 1 month ago

已解决。Oneapi 渠道 LLM 的baseurl应设置本地IP地址,如http://192.168.2.23:8000。 Status code 404 可能出现在Embedding测试,或是LLM接口错误。 Oneapi调用的是v1/completion接口,不支持Embedding测试,应调用v1/embedding接口。