Commit f2bdcb6
feat(moonshot): implement provider with model picker, API fetching, streaming, and model metadata (#857)
* fix(moonshot): fix provider issues with model picker, refresh, and streaming
- Fix duplicate ModelPicker by adding moonshot to PROVIDERS_WITH_CUSTOM_MODEL_UI
- Fix HTTP 404 on Refresh Models by preserving /v1 in fetcher URL
- Fix empty model list (consequence of 404 fix)
- Fix 'No output generated' error by switching MoonshotHandler from
OpenAICompatibleHandler (Vercel AI SDK) to OpenAiHandler (OpenAI Node SDK)
which is what Moonshot's own API docs recommend
- Add dedicated Moonshot fetcher with proper model ID prefixing
- Update tests to match new handler implementation
All 6,660 backend and 1,432 webview-ui tests pass.
* feat(moonshot): add missing models with correct pricing from official docs
Add kimi-k2.7-code, kimi-k2.7-code-highspeed, and kimi-k2.6 to static
models map with accurate pricing from Moonshot documentation.
Also fix kimi-k2.5 to correctly mark supportsImages: true.
* Update webview-ui/src/components/settings/providers/Moonshot.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* fix(moonshot): remove fallback pricing for unknown models to match handler behavior
* Bump coverage
* fix(moonshot): address PR review feedback — add tests and fix inline import type
- Replace inline import() type with top-level OpenAI.Chat.Completions.X in moonshot.ts
- Add useSelectedModel moonshot tests (default model, router override, unknown fallback, getValidatedModelId)
- Add modelCache moonshot dispatch test for fetchModelsFromProvider switch
- Create Moonshot.spec.tsx with state machine tests (idle/loading/success/error states, race condition guard)
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>1 parent b132a6b commit f2bdcb6
19 files changed
Lines changed: 1365 additions & 231 deletions
File tree
- packages/types/src
- providers
- src
- api/providers
- __tests__
- fetchers
- __tests__
- core/webview
- __tests__
- webview-ui/src
- components
- settings
- providers
- __tests__
- utils
- ui/hooks
- __tests__
- utils/__tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
68 | 104 | | |
69 | 105 | | |
70 | 106 | | |
| |||
0 commit comments