当前位置: 首页 > news >正文

searxng 对接openweb-UI实现大模型通过国内搜索引擎在线搜索

先看一下 qwen3-4b模型的效果

SearXNG简介:SearXNG 是一个免费的互联网元搜索引擎,它汇总了来自各种搜索服务和数据库的结果。用户既不会被跟踪,也不会被分析。

官方项目:https://github.com/searxng/searxng-docker

项目文档:https://docs.searxng.org

open-webui简介:Open WebUI 是一个可扩展、功能丰富且用户友好的自托管 AI 平台,旨在完全离线运行。它支持各种 LLM 运行器,如 Ollama 和 OpenAI 兼容的 API,并内置了 RAG 推理引擎,使其成为强大的 AI 部署解决方案。

官方项目:https://github.com/open-webui/open-webui

项目文档:⭐ Features | Open WebUI

安装部署

open-webui的安装方法非常简单

命令行安装:

#安装
pip install open-webui
#运行
open-webui serve
#这将启动 Open WebUI 服务器,您可以在 http://localhost:8080

open-webui的使用可以参考项目文档

docker安装:

docker run -d -p 3000:8080  -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

如何与模型对接也可以参考我的其它文档: 快速搭建大模型web对话环境指南(open-webUI)_大模型 webui 框架-CSDN博客

本次文档主要介绍searxng安装与使用

searxng 安装是支持 k8s 部署 docker compose部署 与命令行脚本安装或手动安装

本人都体验了一下

k8s是通过helm安装的,项目地址: https://github.com/searxng/searxng-helm-chart 该项目更新貌似不积极,而且也不是装好就能用也需要调整,适合k8s能力强者部署

命令行手动与脚本安装 需要提前准备好centos9 或ubuntu22以及以上的系统 python3.10以上环境才能安装成功,也需要自己配置nginx代理 自己配置开机自启动,而且容易很多报错,适合动手动能力强体验一下 参考官方文档:Installation Script — SearXNG Documentation (2025.7.9+2fe854090)

本次文档介绍docker compose安装 简单方便

官方配置:https://github.com/searxng/searxng-docker/blob/master/docker-compose.yaml

(文档建立在默认配置好docker环境的服务器中,并有能力拉取dockerhub镜像仓库)

进入searxng-docker项目目录后 修改docker-compose.yaml 文件配置

本次配置做了一些修改:

删除了caddy相关配置,这是一个类似nginx的反向代理服务,这个一般企业内安装是不需要的,根据个人所需决定是否安装

version: "3.7"services:redis:container_name: redisimage: docker.io/valkey/valkey:8-alpinecommand: valkey-server --save 30 1 --loglevel warningrestart: unless-stoppednetworks:- searxngvolumes:- valkey-data2:/datalogging:driver: "json-file"options:max-size: "1m"max-file: "1"searxng:container_name: searxngimage: searxng/searxng:latestrestart: unless-stoppednetworks:- searxngports:- "0.0.0.0:8080:8080"volumes:- engines-file:/usr/local/searxng/searx/engines  #这里将搜引擎目录持久化出来 是因为searxng docker镜像默是缺失国内搜索引擎的配置的- ./searxng:/etc/searxng:rwenvironment:- SEARXNG_BASE_URL=https://${SEARXNG_HOSTNAME:-localhost}/- UWSGI_WORKERS=${SEARXNG_UWSGI_WORKERS:-4}- UWSGI_THREADS=${SEARXNG_UWSGI_THREADS:-4}- SEARXNG_SETTINGS_PATH=/etc/searxng/settings.ymllogging:driver: "json-file"options:max-size: "1m"max-file: "1"networks:searxng:#卷持久化路径需要配置一下 不了解可以问一下ai都是什么意思
volumes:valkey-data2:driver: localdriver_opts:type: noneo: binddevice: /data/searxng-docker/redis/valkey engines-file:driver: localdriver_opts:type: noneo: binddevice: /data/searxng-docker/engines-file

修改配置文件searxng-docker/searxng/settings.yml (这是一次正确配置 大家可以参考)

# see https://docs.searxng.org/admin/settings/settings.html#settings-use-default-settings
use_default_settings: true
server:# base_url is defined in the SEARXNG_BASE_URL environment variable, see .env and docker-compose.ymlsecret_key: "34788b49b8f9d819cfcb09da447b0d8586c63ad1acd469a1e446"    #这个可以复用 也可以自己生成limiter: falseimage_proxy: true
ui:static_use_hash: true
redis:url: redis://redis:6379/0
search:formats:- html- json   ##开启json模式 方便被llm调用engines:
# 启用默认禁用的国内引擎- name: baiducategories:- web- news- generalengine: baidushortcut: bdtimeout: 9.0disabled: false- name: 360searchcategories:- web- news- generalengine: 360searchshortcut: 360sotimeout: 9.0disabled: false# 禁用默认启用的外国搜索引擎- name: archlinuxwikiengine: archlinuxdisabled: true- name: duckduckgoengine: duckduckgodistabled: true- name: githubengine: githubshortcut: ghdisabled: true- name: wikipediaengine: wikipediadisabled: true- name: wikidataengine: wikidatadisabled: true- name: googleengine: googledisabled: true- name: youtubeengine: youtube_noapidisabled: true- name: duckduckgoengine: duckduckgodisabled: true- name: qwantengine: qwantdisabled: true- name: braveengine: bravedisabled: true- name: startpageengine: startpagedisabled: true- name: currencyengine: currencydisabled: true

这里重点说一下 searxng/searxng:latest 这个镜像 是没有自带国内搜索引擎的,看网上很多人并不需要特殊配置就可以用国内引擎,我是存疑的

会报错

Errno 2] No such file or directory: '/usr/local/searxng/searx/engines/baidu.py

这也是为什么我将engines-file:/usr/local/searxng/searx/engines 持久化到/data/searxng-docker/engines-file

尝试第一次启动:

docker compose up -d

之后访问该机器8080端口 可以看到如下页面:

配置默认国内搜索引擎

点击首选项

查看搜索引擎

确认是否有国内的搜索引擎

如果没有就需要将 国内的引擎配置文件导入 (另外 上图首选项的哪些配置只保存在客户端的cookie中,并不是全局生效的)

导入步骤如下:

打开项目:https://github.com/searxng/searxng-docker/tree/master/searxng

找到引擎文件 并下载

将下载好的引擎导入到容器持久化目录/data/searxng-docker/engines-file

重启容器:

docker compose stop
docker compose up -d

再次确认国内引擎是否可以选中

确认搜索内容 引擎加载正常

之后打开open-webui 设置-管理员设置-联网搜索-searxng查询URL

http://<IP地址或域名>:8080/search?q=<query>

之后测试对话:

http://www.dtcms.com/a/271821.html

相关文章:

  • 搜索引擎vs向量数据库:LangChain混合检索架构实战解析
  • 计算机视觉 之 数字图像处理基础
  • 基于 SpringBoot + Vue 的 IT 技术交流和分享平台的设计与实现
  • TCP-与-UDP-协议详解:原理、区别与应用场景全解析
  • 北斗舞动在线监测装置:电力安全的“智慧守护者”
  • SpringMVC @ExceptionHandler 典型用法
  • 了解去中心化金融在现代经济中的作用——安全交易新时代
  • 编写bat文件自动打开chrome浏览器,并通过selenium抓取浏览器操作chrome
  • 双指针-18.四数之和-力扣(LeetCode)
  • linux系统---ISCSI存储服务
  • Language Models are Few-Shot Learners: 开箱即用的GPT-3(二)
  • 节点小宝:手机图片备份至电脑功能实测体验
  • 同一类型,每条数据,执行不同逻辑
  • 偏振相机,偏振图像是怎么样的
  • WebGPU了解
  • 智能体决策机制深度剖析:ReAct、Plan-and-Execute与自适应策略
  • 云蝠智能VoiceAgent重构企业电话客服体系
  • PLC框架-1.3.2 报文750控制汇川伺服的转矩上下限
  • 【前缀和 BFS 并集查找】P3127 [USACO15OPEN] Trapped in the Haybales G|省选-
  • XSS(跨站脚本攻击)
  • RabbitMQ 消息队列:从入门到Spring Boot实战
  • Java 枚举详解:从基础到实战,掌握类型安全与优雅设计
  • 7-语言模型
  • CRT 不同会导致 fopen 地址不同
  • 技术演进中的开发沉思-30 MFC系列:五大机制
  • 删除k8s安装残留
  • Spring Boot:将应用部署到Kubernetes的完整指南
  • ACL协议:核心概念与配置要点解析
  • Docker 环境下 MySQL 主从复制集群、MGR 搭建及 Nginx 反向代理配置
  • SSRF10 各种限制绕过之30x跳转绕过协议限制