惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
C
Cyber Attacks, Cyber Crime and Cyber Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
G
GRAHAM CLULEY
T
Threatpost
A
Arctic Wolf
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Scott Helme
Scott Helme
Simon Willison's Weblog
Simon Willison's Weblog
P
Proofpoint News Feed
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
T
Tor Project blog
NISL@THU
NISL@THU
The GitHub Blog
The GitHub Blog
Security Latest
Security Latest
aimingoo的专栏
aimingoo的专栏
C
CERT Recently Published Vulnerability Notes
Recorded Future
Recorded Future
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
N
News | PayPal Newsroom
P
Privacy & Cybersecurity Law Blog
MyScale Blog
MyScale Blog
G
Google Developers Blog
V
V2EX
V
Visual Studio Blog
P
Privacy International News Feed
Google Online Security Blog
Google Online Security Blog
Microsoft Azure Blog
Microsoft Azure Blog
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
L
LINUX DO - 热门话题
MongoDB | Blog
MongoDB | Blog
腾讯CDC
J
Java Code Geeks
The Last Watchdog
The Last Watchdog
L
Lohrmann on Cybersecurity
Cyberwarzone
Cyberwarzone
博客园 - 聂微东
Webroot Blog
Webroot Blog
S
Secure Thoughts

Menghuan1918's Blog

提升浏览器多标签页管理效率 介绍页 友链 My Arch Linux - 外观与字体 使用ray.tune进行自动调整超参数 使用Docker(MinIO)和Caddy创建图床服务 AI系统攻击手段(简要概述) RAG预处理增强:让Fastgpt/Dify召回更多东西 将PDF知识图谱化:graphrag+Doc2X+DeepSeek 包管理工具UV使用指南:全面替代conda 折腾杂谈:运用Dify+xinference+ollama构建知识库 Ollama跨平台性能比拼:Windows遥遥落后 折腾杂谈:部署一个网页在线状态面板/反代切换到Caddy 笔记软件的最终选择:Obsidian + Self-hosted LiveSync 配置DOSBox以及其窗口大小 在VSCode中配置多平台的C/C++语言支持 折腾杂谈:部署Alist并整合/服务器优化 在Linux上交叉编译出Windows可执行程序 利用MSYS2在windows上配置C/C++/openGL开发环境 强制对游戏应用FSR 折腾杂谈:Docker部署Rustdesk/切换网站框架 Speedometer 3.0分数测试(电子斗蛐蛐) 在Arch Linux下编译32位C程序出错 使用pelican以及nginx建立个人博客
如虎添翼:为gpt_academic配置searxng搜索
Menghuan1918 · 2024-06-26 · via Menghuan1918's Blog

使用gpt_academic + searxng搜索,进行网页或者学术论文的快速检索。实验下来使用超级便宜的deepseek-chat也能有相当好的效果。不过由于要处理的文本量偏多,原版的llama3处理这种任务就有点力不从心了,可能需要使用上下文更大的本地模型才能有更好的效果。

效果展示

由于最近在研究RAG方面,先让它帮我搜下RAG方面文件处理的论文吧:

效果挺好
效果挺好

或者尝试下网页搜索:

什么是拱门里里克斯
什么是拱门里里克斯
搜搜小波奇
搜搜小波奇

部署searxng

首先假设你已经有你自己的服务器以及域名了,例如此处我将其部署在searxng.mini-bocchi.top上。当然你要是打算仅本地使用,只需要有电脑就行了(废话)。

随后遵从searxng官方docker教程走:

cd /usr/local
git clone https://github.com/searxng/searxng-docker.git
cd searxng-docker
sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml

随后编辑下你的.env文件,其是给docker镜像中Caddy进行反代使用的。

如果你仅会在本地访问,不需要编辑.env文件中的SEARXNG_HOSTNAME,其默认就是https://localhost

随后docker compose up -d就好了,这时候你就可以访问之前设置的SEARXNG_HOSTNAME测试了。

或者是docker-compose up -d,取决于你的docker-compose版本

适配gpt_academic

此时虽然searxng已经配置好了,但是为了能在gpt_academic中使用API调用还需要一些额外的操作。

允许json形式的搜索并启用bing搜索

默认情况下searxng并不会启用bing搜索,以及搜索的入参形式也不支持json形式,编辑/usr/local/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.yml
  secret_key: "自动生成的密匙"  # change this!
  limiter: true  # can be disabled for a private instance
  image_proxy: true
ui:
  static_use_hash: true
redis:
  url: redis://redis:6379/0
engines:
  - name: bing
    disabled: false
search:
  formats:
    - html
    - json

增加的部分是从engines:一行往下,其上面的部分请保留你的配置。

随后在gpt_academic的配置文件(即config_private.py)中添加一行SEARXNG_URL = "你的URL"即可。本地访问的话填写https://localhost即可。

其他

以下是一些额外的配置

将自己的IP加入白名单

你也不想被限制住吧
你也不想被限制住吧

searxng默认开启了按照IP的速率限制器,为了防止自己被限制了,最好将自己加到白名单中。编辑/usr/local/searxng-docker/searxng/limiter.toml

# This configuration file updates the default configuration file
# See https://github.com/searxng/searxng/blob/master/searx/botdetection/limiter.toml

[botdetection.ip_limit]
# activate link_token method in the ip_limit method
link_token = true

[botdetection.ip_lists]

pass_ip = [
        '114.514.191.98/10',
]

可以配置很多个ip段

使用本机自带的Caddy

如果你部署的服务器和我一样,其宿主机上已经运行有一个Caddy反代服务了,那么在启动这个docker-compose时会提示你端口已经占用。你需要将docker-compose.yaml中所有和Caddy相关的部分删掉(或者注释掉),随后编辑宿主机的/etc/caddy/Caddyfile

#...假设这是你以前的内容
searxng.mini-bocchi.top {
        encode zstd gzip
        reverse_proxy localhost:8080
}

假如你也在使用Cloudflare

如果你也开了CF的小黄云,需要自定义转发下发起方IP,否则searxng会一直将CF的服务器IP认为是请求方IP。

编辑/etc/caddy/Caddyfile

searxng.mini-bocchi.top {
        encode zstd gzip
        reverse_proxy localhost:8080 {
                header_up X-Forwarded-Port {http.request.port}
                header_up X-Forwarded-Proto {http.request.scheme}
                header_up X-Real-IP {http.request.header.CF-Connecting-IP}
                header_up X-Forwarded-For {http.request.header.CF-Connecting-IP}
        }
        tls /etc/ssl/mini-bocchi.pem /etc/ssl/mini-bocchi.key
        # 这是我的CF证书,换成你自己的
}