首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

open-webui使用Searxng联网搜索

  • 25-04-25 08:21
  • 3426
  • 6893
blog.csdn.net

文章目录

  • Open WebUI结合代理过的Searxng实现联网搜索
    • 本地环境
    • 安装Open WebUI
    • 安装Searxng
    • 其它Web-Search
    • 参考文章

Open WebUI结合代理过的Searxng实现联网搜索

本身SearxngSearXNG | Open WebUI是一款多搜索引擎合在一起的浏览器,整体使用下来比google_pseGoogle PSE | Open WebUI引擎好用

特别注意:

  1. 使用Searxng需要对运行Searxng的容器设置代理,理论上无需对Open WebUI的容器设置主机网络代理,但在实际过程中,有观察到日志个别网站连接超时,且会不时请求下github版本,因此我都加了主机代理
  2. 使用google_pse则是由Open WebUI容器进行访问,需要设置主机代理
  3. 我的本机有http://127.0.0.1:7890的代理,后续有使用

本地环境

系统环境以及软件环境如下

centos 7.6
open-webui v0.5.16
docker 20.10.5
  • 1
  • 2
  • 3

安装Open WebUI

Open WebUI安装过于简单,根据自己情况参考文档安装

⏱️ Quick Start | Open WebUI

这是我的docker-compose.yaml供参考

version: '3.8'

services:
  open-webui:
    image: ghcr.io/open-webui/open-webui:latest
    container_name: open-webui
    restart: always
    ports:
      - "3000:8080" 
    environment:
      # TZ: Asia/Shanghai
      OPENAI_API_KEY: "your_secret_key" #填不填无所谓
      http_proxy: "http://host.docker.internal:7890"  # 关键变量
      https_proxy: "http://host.docker.internal:7890"
      no_proxy: "localhost,127.0.0.1,.internal"  # 排除内网地址
    extra_hosts:
      - "host.docker.internal:172.17.0.1"  # 宿主网关IP解析
    volumes:
      - /home/open-webui/data:/app/backend/data # /home/open-webui/data 为data映射路径,改为自己的
    networks:
      - proxy-net  # 专用网络
  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: 
      - --interval=300
      - --debug  # 添加调试模式
      - open-webui
    environment:
      # TZ: Asia/Shanghai
      http_proxy: "http://host.docker.internal:7890"  # 新增代理配置
      https_proxy: "http://host.docker.internal:7890"
      no_proxy: "localhost,127.0.0.1,.internal"  # 排除内网地址
    extra_hosts:  # 确保host解析
      - "host.docker.internal:172.17.0.1"
    depends_on:
      - open-webui

networks:
  proxy-net:
    driver: bridge
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42

注: 这里安装了watchtower进行监控自动更新Open WebUI,由于使用的ghcr.io/open-webui/open-webui:latest镜像,因此也需要设置代理否则会连接超时导致更新失败

watchtower使用参考:🔄 Updating Open WebUI | Open WebUI

安装Searxng

  1. 拉取代码

    git clone https://github.com/searxng/searxng-docker.git
    
    • 1
  2. 进入仓库

    cd searxng-docker
    
    • 1
  3. 修改docker-compose.yaml,为下面内容

    version: "3.7"
    services:
      searxng:
        container_name: searxng
        image: docker.io/searxng/searxng:latest
        restart: unless-stopped
        networks:
          - searxng
        ports:
          - "3001:8080" #3001修改为自己想要的端口,8080不可修改
        volumes:
          - ./searxng:/etc/searxng:rw
        environment:
          - SEARXNG_BASE_URL=http://192.168.0.231:3001 #本机IP:端口,例如192.168.0.231:3001,3001和上面对应一致,后面要用
          - http_proxy=http://172.17.0.1:7890  # 修改为Docker网关IP
          - https_proxy=http://172.17.0.1:7890
        cap_drop:
          - ALL
        cap_add:
          - CHOWN
          - SETGID
          - SETUID
        logging:
          driver: "json-file"
          options:
            max-size: "1m"
            max-file: "1"
    
    networks:
      searxng:
        driver: bridge
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    1. 俩个3001端口要一致
    2. 使用的是本机的IPv4地址,或者是服务器公网IP
    3. http_proxy=http://172.17.0.1:7890这里表示主机的7890端口,使用主机的7890进行容器环境的系统代理
  4. 修改searxng/settings.yml内容如下

    # see https://docs.searxng.org/admin/settings/settings.html#settings-use-default-settings
    use_default_settings: true
     
    general:
      debug: true
     
    engines:
      # 启用默认禁用的引擎
      - name: bing
        disabled: false
      - name: bilibili
        engine: bilibili
        shortcut: bil
        disabled: false
      # 禁用默认启用的引擎
      - name: arch linux wiki
        engine: archlinux
        disabled: true
      - name: duckduckgo
        engine: duckduckgo
        distabled: true
      - name: github
        engine: github
        shortcut: gh
        disabled: true
      - name: wikipedia
        engine: wikipedia
        disabled: true
    server:
      # base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.yml
      secret_key: "ultrajhjhjhjhyubwdwdwsbecretkey"  # change this! 这里一定要修改
      limiter: false  # can be disabled for a private instance
      image_proxy: true
    search:
      formats:
        - html
        - json # 允许以 json 形式返回结果
    ui:
      static_use_hash: true
    
    outgoing:
      proxies: "http://172.17.0.1:7890"  # 与 docker-compose 中的 IP 一致
      request_timeout: 10.0       # 延长超时时间
      max_retries: 3
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    1. 修改返回结果添加json
    2. outgoing部分强制Searxng应用程序走代理
  5. 构建并运行

    docker-compose up -d
    
    • 1
  6. 访问http://192.168.231:3001,该为自己上面填的

  7. 然后在open-webui中searxng地址填写为

    http://ip:port?q=&format=json

其它Web-Search

  1. 使用google_pse,需要对open-webui设置代理,可以直接在环境变量设置 🌍 Environment Variable Configuration | Open WebUI

    内置的google_pse API解决方案过程很简单,

    1.登录google开发者账号(有Google账号可以直接一键注册) https://developers.google.com/custom-search

    2.接着去可编程搜索引擎(pse)控制面板里添加一个自定义搜索引擎 https://programmablesearchengine.google.com/controlpanel/all

    3.点获取密钥就能拿api密钥了(这个记得存起来) https://developers.google.com/custom-search/v1/introduction

    4.回到控制面板再点创建的就能拿到搜索引擎ID了 https://programmablesearchengine.google.com/controlpanel/all

    5.把东西填上去就好了(默认联网功能是关的,要用的时候顺手开下)

  2. 使用国内博查的web-search,通过添加社区工具实现 Web Search using Bocha Search API Tool | Open WebUI Community

  3. 推荐一个DeepSeek-R1的函数,可以显示思考过程https://openwebui.com/f/zgccrui/deepseek_r1,后面是教程链接:OpenWebUI 添加 DeepSeek 思维链和联网 API_哔哩哔哩_bilibili

参考文章

  1. 私有化部署 SearXNG 实现 DeepSeek+Open-WebUI 联网搜索功能 - 志文工作室
  2. 大模型本地化部署(Ollama + Open-WebUI)_open webui-CSDN博客
  3. 使用SearXNG-搭建个人搜索引擎(附国内可用Docker镜像源)-CSDN博客
  4. searxng-docker/searxng/settings.yml at master · searxng/searxng-docker
  5. SearXNG | Open WebUI
  6. Google PSE | Open WebUI
  7. 🔄 Updating Open WebUI | Open WebUI
  8. 本地部署大模型openwebui(ollama部署的deepseetR1)联网搜索的一种解决方案 - hai(。・∀・)ノ゙ - 博客园
  9. Web Search using Bocha Search API Tool | Open WebUI Community
  10. OpenWebUI 添加 DeepSeek 思维链和联网 API_哔哩哔哩_bilibili
  11. 【知识科普】【纯本地化搭建】【不本地也行】DeepSeek + RAGFlow 构建个人知识库_哔哩哔哩_bilibili
注:本文转载自blog.csdn.net的我还没秃头~的文章"https://blog.csdn.net/qq_64373418/article/details/145934255"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2492) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

130
用户体验设计
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2024 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top