Repository navigation
fix: 把 magpie 的模型 id 换回上游原值,否则国际站全部 403(0.2.39) - #4
Merged
Merged
Conversation
真机:国际站 2 条模型全部 403 Forbidden。直连上游实测同一份凭据、同一个模型:
monkeycode-basic/deepseek-flash -> 200
monkeycode-basic-deepseek-flash slug -> 403 Forbidden
UUID / 裸名 deepseek-flash -> 403 Forbidden
根因在 magpie:它用 `api: { id: m.id ?? was?.api.id ?? key }` —— 我们返回的 `id`
(斜杠压成连字符),config 里的 `api.id` 被无视。而模型 id 又不能带斜杠(会被当
provider 边界)。所以只能在 loader.fetch 里换回来:读目录缓存的 id -> apiId 映射,
改请求体的 model,再补 system、再算签名。
- 新增 tests/loader-model-map.test.mjs 锁住改写 + 幂等 + 未知 model 放行 + 签名
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象
国际站 2 条模型全部 403 Forbidden。
取证(直连上游,同一份凭据)
monkeycode-basic/deepseek-flashmonkeycode-basic-deepseek-flash(slug)<uuid>deepseek-flash(裸名)根因
magpie 构造上游请求时用的是:
—— 它拿我们返回的
id(斜杠被压成连字符),config 里给的api.id被无视。而模型 id 又不能带斜杠:magpie 会把
<a>/<b>读成 provider 边界,长出monkeycode-basic/monkeycode-pro/monkeycode-ultra三个不存在的供应商。修法
在自己的
loader.fetch里换回来:读目录缓存拿id → apiId,把请求体里的model从 magpie 的 id 换回平台原值,再补 system、再按最终 body 算签名。测试(新增 4 条)