[BUG] ark-plan-api 不能正确添加提供商,也无法通过base url获取模型列表

Aperta
#31 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, node.js
Ambito
backend

Direzione di ricerca

Start with the dsh-plugins/ark-plan-api package, especially its cordis.patch.yml and README, then inspect how the plugin’s provider configuration interacts with user patches and how model discovery builds /models requests. Reproduce both reports: a user llm-pi-ai provider patch hides the plugin routes, and the Agent Plan URLs return 404 for model listing while inference works. Done means the provider routes remain available with user configuration and the README explains that these endpoints do not support listing models.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

  • 仓库:volcengine/ark-cli
  • 组件:dsh-plugins/ark-plan-api(npm:@volcengine/[email protected],当前 registry latest)
  • 建议标签:bug

TL;DR

  1. 插件通过给 llm-pi-ai 写一条 行补丁 来注入 5 条 Ark 路由。但 DSH 的行补丁语义是 config 整体替换、不做深合并,而用户自己的 cordis.patch.yml 永远最后应用。只要 profile 里已经有一条 - id: llm-pi-ai(任何自定义过 provider 的用户都会有),插件的 providers 就会被整段覆盖 —— 安装成功、bundle 显示 ok,但模型页里一条 Ark 路由都不出现,也没有任何警告。
  2. 即使按 README 手动添加,两个 base URL 也 无法“获取模型列表”:Agent Plan 的推理路由根本没有 /models 端点(实测 404),而 DSH 的模型发现固定请求 {baseURL}/models 或 {root}/v1/models。模型清单在方舟侧只能通过管理面(arkcli plans model-list)拿到。

环境

项 值
DSH 0.2.1-rc.3(桌面版,desktop profile)
dshmarket 1.70.1
OS Windows 11 x64
Node v24.21.0
@volcengine/ark-plan-api 0.1.0

问题一:安装后「设置 → 模型」里没有任何 Ark 提供商

期望

README 写的是:安装后 Ark Agent Plan / Coding Plan / 后付费模型 直接出现在 DSH 的模型选择器里,用户只需要贴 API Key。

实际
  • package.json 的 dsh.profile.bundles 里确实有 @volcengine/ark-plan-api,市场也显示 bundle ok;
  • 但「设置 → 模型」里没有 ark-agent-plan-cn / ark-coding-plan-cn / ark-coding-plan-byteplus / ark-cn / ark-byteplus 这 5 条路由中的任何一条;
  • 重启无效,日志里也没有任何相关警告。
根因:DSH 的 patch 是「整体替换 config」,用户层最后应用

DSH 的补丁合成语义(dsh-app-boot):

for (const [key, value] of Object.entries(overrides)) {
    if (key === "id") continue;
    target[key] = value;          // config 整体替换,不是深合并
}

官方文档字符串也明确写了:

Other patches replace supplied fields; config is replaced wholesale, not deep-merged.

A patch config replaces the whole config.

应用顺序是:bundle 层(按 dsh.profile.bundles 顺序)→ 用户 cordis.patch.yml → launcher 层。

插件的 cordis.patch.yml 里这样写:

- id: llm-pi-ai
  config:
    providers:
      ark-agent-plan-cn: ...
      ark-coding-plan-cn: ...
      # …共 5 条

而它的注释把安全性建立在这个假设上:

A row patch replaces the whole configof the targeted row; dsh-base mountsllm-pi-aiwith no config, so restating onlyproviders here is safe.

这个假设只在 profile 里没有别的层配置过 llm-pi-ai 时成立。 而用户层永远排在 bundle 层之后,所以只要用户已经写过:

- id: llm-pi-ai
  name: "@deepseek-ai/dsh-llm-pi-ai"
  config:
    providers:
      <自己的 provider>: ...

那么最终合成结果里的 llm-pi-ai.config.providers 就是用户那一段,插件的 5 条路由被整段丢弃 —— 静默失败。

这不是个别场景:llm-pi-ai 默认是空配置挂载,用户只要想用任何自定义 provider(自建网关、第三方协议、公司内网模型),就必然要在用户补丁层写这一行。也就是说,对最需要这个插件的用户群,插件默认完全无效。

复现步骤
  1. 任意 profile,在 ~/.dsh/profiles/<name>/cordis.patch.yml 里保留一条带 providers 的 - id: llm-pi-ai(哪怕只有一个 provider)。
  2. 安装插件:
    npx -y @deepseek-ai/dsh plugin --profile desktop add @volcengine/ark-plan-api
    
  3. 重启 DSH,打开「设置 → 模型」。
  4. 结果:只有用户自己声明的 provider,插件的 5 条 ark-* 路由全部缺失;无报错、无警告。

(把用户补丁层里的 llm-pi-ai 行整段删掉后,5 条路由才会出现。这也解释了为什么有人能正常看到、有人完全看不到。)


问题二:按 README 手动添加时,两个协议的 base URL 都「获取模型列表」失败

复现时使用的是文档给出的两个 base URL:

  • Anthropic 兼容:https://ark.cn-beijing.volces.com/api/plan
  • OpenAI 兼容:https://ark.cn-beijing.volces.com/api/plan/v3

DSH 侧「获取模型列表」的请求 URL 构造规则(dsh-llm-pi-ai):

function listingUrl(baseURL, api) {
    const base = baseURL.replace(/\/+$/, "");
    if (api !== "anthropic-messages") return `${base}/models`;
    return `${base.endsWith("/v1") ? base.slice(0, -3) : base}/v1/models?limit=${String(ANTHROPIC_MODEL_LIMIT)}`;
}

即:

  • OpenAI 协议 → GET https://ark.cn-beijing.volces.com/api/plan/v3/models
  • Anthropic 协议 → GET https://ark.cn-beijing.volces.com/api/plan/v1/models?limit=1000

实测(有效 Agent Plan Key):

请求 结果
GET /api/plan/v3/models(Authorization: Bearer) 404(空响应体)
GET /api/plan/v1/models?limit=1000(Authorization: Bearer) 404(空响应体)
POST /api/plan/v1/messages(x-api-key 或 Authorization: Bearer) 200(正常返回 type=message)
POST /api/plan/v3/responses(Authorization: Bearer) 200(正常返回 object=response)

后两行是对照组:同一把 Key、同一批路由,推理接口完全正常,说明 Key 与鉴权都没问题;只有 /models 列表端点在 Agent Plan 路由上不存在。

所以:

  • 「获取模型列表」失败不是用户的 Key 或网络问题,也不是前缀拼错;
  • Agent Plan 的推理 base URL 不提供模型清单能力;方舟侧查询 Plan 可用模型的入口是管理命令 arkcli plans model-list --plan agent-plan,与推理 base URL 不是同一个面;
  • 插件 README 却只写「贴 Key 即可,无需额外配置」,没有提示「这两个 base URL 不支持拉取列表,必须手填模型或从 plans model-list 导入」。

补充:用 Anthropic 协议、x-api-key 去请求 /api/plan/v1/models 会得到 401 AuthenticationError,而同一个 Key 请求 /api/plan/v1/messages 是 200 —— 这个 401 具有误导性,会让人以为 Key 无效或协议选错,实际原因是该路径不存在。建议至少在文档里点明。

Lingua principale
jq
Stelle
147
Fork
18
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di volcengine/ark-cli

Tutte le issue di volcengine/ark-cli

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.