Files
zeyu.fz a6291e00e1 docs(knowledge): 强制添加知识库描述参数
- 升级知识库创建命令,`--description` 参数变为必填,描述知识库内容和用途
- 更新所有相关文档示例,统一加入 `--description` 参数和示例文本
- CLI 校验增强,缺失或超长的描述参数本地报错,避免服务端拒绝
- 优化服务创建命令,推荐填写描述以帮助 agent 选择合适服务
- 多个测试用例添加对描述参数的验证和断言
- 知识库和集合列表中描述信息作为区分同类项目的辅助信息显式展示
- 其他细节调整包括命令帮助及参数说明内容的更新
2026-08-22 11:21:22 +08:00

37 lines
1.9 KiB
TypeScript

// Model values verified against the live API, shared by the knowledge e2e cases so a
// server-side model rotation only needs one edit here.
//
// Deliberately test-only: the command layer must NOT mirror these lists into local
// validation. Model catalogs churn with server-side launches/deprecations, so a
// hardcoded allowlist in the CLI would block valid models until users upgrade.
/**
* Accepted values for `agent_config.agent_model` (service create/update).
* Everything else — including qwen-plus, qwen-max, qwen3-max, qwen3.7-flash,
* qwen3.7-max and deepseek-v3 — is rejected with
* HTTP 401 InvalidParameter "agent model not allowed: <name>".
* The first entry is also the server-side default for a freshly created service.
*/
export const VERIFIED_AGENT_MODELS = ["qwen3.6-plus", "qwen3.7-plus"] as const;
/**
* Accepted value for `rerank[].model_name` on index/retrieve.
* Gotcha: the server only branches on the `-hybrid` suffix — the model prefix is
* ignored (`qwen3-rerank` and `gte-rerank` score identically to omitting the field,
* `qwen3-rerank-hybrid` and `gte-rerank-hybrid` score identically to each other), so
* the effective scoring model is the index's own `rerankModelName`. Unknown names and
* indexes without `rerankModelName` both fail with
* HTTP 500 Index.IndexRerankError "index rerank config(<name>) error.".
*/
export const VERIFIED_RERANK_MODEL = "qwen3-rerank-hybrid";
/**
* Pick a verified model that differs from the current one, so a write → read-back
* assertion proves the value actually changed instead of re-writing the default.
* Returns undefined when the allowlist has shrunk to the model already in use — the
* caller must then skip the model assertion instead of asserting a no-op.
*/
export function pickDifferentAgentModel(currentModel: string | undefined): string | undefined {
return VERIFIED_AGENT_MODELS.find((model) => model !== currentModel);
}