mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-18 16:01:38 +00:00
fix(opencode): list current Zen models in offline discovery (#103197)
* fix(opencode): refresh Zen model catalog * fix(opencode): expose static catalog fallback
This commit is contained in:
committed by
GitHub
parent
10b50843e7
commit
25e93ef9f9
@@ -71,12 +71,15 @@ async function fetchOpencodeZenModelIds(): Promise<string[]> {
|
||||
});
|
||||
expect(response.ok).toBe(true);
|
||||
const json = (await response.json()) as OpencodeModelsResponse;
|
||||
return (json.data ?? [])
|
||||
expect(Array.isArray(json.data)).toBe(true);
|
||||
const modelIds = (json.data ?? [])
|
||||
.filter((model) => model.object === undefined || model.object === "model")
|
||||
.map((model) => model.id)
|
||||
.filter((id): id is string => typeof id === "string" && id.trim().length > 0)
|
||||
.map((id) => id.trim().toLowerCase())
|
||||
.toSorted();
|
||||
expect(new Set(modelIds).size).toBe(modelIds.length);
|
||||
return modelIds;
|
||||
}
|
||||
|
||||
function listStaticOpencodeZenModelIds(): string[] {
|
||||
@@ -89,6 +92,7 @@ describeCatalogLive("opencode Zen live catalog drift", () => {
|
||||
it("keeps the provider-owned static seed aligned with the live model ids", async () => {
|
||||
const liveIds = await fetchOpencodeZenModelIds();
|
||||
const staticIds = listStaticOpencodeZenModelIds();
|
||||
expect(new Set(staticIds).size).toBe(staticIds.length);
|
||||
|
||||
const staticIdSet = new Set(staticIds);
|
||||
const liveIdSet = new Set(liveIds);
|
||||
|
||||
Reference in New Issue
Block a user