feat: add Novita AI provider#2086
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds Novita as a built-in cloud provider: provider metadata and endpoint, default model mappings, custom-routing model seeding and placeholders, provider UI/editor wiring for Novita, and tests for connect and routing flows. ChangesAI Settings Panel Refactor
Sequence DiagramsequenceDiagram
participant User
participant AIPanel
participant ProviderKeyDialog
participant CustomRoutingDialog
participant useAISettings
User->>AIPanel: Toggle "Connect Novita AI" chip
AIPanel->>ProviderKeyDialog: Open (novita-specific placeholder)
User->>ProviderKeyDialog: Enter API key + Save
ProviderKeyDialog->>useAISettings: setCloudProviderKey('novita', key)
User->>AIPanel: Open CustomRoutingDialog for workload
CustomRoutingDialog->>AIPanel: prefill model from BUILTIN_PROVIDER_DEFAULT_MODELS['novita']
User->>CustomRoutingDialog: Save routing draft
CustomRoutingDialog->>useAISettings: saveAISettings(draft with novita routing)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/components/settings/panels/__tests__/AIPanel.test.tsx`:
- Line 1: The test file is empty; add a test suite in AIPanel.test.tsx that
renders the AIPanel component and asserts Novita AI provider connection behavior
and routing defaults: create a describe("AIPanel") block with tests (it/ test)
that use render from `@testing-library/react` and any necessary provider/mocking
utilities (e.g., mock store or MockedProvider) to simulate the Novita AI
provider state, verify that the Novita-related UI elements (labels/buttons) and
connection flow (e.g., connect button triggers expected handler) are present and
behave, and assert routing defaults by checking that default route/link values
or navigation calls occur when no custom route is configured; reference AIPanel
and any handler props like onConnect/onSelectProvider or provider keys such as
"Novita" to locate where to attach mocks and assertions.
In `@app/src/components/settings/panels/AIPanel.tsx`:
- Line 1: Replace the corrupted file content (which currently only contains the
path string) with a full TypeScript React component implementation for AIPanel:
implement and export the AIPanel component (functional React component) that
renders the settings UI, handles form state and validation, and integrates the
Novita AI provider by importing and wiring its provider methods (e.g.,
NovitaProvider, initializeNovitaClient or similar helper names used elsewhere)
so that provider selection, API key/credentials input, test-connection and save
actions work; ensure you include props/state hooks, proper TypeScript types,
event handlers like onSave/onTestConnection, and export default AIPanel so the
settings panel compiles again.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f94a1fbc-2c18-4e76-bea2-d69c0bd310cf
📒 Files selected for processing (2)
app/src/components/settings/panels/AIPanel.tsxapp/src/components/settings/panels/__tests__/AIPanel.test.tsx
5960a19 to
5159cc0
Compare
Summary
Add Novita AI as a provider using the existing OpenAI-compatible provider path.
Changes
Verification
Summary by CodeRabbit