fix(grokbuild): point session_summary at the active provider and keep a link's model profile

Session titles: when `models.session_summary` is unset, Grok Build
(verified on 1.0.50) generates titles with the built-in `grok-4.6`
model but sends the request to the default model table's endpoint, so
third-party upstreams reject it and title generation fails. Switching
never wrote this key, so fixing the row templates alone would not
reach live. The Grok switch patch now makes session_summary follow the
provider when it is unset or names a table CC Switch wrote (the
target, the write record, or a table retired in this switch): it points
at the target table, or is removed when switching to the official
account. A user's own choice (a built-in model or their own table) is
left alone.

Deep links: a Grok Build link carrying a config.toml no longer gets
rebuilt into a fixed template that dropped the profile's display name,
description, API backend and context window. The table named by
`[models] default` is kept through an allowlist of Grok 1.0.50 profile
fields; the endpoint, key and model come from the link parameters.
Links whose table uses auth_provider, env_http_headers or
mtls_cert_dir are rejected, and env_key is still dropped. Only one
model table is imported, since a provider owns one table in live.
Links without a config keep the old template byte for byte.

Fixes #7003
Refs #6457
This commit is contained in:
Jason committed 2026-10-12 23:26:43 +08:00
1 parent c63c702c70
commit db93ac2083
16 files changed
+547 -33

No files matched your search

@@ -67,6 +67,8 @@ ccswitch://v1/import?resource={type}&app={app}&name={name}&...
| `usageUserId` | No | Usage query user ID |
| `usageAutoInterval` | No | Auto query interval (minutes) |
For Grok Build, `config` likewise takes `{"config": "<config.toml text>"}` or the whole config.toml with `configFormat=toml`. Only the `[model."<name>"]` table named by `[models] default` is imported (display name, `description`, `api_backend`, `context_window`, sampling and retry settings, etc.); the endpoint and key always come from the link parameters, and other model tables are skipped. Links whose table uses `auth_provider`, `env_http_headers` or `mtls_cert_dir` are rejected, and `env_key` is ignored.
**Prompt parameters** (resource=prompt):
| Parameter | Required | Description |
@@ -67,6 +67,8 @@ ccswitch://v1/import?resource={type}&app={app}&name={name}&...
| `usageUserId` | いいえ | 使用量クエリユーザー ID |
| `usageAutoInterval` | いいえ | 自動クエリ間隔(分) |
Grok Build の `config` も `{"config": "<config.toml のテキスト>"}` の形式、または `configFormat=toml` で config.toml 全体を渡せます。`[models] default` が指す `[model."<名前>"]` テーブル(表示名、`description`、`api_backend`、`context_window`、サンプリング・リトライ設定など)のみをインポートし、エンドポイントとキーは常にリンクのパラメーターを使用します。他のモデルテーブルはインポートされません。テーブルに `auth_provider`、`env_http_headers`、`mtls_cert_dir` を含むリンクは拒否され、`env_key` は無視されます。
**プロンプトパラメータ**(resource=prompt):
| パラメータ | 必須 | 説明 |
@@ -67,6 +67,8 @@ ccswitch://v1/import?resource={type}&app={app}&name={name}&...
| `usageUserId` | 否 | 用量查询用户 ID |
| `usageAutoInterval` | 否 | 自动查询间隔(分钟) |
Grok Build 的 `config` 同样可写成 `{"config": "<config.toml 文本>"}` 或用 `configFormat=toml` 给整份:只导入 `[models] default` 指向的那张 `[model."<名称>"]` 表(显示名、`description`、`api_backend`、`context_window`、采样和重试参数等),地址和 Key 一律用链接参数,其他模型表不导入;表里带 `auth_provider`、`env_http_headers`、`mtls_cert_dir` 的链接会被拒绝,`env_key` 会被忽略。
**提示词参数**(resource=prompt):
| 参数 | 必填 | 说明 |