feat(aiconfig): added predefined ai models#781
feat(aiconfig): added predefined ai models#781hemantch01 wants to merge 6 commits intoaccordproject:mainfrom
Conversation
✅ Deploy Preview for ap-template-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
01f64f4 to
7eec485
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves the AI Configuration popup by introducing provider-aware, curated model selection (with a Custom fallback), reducing user error from manual model-name typing.
Changes:
- Added
PROVIDER_MODELS+getModelsForProviderto centralize curated model options per provider. - Updated
AIConfigPopupto use a provider-based model dropdown (with “Custom…” to reveal a text input) and to reset model state on provider change. - Added unit tests for
providerModelsand the model-selection UI behavior; updated several dependencies inpackage.json.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/AIConfigPopup.tsx | Replaces free-text model entry with provider-aware dropdown + custom model flow; resets model on provider change; restores custom models from localStorage. |
| src/ai-assistant/providerModels.ts | Introduces curated provider → model option lists and a helper accessor. |
| src/tests/components/AIConfigPopupModelSelect.test.tsx | Adds UI tests for provider/model selection behavior (dropdown, provider switch reset, custom option, openai-compatible text input). |
| src/tests/ai-assistant/providerModels.test.ts | Adds unit tests validating provider model lists and getModelsForProvider behavior. |
| package.json | Upgrades multiple dependencies (Accord Project packages + react-router-dom). |
src/components/AIConfigPopup.tsx
Outdated
| if (savedModel) setModel(savedModel); | ||
| if (savedModel) { | ||
| setModel(savedModel); | ||
| // checking if saved model is in the provider's lis — if not, it's custom |
There was a problem hiding this comment.
There’s a typo in the comment: “provider's lis” should be “provider's list”.
| // checking if saved model is in the provider's lis — if not, it's custom | |
| // checking if saved model is in the provider's list — if not, it's custom |
src/components/AIConfigPopup.tsx
Outdated
| {provider === 'ollama' && ( | ||
| <div className={`mt-1 text-xs ${theme.helpText}`}> | ||
| <span className="text-orange-500 font-bold"> | ||
| ⚠️ Must run: <code>OLLAMA_ORIGINS="*" ollama serve</code> | ||
| </span> | ||
| </div> |
There was a problem hiding this comment.
The PR description says the existing Ollama help text/warnings are unchanged, but this UI now only shows the serve command and no longer includes the example model list that was previously shown. Either restore the removed Ollama help text or update the PR description to match the new behavior.
| it('should show Custom option and text input when Custom is selected', () => { | ||
| render(<AIConfigPopup isOpen={true} onClose={mockOnClose} onSave={mockOnSave} />); | ||
|
|
||
| const providerSelect = screen.getByDisplayValue('Select a provider'); | ||
| fireEvent.change(providerSelect, { target: { value: 'openai' } }); | ||
|
|
||
| // Select "Custom..." | ||
| const modelSelect = screen.getByDisplayValue('Select a model'); | ||
| fireEvent.change(modelSelect, { target: { value: '__custom__' } }); | ||
|
|
||
| // Custom text input should appear | ||
| expect(screen.getByPlaceholderText('Enter custom model name')).toBeInTheDocument(); | ||
| }); |
There was a problem hiding this comment.
Tests cover switching providers and selecting “Custom…”, but there’s no test for the new behavior that restores a saved custom model from localStorage when it isn’t in the provider’s curated list. Add a test that seeds localStorage with provider + an unknown model value, renders the popup, and asserts the Custom input is shown and prefilled.
package.json
Outdated
| "@accordproject/concerto-core": "^3.25.7", | ||
| "@accordproject/markdown-common": "^0.17.2", | ||
| "@accordproject/markdown-template": "^0.17.2", | ||
| "@accordproject/markdown-transform": "^0.17.2", | ||
| "@accordproject/template-engine": "^2.7.1", |
There was a problem hiding this comment.
This PR description focuses on the model dropdown UX, but package.json also upgrades multiple core Accord Project dependencies. Please either add rationale/impact notes in the PR description (and any required follow-up changes) or split dependency upgrades into a separate PR to keep the review surface focused.
| "react-markdown": "^9.0.1", | ||
| "react-resizable-panels": "^3.0.3", | ||
| "react-router-dom": "^6.24.1", | ||
| "react-router-dom": "^6.30.2", |
There was a problem hiding this comment.
react-router-dom is also upgraded in this PR but isn’t mentioned in the PR description. Please document why this upgrade is needed here (or move it to a dedicated dependency update PR) since it can have runtime/router behavior changes.
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
66f0dd9 to
0e36c4b
Compare
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
2a102d9 to
a001b79
Compare
sanketshevkar
left a comment
There was a problem hiding this comment.
Can you please explore an open-source library that is well-maintained and is constantly updated with the model list.
I don't think we should maintain this list here in the project. Things are moving very fast, its hard to be on top of this and keep this updated.
|
hi @sanketshevkar there is no dedicated library for this..... but i have a approach, we can create a public repo (like ai-model-regitstry) and then create a json file, and then we can just fetch from the url like |
Closes #780
This PR improves the AI configuration UX by replacing the free-text model input with a provider-aware dropdown. It suggests popular models for each provider and includes a Custom option for manual entry when needed. This helps reduce errors caused by typos or incorrect model names.
Changes
PROVIDER_MODELSconstant with curated model lists for supported providers.AIConfigPopup.localStorageif the saved model is not in the provider list.providerModelsand the model selection behavior inAIConfigPopup.Flags
Screenshots or Video
Test Results
Related Issues
Author Checklist
--signoffoption