Skip to content

refactor: comprehensive chatbar and agent model resolution overhaul#1060

Merged
FlorentRvl merged 3 commits into
mainfrom
refactor-chatbar
Jul 7, 2026
Merged

refactor: comprehensive chatbar and agent model resolution overhaul#1060
FlorentRvl merged 3 commits into
mainfrom
refactor-chatbar

Conversation

@FlorentRvl

Copy link
Copy Markdown
Contributor

This pull request resolves #refactor-chatbar

Summary

This PR introduces a comprehensive refactor and enhancement of the chatbar and agent model resolution system across the backend and frontend.

Key Changes

Backend

  • Added properties default_chat_model_id and default_embedding_model_id to the IModelRegistry interface and implemented them in ModelRegistryService to expose configured default model canonical IDs without building live models.
  • Enhanced the OpenRouter agent to declare a canonical model ID (MODEL_ID) and provide a class method get_chat_model_id for consistent model resolution.
  • Added utility functions in the primary FastAPI agent adapter to resolve the effective model ID an agent runs with, prioritizing explicit assignment, class-declared model, marketplace catalog, and engine default.
  • Improved the secondary Postgres agent adapter to handle legacy stringified NULL values ("None"/"null") gracefully when converting database models to records.
  • Extended the AgentRecord dataclass to include a non-persisted resolved_model_id field representing the effective model resolved by the backend.

Frontend

  • Added a new Zustand store models to cache and manage the model catalog fetched from the backend.
  • Updated the agents store to include the backend-resolved resolvedModelId and clean legacy model ID values.
  • Refactored the agents settings page to fetch models and display human-readable model names instead of raw IDs, resolving the effective model ID with fallback logic.
  • Refactored the AgentSelector component to support a compact mode and improved UI for model display.
  • Added a new ModelSelector component that shows the resolved model used by the currently selected agent in a dropdown pill UI.
  • Updated the ChatInterface to move the agent selector into the chatbar and add the new model selector next to it.

Ontology Model Cleanup

  • Removed deprecated and unused ontology properties from File, Document, Processor, and Chunk classes.
  • Set default values for created and creator fields using current datetime and environment user.

Impact

  • Agents now have a clear and consistent way to resolve and display the model they run with.
  • UI shows friendly model names from the catalog, improving user experience.
  • Legacy data issues with model IDs are handled gracefully.
  • The chatbar UI is cleaner and more informative with model context.

Testing

  • Backend unit tests should cover the new model resolution logic.
  • Frontend components should be tested for correct model display and interaction.
  • Manual testing of agent selection and model display in chat UI.

This refactor lays the groundwork for better model management and user experience in the chat interface and agent system.

- Refactor agent selector component to support compact mode and improve UI
- Move agent selector dropdown to chatbar for better UX
- Update ontology models to remove deprecated properties and set default values for created and creator fields
- Bump versions of naas-abi-core and naas-abi-marketplace packages
- Update lockfiles accordingly
- Add properties for default chat and embedding model IDs in model registry interfaces and services.
- Introduce MODEL_ID and get_chat_model_id for OpenRouterAgent and dynamically built OpenRouter agents.
- Implement model resolution logic in API adapters to determine effective model IDs.
- Enhance frontend to display resolved model names using a new models store and ModelSelector component.
- Clean up legacy model ID stringification and add caching for model catalog fetches.

This improves model ID handling and display consistency across the system.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploying abi-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8f7ca1b
Status: ✅  Deploy successful!
Preview URL: https://ffcb428f.abi-docs-76c.pages.dev
Branch Preview URL: https://refactor-chatbar.abi-docs-76c.pages.dev

View logs

@gitguardian

gitguardian Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
34375004 Triggered Generic Password 8f7ca1b coder_prototype/scripts/bootstrap.sh View secret
34438430 Triggered Generic Password 8f7ca1b libs/naas-abi-cli/naas_abi_cli/cli/deploy/local_test.py View secret
34214123 Triggered Generic Password 8f7ca1b coder_prototype/docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@FlorentRvl FlorentRvl merged commit aadd24a into main Jul 7, 2026
5 checks passed
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.

1 participant