Skip to content

Improved model managment#286

Merged
zilaei merged 27 commits into
masterfrom
feat/user-friendly-model-info
Sep 12, 2025
Merged

Improved model managment#286
zilaei merged 27 commits into
masterfrom
feat/user-friendly-model-info

Conversation

@zilaei

@zilaei zilaei commented Sep 4, 2025

Copy link
Copy Markdown
Member

This PR adds model managment to settings. This PR also improves the UI in the zoo edit page, for displaying available models when creating new assistants.

Settings:
image

Zoo:
image

Features

  • New backend service for models
  • Model settings UI
  • Improved model selection UI in the zoo
  • Future proofed support for model visibility settings (active / depricated)

Backend

  • Created MongoModelService with full CRUD operations
  • Added /model API endpoints for CRUD's
  • Added model specific scoops

Frontend

  • New model settings page route /settings/models/:
    • Create / Edit modal with capability management
    • Delete confirmation modal
    • Badges for model capabilities (vision, function calling and so on)
  • Better model selector in the zoo:
    • Accordion with model information
  • Reusable badge component for model capabilities
  • Storybook stories for the new components

Testing

  • Remove models in MondoDB chat_models and restart the backend
  • Add New scoopes needed for administrating models:
"scopes": [
    ...,
    "model.read",
    "model.write",
    "model.delete",
    "model.admin"
  ],

@zilaei zilaei force-pushed the feat/user-friendly-model-info branch from d028b67 to 4c8fbe8 Compare September 9, 2025 14:04
@zilaei zilaei marked this pull request as ready for review September 10, 2025 11:52
@zilaei zilaei requested a review from MasterKenth September 11, 2025 08:19
- Create ModelSelector component to display selected model compactly
- Create ModelSelectorModal component to wrap ModelAccordion in a modal
- Update AssistantDetails to use new ModelSelector instead of inline accordion
- Improves UX by reducing initial form length

refactor(frontend/assistant): use class directives for conditional styling

refactor(frontend/assistant): remove redundant enhancedDescription div in ModelItem and

feat(frontend/assistant): introduce reusable Badge component

- Add componenet `Badge.svelte` for model badges
- Replace hardcoded badge-related logic in ModelHeader, ModelCapabilities, and ModelSelector with Badge component

feat(frontend/assistant): install and use `lucide-svelte` for Badge icons

- Replace SVG strings with `lucide-svelte` components for badge icons.
- Add `lucide-svelte` as a dependency.
- Refactor Badge component for better type safety and dynamic icon rendering.

feat(frontend/models): create a new page for models in settings

- New `ModelSettings` components: `ModelList`, `ModelItem`, `ModelFormModal`, `DeleteConfirmModal`, and `PageHeader`.
- Add modal-based create, edit, and delete flows for models.

fix(frontend/models): handle delete model errors in `DeleteConfirmModal`

- Added error state management
- Form enhance callback to handle deletion failurs
- Added UI for display error messages

fix(frontend/models): check if the error message type before handling it as a string

feat(api/models): add CRUD operations and lifecycle fields for models

- Introduced `Model` with fields: `created_at`, `updated_at`, `status`, `visibility`, and `version`.
- Added model management in `IAssistantService` with methods for create, update, delete, and retrieval.
- Implemented comprehensive test coverage for CRUD operations, including edge cases like keys with slashes, duplicate keys, optimistic locking, and model lifecycle validation.
- Integrated `model_router` into `api_router`.

feat(models): implement MongoDB-backed model service

- Added MongoModelService for model.
- Created API CRUD endpoints for models.
- Implemented tests for MongoModelService, covering edge cases and lifecycle scenarios.
- Integrated new model service to main app setup

This commit will break the frontend. `backendApi.ts` needs to consider the new endpoint created for the model service.
…r model management

- Introduced new user permission checks: read, write, delete, access settings, and admin for models.
- Added CRUD methods in `backendApi.ts` to interact with the models API.
…ranslations

- Updated `fr.json`, `en.json`, and `sv.json` to include new labels for "General" and "Models" settings.
- Introduced new components: `CapabilityToggle`, `MaxTokensInput`, `CapabilitiesSection`, and `CapabilityBadges`.
- Added support for managing model capabilities (e.g., image processing, reasoning, code execution, function calling) and token limits in the model settings.
- Made meta a required field with default values.
- Updated helpers and API logic to align with meta changes.
- Removed unused GetAvailableModels API and its references.
- Replaced `formData` with individual reactive state variables.
- Improved readability and reduced complexity in the reactive logic.
- Minor UI cleanup, SVG with `lucide-svelte` component.
- Fix linting and remove comments
…iption fallback

feat(components): extracted color picker, from assistant, to a separate reusable component

- Added customizable colors and selection handling.

feat(frontend/models): add primary color support to ModelFormModal

feat(models): add primary color handling to meta object
…component

fix(models): use correct fields for avatar and color handling in ModelSelector and utilities

refactor(models): enhanced model handling with `$derived.by`

refactor(models): add utilities for snake_case to camelCase conversion and update meta handling

feat(models): normalize backend response with `ModelRepository` and `ModelTransformer`

- Added a new `ModelRepository` to centralize API interactions for models.
- Implemented `ModelTransformer` for bidirectional conversion between camelCase and snake_case.

refactor(utils): remove helper for `getModelAvatar` access
fix(model): remove component hover effect
@zilaei zilaei force-pushed the feat/user-friendly-model-info branch from 5a9684d to 96eee64 Compare September 11, 2025 08:44
…classes directly before endpoints

- Kept shared `ModelResponse` class at the top - since it's used by multiple endpoints
- Moved `CreateModelRequest`, `GetModelsResponse` and `UpdateModelRequest` placed directly before their corresponding endpoint
- Backend routes now have a cleaner path without the redundant `/models` suffix
- Frontend API client updated to use the fixed endpoints
…ent-to-model conversion logic

- Fix will improve code by removing duplications
…d_at` to Unix epoch for missing/unknown timestamps
…instead of manually specifying all fields
@zilaei zilaei merged commit b30f1f4 into master Sep 12, 2025
2 checks passed
@zilaei zilaei deleted the feat/user-friendly-model-info branch September 12, 2025 11:46
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.

2 participants