searxng AI搜索能力

验证

docker exec -it open-webui curl "http://searxng:8080/search?q=hello"

docker-compose.yml

services:
  searxng:
    image: searxng/searxng:2026.4.11-9e08a6771
    container_name: searxng
    volumes:
      - ./data/etc:/etc/searxng:rw
      - ./data/cache:/var/cache/searxng:rw
    networks:
      - ghost_net
    restart: unless-stopped
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - DAC_OVERRIDE

networks:
  ghost_net:
    external: true

接入open-webui

环境变量
      # --- 联网搜索 ---
      - ENABLE_RAG_WEB_SEARCH=True
      - RAG_WEB_SEARCH_ENGINE=searxng
      - SEARXNG_QUERY_URL=http://searxng:8080/search?q=<query>
      - RAG_WEB_SEARCH_RESULT_COUNT=3
      - RAG_WEB_SEARCH_CONCURRENT_REQUESTS=10

问题修复

  • 403 Forbidden(SearXNG 拒绝 JSON)

    sudo sed -i '/^[[:space:]]\+formats:/a \    - json' data/etc/settings.yml
    
    openwebui 出现这个日志表示搜索链路通了
    Fetching pages: 100%|##########| 8/8 [00:06<00:00,  1.20it/s]
  • 解决嵌入模型 NoneType 错误(RAG 功能依赖)

    具体报错
    embedding_function.encode()
    AttributeError: 'NoneType' object has no attribute 'encode'
    
    open-webui 设置 → 嵌入 选择一个可用的嵌入模型(推荐 bge-small-en-v1.5 或 all-MiniLM-L6-v2)
    勾选 绕过嵌入和检索
    设置完,重建索引