Fetching metadata from the HF Docker repository...
Nov 14 8 days ago 04:01 feat(agy): 内嵌 agy2api,接入 Gemini 模型与独立 AGY 面板 Running luckfun233
Nov 13 9 days ago 20:56 fix(build): 修正 logs/ 忽略规则误伤日志模块源码 - 让 internal/httpapi/admin/logs 与 webui/src/features/logs 纳入版本控制
- 容器内配置位于 /data 时日志与日志 Key 落到 /data 14:44 feat(logs): 请求日志页面与只读日志 API Key;修复禁言账号导致的 503 luckfun233
- 新增 reqlog:内存环形窗口 + JSONL 按大小轮转(默认 8MiB×5),
仅记录请求元数据,不记录正文
- 新增 WebUI「请求日志」页:实时查询、级别/状态/关键词过滤、
详情查看、单文件/打包下载
- 新增日志读取 API Key:仅保存 SHA-256、固定 ds2log_ 前缀、
可设有效期与删除;只放行 /logs/api 只读接口,无法触达 /admin
- 上游 HTTP 200 + JSON 业务错误(禁言 / MISSING_HEADER /
INVALID_POW_RESPONSE)不再被当作空 SSE 流,返回明确错误码
- 禁言状态从登录与 completion 响应落库到 muted_until,账号池自动
跳过;全部禁言时快速返回 429 而非排队等待
- 「刷新 Token」成功时显示刷新成功,禁言账号显示解除时间
- 补充 docs/request-logs.md Nov 8 14 days ago 09:35 docs(reverse): 2.7.5 风控/设备指纹/校验点深度逆向 luckfun233
- 补全数美 Android SDK 3.14.3_build1 的 SmOption、区域域名、
serverId 回调、指纹字段、RSA-OAEP/AES-CBC 加密流水线
- 补全 x-device-id / x-rangers-id / shumei_device_id 三条设备身份线
- 补全登录 LoginBizCode、MFA 端点/模型/错误码、可信设备 ES256 流程
- 补全 completion/upload 校验点、ChatCompletionErrorCode、
UploadFileBizErrorCode、文件/图片限制与远端配置默认值
- 汇总 ds2api 已对齐项与剩余差距 Nov 7 15 days ago 11:33 Delete Ghidra (2).zip Bai Chen
11:18 fix(auth): 登录限流/MFA 冷却与设备风控参数补全 luckfun233
- 登录响应 40029 TOO_MANY_REQUESTS 时进入 5 分钟冷却,mfa_ticket 时
进入 30 分钟冷却,冷却期内不再重复提交密码,避免持续加重风控
- 新增 LoginChallengeError,MFA 场景不再误报 missing login token
- 会话探针成功后调用 auth_token/check_device,支持 rotate.token 轮换
- 账号配置新增可选 x_device_id,登录与 Android 请求按需携带
- 文档补充登录/MFA 实测结果、可信设备 ES256 流程与端点全集 11:01 fix(sse): 修复片段快照导致正文被误判为 reasoning 的空回复 luckfun233
- 支持上游 2.7.5 起不带 o 字段的 response/fragments 片段快照,
在 THINK → RESPONSE 时正确切换当前片段类型,避免正文全部进入
reasoning_content 并触发 upstream_empty_output
- completion/continue 自动注入 shumei_device_id(2.7.5 新必填字段)
- 修正 upstream_empty_output 的误导性 429 限流文案
- 补充解析器回归测试与 2.7.5 逆向/故障复盘文档 Oct 31 22 days ago 06:17 feat(models): 模型列表独立成页面,每个模型可独立选提示词风格 luckfun233
- 侧边栏新增「模型列表」页(/admin/models):自定义模型 + 模型别名,
从设置页移出;删掉随之变成死代码的 ModelSection.jsx
- 自定义模型新增 style 档位:inherit / v2 / writing / legacy / custom,
一档同时决定「内置文案用哪版」与「注不注入特化层」:
v2/writing 固定 v2 文案,legacy 固定旧版短文,custom 用条目正文
且文案跟随全局;与全局 prompt_profile 仍然互斥,不叠加
- 兼容旧配置:只有 prompt、没有 style 的条目按 custom 解释,行为不变
- /admin/model_profiles 与 /admin/settings 返回 style_names
- 设置页按用途分 6 组(提示词 / 上下文与技能 / 运行与行为 / 工具调用 /
安全 / 数据与备份);提示词风格与思考注入合并成一张卡,
Responses TTL 与 Embeddings 归入运行行为
- 写作规范新增「不要照搬指令原文」一节,并写明两个例外:用户点名要原样
出现的句子/术语/数据/关键词必须一字不改地保留,避免模型连带删掉
- 同步 API(.*).md / README.en.md / prompt-compatibility.md / prompt-design.md 01:15 feat(prompt): 新增 prompt_style 风格档位与自定义模型列表 luckfun233
- 新增 prompt_style:v2(缺省)/ legacy。legacy 把衔接指令换回 ce5a019 的
短文案,且不注入内置执行契约(自己配置的思考提示词仍然生效),用于恢复
旧版「几乎不加约束」的手感;未知值回落 v2,后台 PUT 传错返回 400
- 新增 model_profiles 自定义模型列表(缺省空,最多 50 条):id + base +
name/remark + 该模型专属 prompt;模型解析优先于内置别名映射,
/v1/models 一并列出(owned_by=ds2api)
- 模型提示词与全局 prompt_profile 互斥(命中优先,否则回落),与技能层合成
单个 System 段;注入点仍在历史拆分之后,不动 Messages
- 新增 GET/PUT /admin/model_profiles(整体替换语义 + 字符集/基模/上限校验)
- /admin/settings 增加 prompt_style 与 model_profiles 摘要
- 后台新增「自定义模型」板块与「内置提示词风格」下拉,中英文案同步
- 同步 prompt-compatibility.md / prompt-design.md / API(.*).md /
README.en.md / config.example.json Oct 24 29 days ago 07:15 refactor(prompt): 内置提示词分层重构,修复拆分后执行契约被埋 luckfun233
- 提示词收敛到 internal/promptcompat/prompt_texts.go 唯一来源,
history 包去掉自带文案,只保留一层委托
- 修复历史拆分后执行契约只留在附件里:拆分发生时重贴到可见 FinalPrompt
(只改 prompt,不动 Messages / PromptTokenText,切号重传不重复贴)
- 衔接指令新增「执行要求」:上文提过的体裁/篇幅/禁用项逐条满足,
并带「闲聊就不必硬套结构」的例外
- 新增 prompt_profile 提示词特化层(缺省关闭):default / writing 预设
或自定义正文,与技能层合成单个 System 段
- 去掉只对交付物成立的硬性文风规则(结论先行/不写铺垫/说明改动理由/
检查单位口径),改为触发条件或只留在 writing 预设,避免闲聊被压成公文
- 后台新增「提示词特化层」,GET/PUT /admin/settings 支持 prompt_profile
- 新增 docs/prompt-design.md,同步 prompt-compatibility.md / API(.*).md /
README(.*).md / config.example.json 06:09 refactor(prompt): 移除工具调用与技能注入的引导提示词 luckfun233
实测 DSML 工具调用会被上游风控识别(封号风险),且高频调用容易触发限速,
prompt 侧不再做任何引导:
- 不再生成 context_tools.txt 工具说明文件,也不再输出 DSML 调用格式要求
(You have access to these tools / TOOL CALL SCHEME / 必须调用工具);
只保留工具名提取,供 tools.enabled=true 时的响应侧 tool_calls 解析
- 技能块去掉引导语,只保留 <skill> 标签与正文,避免引导模型使用技能
- 历史拆分只上传对话记录文件;相关测试与文档同步更新 01:46 ci(hf): checkout 时拉取 LFS 对象,修复 sync-to-hf 因缺少 Ghidra zip 而失败 luckfun233
01:40 feat: 收敛 flash 模型系列,新增纯文本技能库与工具调用开关 luckfun233
- 模型:对外只保留 deepseek-v4-flash 系列(含 search/nothinking 变体),
pro/vision 旧名静默映射到 flash,不再出现在模型列表
- 思考/联网:适配 kelivo 思维强度(reasoning_effort 含 max、thinking.type、
reasoning.effort),显式联网信号(enable_search / 原生 web_search 工具)自动跟随
- 提示词:重写上下文衔接指令与对话记录格式(# 对话记录 + [role=xxx]),
禁止提及附件/文件/上下文;恢复并优化思考格式注入默认提示词
- 提示词:新增按 API Key 覆盖思考格式注入(custom/enabled/prompt)
- 工具调用:改为默认关闭(上游 DSML 风控/封号风险),新增 tools.enabled 开关,
关闭时忽略 tools、不注入工具说明、不解析 tool_calls
- 技能:新增纯文本技能库(实验性、默认关闭),技能正文以 System 段前置注入,
支持 skills.max_chars 截断与单 Key 覆盖(custom/enabled/ids)
- 日志:按 API Key 筛选、自定义保留条数(0-500)、json/markdown 导出
- 管理台:响应记录筛选栏/导出、工具开关、技能库编辑、Key 级注入与技能配置
- 文档:新增 docs/prompt-compatibility.md,同步 API.md/API.en.md/README/示例配置 Oct 20 14:23 docs: 第三阶段逆向(重发语义/配额频率/重打包/多端同步) luckfun233
基于新版 2.6.3(283) 静态逆向新增研究报告:消息树负 id 与 leaf 选取
解释“重发占同一条消息”;确认 regenerate_quota 本地强制默认 5 而
edit_quota 无消费点;给出 completion/edit/regenerate 端点等价性边界、
重打包与 Hook 可行性、以及 cache_version/cache_control 多端同步模型。 Oct 19 16:40 chore: 逆向分析 DeepSeek Android 应用机制 luckfun233 +1: traeagent
Co-authored-by: traeagent <traeagent@users.noreply.github.com> 16:08 docs: 深入逆向 DeepSeek Android 撤回/配额机制(第二阶段) luckfun233
新增 docs/deepseek-android-recall-quota-phase2-research.md:基于 jadx
apktool/Ghidra 对 v2.6.2 的静态逆向,补齐消息存储(WCDB/分支树/leaf)、
CONTENT_FILTER 撤回 patch、edit/regenerate 配额、completion vs
edit_message vs regenerate 的端点语义,并给出反撤回/配额挂载/上下文
补齐的可行性与多方案分析。 15:45 Update deepseek-android-reverse-research.md Bai Chen
14:23 docs: add DeepSeek Android (v2.6.2) reverse-engineering research trae-research
Static analysis of the official deepseek.apk covering:
- network/API layer, request/response models, SSE JSON-patch (hy.java)
- local message storage (WCDB deepseek_chat_<uid>.db, per-session tables)
- content-filter/recall handling (CONTENT_FILTER + TEMPLATE_RESPONSE + ban_edit/ban_regenerate)
- edit/regenerate quota mechanism (ModelConfig.edit_quota/regenerate_quota)
- why copy-paste re-send goes through /chat/completion and bypasses the quota scope 14:05 Add files via upload Bai Chen
Oct 18 01:34 fix(auth): token 刷新改为无密码会话探针,密码登录仅作兜底 luckfun233
DeepSeek 的 token 是按设备绑定的长期会话凭证,不存在 access/refresh
两段式机制,也没有可换新的端点;原来的「刷新」实际是每 6h(以及每次
鉴权类失败)提交一次明文密码并过一次数美风控。
- 新增 Client.RefreshSessionToken:GET /api/v0/users/current 回填会话 token
- Resolver 刷新链改为探针优先,只有服务端明确拒绝会话才回退密码登录;
探针无法判定时,定时路径保留现有 token,失败恢复路径仍兜底登录
- 失效判定收窄到 401/403 与 code/biz_code 40001-40003(实测失效响应是
HTTP 200 + code=40003,只按状态码会漏判)
- 未注入探针时保持历史行为,测试与自定义装配不受影响
- 文档:research 文档补落地细节与线上实测,security 报告与 API.md 同步配置语义 Oct 17 13:02 docs: 新增 DeepSeek token 刷新机制逆向研究 luckfun233
结论:现有 RefreshToken 实际是完整重新登录(复交密码 + 过数美风控);
DeepSeek 无 refresh_token 机制,token 为按设备绑定的长期不透明会话串。
官方客户端的刷新方式是 GET /api/v0/users/current 回填 biz_data.token,
另有 POST /users/auth_token/check_device 的 rotate.token 轮换通道(抓包恒为 null)。
文档给出分阶段改造建议与未闭环的待验证项。 Oct 6 12:44 perf(chathistory): 拆分读写锁并合并流式落盘,修复 HF Space 整体卡顿 luckfun233
线上表现为 API 响应变慢、后台面板加载历史对话卡顿。根因是对话历史的落盘
路径把整个服务串行化了:
- Store 只有一把互斥锁,saveLocked 在持锁状态下完成 JSON 序列化 + fsync +
rename;而 Snapshot / Get(后台面板读历史)用的是同一把锁,因此被流式写入
直接阻塞。
- progress() 在每个 SSE 分片上被调用(250ms 节流),每次都重写包含 messages /
history_text / final_prompt 等请求期内不变字段的完整记录。HuggingFace Spaces
的 /data 是 bucket 对象存储卷,单次 fsync 的延迟远高于本地盘,几十秒的响应
就会触发数百次高延迟写入。
改动:
- 拆成 mu(仅内存状态,持锁期间不做 I/O)与 writeMu(仅串行化落盘),后台
面板读取不再阻塞在磁盘上。
- 新增 UpdateParams.Background:流式进度只写 <id>.live.json 增量文件,由单个
自终止的合并协程按 400ms 窗口合并落盘,彻底脱离 SSE 读取循环;终态更新仍
同步回写完整文件并清理增量文件。
- 去掉 chat history 的 fsync,保留「临时文件 + rename」的原子性。
- 后台面板轮询降频(列表 1.5s→3s,详情 750ms→1.5s)。
实测单次进度写入从 84,475 B 降至 246 B(343x)。旧数据无需迁移即可加载。
Start 与终态 Update 仍同步返回写盘错误,保持既有错误语义。 Sep 25 00:39 feat: 更新Web端接口文档,补充数美风控升级后的协议细节与失败分类说明 luckfun233
Sep 24 17:15 feat: 更新数美 SDK 相关文档,添加复现手册及工具链,修复解析逻辑 luckfun233
17:03 feat(shumei): enhance device ID generation and add options for UID luckfun233
- Introduced DeviceOptions struct to allow specifying a UID for device ID generation.
- Updated GetDeviceID and GetDeviceIDWithOptions functions to support the new options.
- Improved fingerprint data construction to align with browser SDK.
- Added comprehensive tests for device ID generation and fingerprint data handling.
fix(sse): refine handling of tool fragments in SSE parsing
- Updated ParseSSEChunkForContentDetailed to correctly identify tool fragments and prevent their content from leaking into the main response.
- Enhanced fragment type resolution to ensure proper handling of nested paths and status checks.
- Added tests to verify the correct behavior of tool fragments and their impact on stream parsing.
test(sse): add tests for search mode and fragment handling
- Implemented tests for various scenarios in the search mode, ensuring that tool fragments do not affect the main content.
- Verified that the response status behaves correctly in both fragment and response contexts… Aug 1 04:34 feat: 添加文件审核严格模式设置,增强文件上传安全性 204848
04:25 feat: 对齐安卓端协议,隔离账号风控,透出文件元信息到对话历史 204848
基于安卓端最新抓包分析,修复以下问题:
P0 风控隔离:新增 account_identity.go,为每个账号生成独立 device_id 和 x-rangers-id,移除 x-rangers-id 全局硬编码,Account 新增 DeviceID/RangersID 字段支持用户自定义。
P1 协议对齐:create_session 移除多余 agent 字段;upload_file 移除 PoW 申请(仅 completion 需要 PoW);upload_file 恒携带 x-model-type 头;UploadFileResult 新增 AuditResult/ModelKind/SignedPath 字段。
文件审核开关:新增 file_audit.strict 配置,默认关闭(撤回机制对本项目无影响,completion 流完整推送,撤回事件在最后追加);新增 isPassedAuditResult/isFailedAuditResult 判断。
文件元信息透出(无论开关):chathistory.Entry 新增 file_infos 字段 + FileInfo 结构体;StandardRequest 新增 FileInfos,current_input_file 上传时转换并追加;chat_history.go 和 responsehistory/session.go 传递 FileInfos;前端 ChatHistoryDetail 新增 FileInfosView 组件;zh/en i18n 添加翻译。
其他:.gitignore 添加 *.har 通则排除抓包文件;新增 deepseek-recall-research.md 撤回机制研究文档。 Jul 22 01:42 feat: 增强管理员登录安全性,添加IP失败计数器以防止字典攻击,限制请求体大小,优化配置文件权限 luckfun233
Jul 21 15:31 security: 修复管理员鉴权与配置导出泄露等严重漏洞 luckfun233
针对部署在 Hugging Face Spaces 上的 ds2api 进行安全审计并修复 5 个严重问题:
FIXED-1 (CRITICAL): effectiveAdminKey 不再硬编码返回 "admin",
未配置凭据时返回空字符串禁用密码登录,避免任何知道源码的攻击者
直接登录未配置管理员密钥的部署。
FIXED-2 (CRITICAL): jwtSecret 在未配置时不再回退到 "admin",
新增 fallbackJWTSecret() 使用 crypto/rand 生成进程级 32 字节
随机 secret,防止攻击者用历史默认值伪造 JWT 绕过 RequireAdmin。
FIXED-3 (HIGH): /admin/config/export 的 config 字段改用
Config.RedactSecrets() 清除所有 token/password/vercel token/
admin password_hash,避免 admin JWT 泄露链导致凭据全部泄露。
json/base64 字段保留密码(迁移必需)但清除 live token,
并新增 secrets_in_json 警告标志。
FIXED-4 (MEDIUM): 删除可疑的 _fix.py 和 _fix2.py,其中
_fix2.py 使用 chr() 字符编码混淆访问 "Dockerfile",符合
安全审计中的可疑模式。
FIXED-5 (MEDIUM): devcapture 改为默认禁用,必须显式设置
DS2API_DEV_PACKET_CAPTURE=1 才启用。原逻辑在非 Vercel 环境
默认启用,会捕获每次请求的完整 prompt/response(最大 5MB)
并通过 /admin/dev/captures 暴露,存在内存与隐私风险。
新增 12 个回归测试覆盖所有修复点,包括默认密钥拒绝、JWT 伪造
拒绝、配置导出脱敏、迁移用途保留等攻击场景。详细审计报告与
待修复问题见 security_best_practices_report.md。 Jul 14 16:02 feat: 添加HF Space卡死自愈功能,增强代理健康检查逻辑,更新配置文件 204848
15:08 feat: 增强HIF轮询逻辑,添加退避饱和状态处理,优化日志记录 204848
14:57 feat: 优化HTTP/2支持,调整拨号器以优先使用IPv4并兼容utls指纹 204848
13:04 feat: 更新Web端支持,强制使用HTTP/2并调整TLS拨号器以兼容IPv4 204848
12:42 feat: 增强配置文件恢复机制,支持损坏文件的备份和恢复 204848
Jun 21 08:26 feat: 添加平台配置支持,包括Android和Web版本及API级别的自定义设置 204848
Jun 9 09:25 feat: 新增数美SDK逆向研究报告及Web端接口实现文档 luckfun233
09:14 feat: update platform handling and add web support luckfun233
- Updated Android client version to 2.1.5 in constants_shared.json.
- Introduced new constants_web.json for web platform configuration.
- Enhanced transport layer to support platform-specific TLS settings.
- Added platform configuration handling in settings update and read requests.
- Implemented platform selection UI in the web interface.
- Updated localization files for platform settings.
- Added Shumei device ID generation logic for web platform.
- Introduced confusion mapping and encryption for device ID generation. 00:38 feat: Add jitter and random offset to token refresh intervals for better distribution luckfun233
00:06 feat: Implement account role management and banning functionality luckfun233
- Added role management for accounts, allowing accounts to be set as "normal" or "standby".
- Introduced banning functionality, marking accounts as banned and preventing their use.
- Updated account pool logic to exclude banned and standby accounts from active usage.
- Implemented API endpoints for setting account roles and banning/unbanning accounts.
- Enhanced UI components to support role selection and display account statuses (banned, standby).
- Added localization strings for new features in English and Chinese.
- Updated runtime settings to include a backup release count for standby account promotions. Jun 7 01:41 Fix config.json permission denied on HF Spaces persistent storage luckfun233
On HuggingFace Spaces, the persistent /data volume may retain files owned by root or a different UID after container rebuilds, causing permission denied when ds2api tries to save config changes.
Two-layer fix:
- entrypoint.sh: always chown+chmod config files on startup, not just when creating them for the first time
- Go writeConfigBytes: atomic write (temp file + rename) with fallback that removes the old file and retries if permission denied Jun 6 12:26 Add GitHub Action to auto-sync to Hugging Face 204848
12:21 Initial commit: ds2api with HF Spaces support 204848