Skip to content

feat(aiconfig): added predefined ai models#781

Open
hemantch01 wants to merge 6 commits intoaccordproject:mainfrom
hemantch01:Enhancement/added_predefined_models
Open

feat(aiconfig): added predefined ai models#781
hemantch01 wants to merge 6 commits intoaccordproject:mainfrom
hemantch01:Enhancement/added_predefined_models

Conversation

@hemantch01
Copy link

@hemantch01 hemantch01 commented Mar 7, 2026

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

  • Added a PROVIDER_MODELS constant with curated model lists for supported providers.
  • Replaced the model text input with a provider-based dropdown in AIConfigPopup.
  • Added a Custom option that shows a manual input field when selected.
  • Reset the model selection when the provider changes.
  • Restored custom models from localStorage if the saved model is not in the provider list.
  • Added unit tests for providerModels and the model selection behavior in AIConfigPopup.

Flags

  • For OpenAI-compatible APIs, the model field remains a text input because models can be user-defined.
  • Existing Ollama help text and warnings remain unchanged.

Screenshots or Video

image

Test Results

Screenshot 2026-03-07 155143

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option
  • Vital features and changes captured in unit and/or integration tests
  • Commit messages follow AP format
  • Extend the documentation, if necessary

@hemantch01 hemantch01 requested a review from a team as a code owner March 7, 2026 11:10
@netlify
Copy link

netlify bot commented Mar 7, 2026

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit a001b79
🔍 Latest deploy log https://app.netlify.com/projects/ap-template-playground/deploys/69ada6ce142cf20008d89566
😎 Deploy Preview https://deploy-preview-781--ap-template-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hemantch01 hemantch01 force-pushed the Enhancement/added_predefined_models branch from 01f64f4 to 7eec485 Compare March 7, 2026 11:18
@mttrbrts mttrbrts requested a review from Copilot March 7, 2026 17:47
@mttrbrts mttrbrts changed the title Enhancement/added predefined models feat(aiconfig): added predefined ai models Mar 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + getModelsForProvider to centralize curated model options per provider.
  • Updated AIConfigPopup to 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 providerModels and the model-selection UI behavior; updated several dependencies in package.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).

if (savedModel) setModel(savedModel);
if (savedModel) {
setModel(savedModel);
// checking if saved model is in the provider's lis — if not, it's custom
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a typo in the comment: “provider's lis” should be “provider's list”.

Suggested change
// 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

Copilot uses AI. Check for mistakes.
Comment on lines 268 to 273
{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>
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +88
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();
});
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot generated this review using guidance from repository custom instructions.
package.json Outdated
Comment on lines +21 to +25
"@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",
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
"react-markdown": "^9.0.1",
"react-resizable-panels": "^3.0.3",
"react-router-dom": "^6.24.1",
"react-router-dom": "^6.30.2",
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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>
@hemantch01 hemantch01 force-pushed the Enhancement/added_predefined_models branch from 66f0dd9 to 0e36c4b Compare March 8, 2026 16:22
Signed-off-by: hemantch01 <hemantchaudhary905@gmail.com>
@hemantch01 hemantch01 force-pushed the Enhancement/added_predefined_models branch from 2a102d9 to a001b79 Compare March 8, 2026 16:41
Copy link
Member

@sanketshevkar sanketshevkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hemantch01
Copy link
Author

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 https://raw.githubusercontent.com/username/ai-model-registry/*.json Or should i look for any other library??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancements: Add Predefined models in ai-chat Instead of Input Box

3 participants