diff --git a/src/__tests__/opencode_cell_actions.spec.ts b/src/__tests__/opencode_cell_actions.spec.ts index 0ea462d..1eca44e 100644 --- a/src/__tests__/opencode_cell_actions.spec.ts +++ b/src/__tests__/opencode_cell_actions.spec.ts @@ -127,7 +127,7 @@ describe('OpenCodeCellActions', () => { const actions = new OpenCodeCellActions(cell); const btns = actions.node.querySelectorAll('button'); expect(btns.length).toBe(1); - expect(btns[0].textContent).toContain('🪄'); + expect(btns[0].textContent).toContain('AI'); }); it('disables the button when notebook panel cannot be resolved', () => { diff --git a/src/components/opencode_inline_prompt.ts b/src/components/opencode_inline_prompt.ts index 88f8c08..4e4aed7 100644 --- a/src/components/opencode_inline_prompt.ts +++ b/src/components/opencode_inline_prompt.ts @@ -114,6 +114,12 @@ function flattenProviders( } const out: { providerId: string; modelId: string }[] = []; for (const p of providers.providers) { + // Some OpenCode Serve responses include providers without a `models` + // field (or with a non-array value). Guard to avoid the "p.models is + // not iterable" crash and simply skip such providers in the picker. + if (!Array.isArray(p.models)) { + continue; + } for (const m of p.models) { out.push({ providerId: p.id, modelId: m.id }); }