Skip to content

feat(chat): 将 ThinkWatch Lite 加入聊天预设默认列表 - #7754

Open
fylorn wants to merge 1 commit into
QuantumNous:mainfrom
fylorn:feat/thinkwatch-lite-chat-preset
Open

fylorn wants to merge 1 commit into
QuantumNous:mainfrom
fylorn:feat/thinkwatch-lite-chat-preset

Conversation

@fylorn

@fylorn fylorn commented Oct 11, 2026 •

Copy link
Copy Markdown

Agent

  • Tool: Claude Code
  • Tool version: Claude Code
  • Model (full id): claude-opus-5-5
  • Host (CLI / IDE / GitHub coding agent / other): other
  • Date (UTC): 2026-10-12

Links

User request

  • Verbatim: 不公开。请求内容:将 ThinkWatch Lite 加入默认聊天预设,使 New API 站点的用户可以一键把站点地址和令牌导入 ThinkWatch Lite。
  • Later constraints or corrections from the user (quote, or none): 只做静态修改。

Out of scope — refuse

  • Matched: no。ThinkWatch Lite 是在用户本机运行的开源桌面客户端,不是托管站、中转站或 API 服务;不涉及渠道、透传或 Codex。
  • If yes, what was told to the user (stop here; do not open a PR): 不适用

Open gate — do not open unless all are satisfied

  • Out of scope (including pass-through-only forwarding): no
  • Usage / configuration / integration (answered instead of opening): no。站长现在可以手动添加;本 PR 把它加入默认列表。
  • Required issue facts present without invention: yes
  • Verification is actual commands or steps and observed results, not only go build or tests passed: partly。new-api 一侧按代码推导生成的链接,未在本地运行(见下);ThinkWatch Lite 一侧对这条链接的解析有实际测试。
  • Body is short and factual; no unfiltered AI-generated text: yes
  • Open: yes
  • If no, what was told to the user (stop here): 不适用

Kind

  • Bug fix
  • New feature
  • Performance / refactor
  • Docs
  • Other:

Issue facts

  • Actual behavior: 默认聊天预设中没有 ThinkWatch Lite,未自定义聊天预设的站点无法从令牌的「聊天」菜单一键导入 ThinkWatch Lite。
  • Impact: 用户手动填写地址和密钥,容易把 /v1 写进地址;站长要自己查到正确的模板才能添加。
  • Frequency: 所有未保存过聊天预设的部署。
  • Evidence that the problem is in new-api rather than the client or upstream: ThinkWatch Lite 2026.10.16 起支持 thinkwatch://import?service=newapi&url=…&key=…;缺少的只是默认条目。
  • Applicable types and their fields (relay / billing / frontend / deployment; write "not applicable" otherwise): frontend(聊天预设);relay / billing / deployment not applicable

Change

默认 Chats 在 AQBot 后增加 ThinkWatch Lite,模板为 thinkwatch://import?service=newapi&url={address}&key={key}。resolveChatUrl 已处理这两个占位符:{address} 替换为 encodeURIComponent 后的服务器地址(站点根地址,不带 /v1,ThinkWatch Lite 自行拼接路径),{key} 替换为补全 sk- 前缀的密钥。令牌行操作先取这把令牌的真实密钥;侧栏聊天入口由 chatLinkRequiresApiKey 识别 {key},先取启用中的密钥。两处都走 resolveChatUrl,不需要改前端。已保存过聊天预设的站点不受影响。

service=newapi 时,ThinkWatch Lite 用这把密钥读取 /v1/dashboard/billing/subscription 与 /v1/dashboard/billing/usage(并从公开的 /api/status 取额度显示单位),在上游旁显示额度与用量。

Research

Duplicate / prior art

Docs and code

  • https://docs.newapi.ai/ : 「AI 应用」有各客户端页面;AQBot 页面说明在聊天设置中添加条目、从令牌操作打开。没有 ThinkWatch Lite。
  • https://deepwiki.com/QuantumNous/new-api : 打开时返回 HTTP 429,未读到。
  • README / repo docs: 无聊天预设说明。
  • Code paths and what they imply for this change: setting/chat.go(默认列表);model/option.go(默认值初始化 Chats,保存过的优先);controller/misc.go(/api/status 返回 chats);web/src/features/chat/lib/chat-links.ts(占位符替换)。只需改默认列表。

Alternatives considered

  • Option A: 使用现有的 {address}、{key}。
  • Option B: 新增 {thinkwatchConfig} 专用占位符,在 chat-links.ts 中编码整段参数。
  • Why this approach: new-api 的令牌是 sk- 加字母数字,不编码也不会破坏查询串;ThinkWatch Lite 接受的密钥字符为 A-Za-z0-9 与 - _ . ~ + / = :。A 不改前端,站长也能直接看懂和修改这条模板。

Files

Path Why
setting/chat.go 默认聊天预设增加 ThinkWatch Lite

Behavior

  • Before: 默认列表没有 ThinkWatch Lite。
  • After: 未保存过聊天预设的站点在 AQBot 之后显示 ThinkWatch Lite;点击打开 thinkwatch://import?service=newapi&url=<编码后的站点地址>&key=sk-…,ThinkWatch Lite 打开「新建上游」对话框并预填,用户确认后才保存。
  • Explicit non-goals / leftover work: 不修改已保存的聊天预设;不新增占位符;不改 docs.newapi.ai。

Verification

改动通过阅读代码核对,未在本地运行 new-api;go vet、go build、make test 以及前端的 typecheck 与 test 由本仓库 CI 运行。

  • Commands and results: gofmt -l setting/chat.go 无输出(格式正确)。
  • Manual steps and observed result: 按 resolveChatUrl 的逻辑推导:服务器地址 https://api.example.com、密钥 abc123XYZ 生成 thinkwatch://import?service=newapi&url=https%3A%2F%2Fapi.example.com&key=sk-abc123XYZ。ThinkWatch Lite 用测试 a_new_api_chat_preset_link_is_accepted 解析这条链接(以及带端口、子路径的站点地址),结果为服务类型 New API、地址 https://api.example.com、密钥 sk-abc123XYZ,在 ThinkWatch Lite 的 CI 中通过(Import links: tests for the links New API and Sub2API generate ThinkWatchProject/ThinkWatch-Lite#323)。ThinkWatch Lite 2026.10.16 已发布。
  • UI: screenshot or recording (or why none): 无。未在本地运行 new-api,未在浏览器中点击该条目。
  • Tests added or updated, or why none: 无。默认列表目前没有测试;本改动只是数据。
  • Databases / providers / platforms exercised: 无
  • Not verified: 未在本地运行;未在浏览器中点击过该条目。

Risks

  • Failure modes: 已保存过聊天预设的站点看不到这一项(与 DeepChat、AQBot 相同)。服务器地址若是公网 http://,ThinkWatch Lite 会拒绝该链接。ThinkWatch Lite 早于 2026.10.16 的版本会忽略这类链接。令牌行在取真实密钥后再打开链接,可能被弹窗拦截(fix(keys): open chat preset links inside the click gesture #5395),这对所有自定义协议条目相同。
  • Billing / quota / auth impact: 无。密钥只经系统的 URL 协议交给本机应用,与其他客户端条目相同;不改计费和鉴权。
  • Follow-ups: 如需要,可在 docs.newapi.ai 的「AI 应用」中补一页。

Scope check

  • Single focused change: yes
  • Secrets included: no
  • Out of scope (Coding Plan / reverse-engineered channel / third-party wrapper / Codex / pass-through-only forwarding): no

Summary by CodeRabbit

  • New Features
    • Added ThinkWatch Lite as a chat configuration option.

默认 Chats 在 AQBot 后增加 ThinkWatch Lite,模板为
thinkwatch://import?service=newapi&url={address}&key={key}。
{address} 由 resolveChatUrl 编码为站点根地址(不带 /v1),{key} 补全 sk- 前缀。
已保存过 Chats 的站点不受影响。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: db4b9fce-a4b4-47e7-b8c3-066ce235bbec





📥 Commits

Reviewing files that changed from the base of the PR and between 42e694e and 3d6735a.






📒 Files selected for processing (1)
  • setting/chat.go





Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.







Walkthrough

The default chat preset list adds ThinkWatch Lite with a thinkwatch://import URL that uses the {address} and {key} parameters.

Changes

Chat preset

Layer / File(s) Summary
Add ThinkWatch Lite preset
setting/chat.go
The Chats list adds a ThinkWatch Lite import URL with service=newapi, {address}, and {key} parameters.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Feature · Severity of issue fixed: Low

Suggested reviewers: calcium-ion

Merge Risk: ⚪ Minimal · up to 3d673

The new preset uses the configured server address and active key to form its import link, with no identified merge-blocking risk.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check Passed Issue #7753 is closed. It provides historical context only. No active directly linked issue remains, so no linked-issue coding requirements apply. The PR summary identifies the intended change as the …
Out of Scope Changes check Passed The reviewed change adds only the ThinkWatch Lite entry to setting/chat.go. This change matches the stated PR scope and the historical issue scope. No unrelated code or excluded-file change is shown…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: adding ThinkWatch Lite to the default chat preset list.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR









  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the preset list,
A new import link joins the queue.
It carries address, key, and service,
Three fields arranged for ThinkWatch Lite.
One hop, then carrots all around.

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

将 ThinkWatch Lite 加入聊天预设默认列表

1 participant