open webui-二次开发-源码启动前后端工程-【超简洁步骤】

参考资料

openwebui docs

获取源码

git clone https://github.com/open-webui/open-webui && cd open-webui

启动后端服务

cd backend
conda create --name open-webui python=3.11
conda activate open-webui
pip install -r requirements.txt -U
sh dev.sh

没有conda的要先安装下,启动成功会后监听8080端口。

启动前端服务

回到代码根目录

npm i
npm run dev

启动成功后会监听5173端口,在浏览器就可以访问http://127.0.0.1:5173

常见问题解决

1.在访问前端服务时显示logo后会显示空白页面

这个问题是因为后端在获取模型列表,在获取模型列表时会访问openai,在国内无法访问,可以通过修改后端代码屏蔽掉这个逻辑,代码如下:

代码路径 backend/open_webui/utils/models.py

在这里插入图片描述
注释掉以上代码后可进入webui界面。

2.在相关界面有可能会遇到跨域问题,导致无法访问后端工程服务

解决问题思路是避免跨域,可以使用nginx代理合并端口,把80805173合并到8888进行访问,这样就规避了跨域问题。nginx配置参考如下:

    server {
        listen       8888;
        server_name  localhost;

        location / {
             proxy_pass http://127.0.0.1:5173/;
        }

        location /api/ {
          proxy_pass http://127.0.0.1:8080/api/;
        }

        location /ollama/ {
          proxy_pass http://127.0.0.1:8080/ollama/;
        }

        location /openai/ {
          proxy_pass http://127.0.0.1:8080/openai/;
        }
    }

如何修改ollama监听地址和端口

vi /etc/profile
添加如下一行
export OLLAMA_HOST=http://0.0.0.0:11434
source /etc/profile
然后重启ollama服务

插入个人广告,不喜欢可以不用往下看了

搭建属于你自己的WEB堡垒机系统,只要有浏览器就可以远程控制你的电脑,协议支持rdp,vnc,ssh
官方地址:百百WEB堡垒机 http://bb.yun-api.com/

springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.support.ScheduledMethodRunnable#0': Cannot resolve reference to bean 'sysTask' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysTask': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ecp.crm.service.SaleTrackingService com.ecp.system.task.SysTask.saleTrackingService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'saleTrackingServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ecp.crm.dao.SaleTrackingDao com.ecp.crm.service.impl.SaleTrackingServiceImpl.fDao; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'saleTrackingDao' defined in file [D:\�����ļ�\soyogit\epm\trunk\target\epm-1.0.0\WEB-INF\classes\com\ecp\crm\dao\SaleTrackingDao.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/�����ļ�/soyogit/epm/trunk/target/epm-1.0.0/WEB-INF/classes/spring.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/D:/�����ļ�/soyogit/epm/trunk/target/epm-1.0.0/WEB-INF/lib/ecp-platform-extend-1.9.4.jar!/com/ecp/attachment/dao/mysql/AttachmentAssociateMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers already contains value for com.ecp.attachment.dao.AttachmentAssociateMapper.table-name; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in URL [file:/D:/�����ļ�/soyogit/epm/trunk/target/epm-1.0.0/WEB-INF/classes/spring.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'URL [jar:file:/D:/�����ļ�/soyogit/epm/trunk/target/epm-1.0.0/WEB-INF/lib/ecp-platform-extend-1.9.4.jar!/com/ecp/attachment/dao/mysql/AttachmentAssociateMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: XML fragments parsed from previous mappers already contains value for com.ecp.attachment.dao.AttachmentAssociateMapper.table-name
07-22
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值