fix: guard flattenProviders against non-array p.models

Some OpenCode Serve /config/providers responses include providers
without a 'models' field (or with a non-array value). The un-guarded
for-of on p.models then throws 'p.models is not iterable' and crashes
the inline prompt construction. Skip such providers instead.

Also re-assert the button label as 'AI' (matches the df2f3df label
simplification, which the 02cedac revert had bundled away).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
tao.chen
2026-07-23 17:58:29 +08:00
co-authored by Claude Fable 5
parent 02cedac138
commit f7099be060
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -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', () => {