dsh-deepseek-search-server —— 通过浏览器插件自动化 DeepSeek 搜索 鉴权(默认开启,自动密钥): 首次启动会生成一把随机 API Key 打印在日志里,并写入 .auth-token(重启沿用)。 所有 /v1/* 与 /api/* 需要下列任一: -H "Authorization: Bearer " -H "X-API-Key: " ?api_key= / 与 /health 保持开放;/api/files/:id/raw 走签名 URL(sig 参数),不需要 token。 想自己指定:AUTH_TOKEN=sk-xxx 或 --token sk-xxx 想轮换 :删除 .auth-token 想彻底关闭:AUTH_DISABLED=1 或 --no-auth(会告警,不推荐) 会话删除(默认关闭): 默认保留每次调用新建的 DeepSeek 会话(可在浏览器侧边栏复核)。 要「用完即删」:启动加 --delete-conversation(或 DELETE_CONVERSATION=1)。 GET /health GET /api/search?keyword=关键词[&format=json|md][&async=1][&newChat=0|1][&timeoutMs=180000] POST /api/search {"keyword":"...","attachments":["fxxx"],"newChat":true,"timeoutMs":180000} GET /api/tasks GET /api/tasks/:id GET /api/reports/:id.md GET /api/reports/:id.json 附件: POST /api/files 上传附件,三种方式都行 1) multipart/form-data: curl -F "file=@a.png" .../api/files 2) application/json: {"name":"a.png","mime":"image/png","data":""} 3) 原始字节: curl --data-binary @a.png -H "X-Filename: a.png" .../api/files GET /api/files 已上传附件列表 GET /api/files/:id 附件元数据 GET /api/files/:id/raw 附件原始字节(页面回读用) DELETE /api/files/:id 删除附件 OpenAI 兼容接口: GET /v1/models POST /v1/chat/completions {"model":"deepseek-web","messages":[{"role":"user","content":"..."}],"stream":false} POST /v1/completions {"model":"deepseek-web","prompt":"...","stream":false} - 支持多模态 content parts: {"type":"text","text":"..."} / {"type":"image_url","image_url":{"url":"data:..."}} 以及 {"type":"file","file":{"filename":"a.pdf","file_data":""}};url 也支持 http(s) - messages 里的 system 与历史轮次会被压平成一段提示词,最后一条 user 作为当前问题 - 长历史默认上限 OPENAI_MAX_PROMPT_LEN(20000 字符),超出才裁最旧轮次; 长提示词走「落盘 + 页面内写入」,不受插件查询串约 8KB 的限制 - stream:true 返回标准 SSE(data: {...} … data: [DONE]),正文增量来自页面 SSE 的部分文本 - 额外信息放在响应的 x_dsh 字段(会话地址、来源、附件、ref_file_ids 等) 示例: curl "http://127.0.0.1:18788/api/search?keyword=%E6%88%90%E9%83%BD%E7%BE%8E%E9%A3%9F" curl -X POST http://127.0.0.1:18788/api/search -H "Content-Type: application/json" -d "{\"keyword\":\"成都美食\"}" curl -F "file=@photo.jpg" http://127.0.0.1:18788/api/files curl -X POST http://127.0.0.1:18788/api/search -H "Content-Type: application/json" \ -d "{\"keyword\":\"这张图里是什么\",\"attachments\":[\"fxxx\"]}" curl -X POST http://127.0.0.1:18788/v1/chat/completions -H "Content-Type: application/json" \ -d "{\"model\":\"deepseek-web\",\"messages\":[{\"role\":\"user\",\"content\":\"成都美食推荐\"}]}"