Skip to content

Conversation

@urmauur
Copy link
Member

@urmauur urmauur commented Sep 7, 2025

Describe Your Changes

This pull request introduces a new dialog for importing vision models, refactors the model import logic in the provider settings page to use this dialog, and improves model/provider selection logic to avoid race conditions. It also includes minor UI and code quality improvements.

New Feature: Vision Model Import Dialog

  • Added a new ImportVisionModelDialog component that allows users to import both standard and vision (MMPROJ) models, with validation, user feedback, and automatic model naming. This dialog is now used in the provider settings page for model import. [1] [2]

Provider Settings Refactoring

  • Refactored the provider settings page ($providerName.tsx) to remove old inline model import logic and use the new ImportVisionModelDialog, simplifying the code and improving maintainability. [1] [2]
  • Updated model start/stop and refresh logic to use more readable multi-line service calls. [1] [2] [3]

Model/Provider Selection Logic Improvements

  • Improved model/provider auto-selection logic in DropdownModelProvider.tsx to avoid race conditions, especially when handling web-only auto-selection and manual selections. Excluded certain dependencies from useEffect to prevent unwanted re-renders. [1] [2] [3] [4] [5] [6]
  • Updated code formatting for better readability in several async service calls. [1] [2]

UI Consistency

  • Improved conditional rendering and formatting for provider settings UI elements.

Code Cleanup

  • Removed unused state variables and old import logic from the provider settings page. [1] [2]

Fixes Issues

Screenshot 2025-09-07 at 23 43 16 Screenshot 2025-09-07 at 23 43 22 > Screenshot 2025-09-07 at 23 42 15

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Introduces ImportVisionModelDialog for importing models, refactors provider settings, and improves model/provider selection logic.

  • New Feature:
    • Adds ImportVisionModelDialog for importing standard and vision models with validation and feedback.
  • Provider Settings Refactoring:
    • Refactors $providerName.tsx to use ImportVisionModelDialog for model import.
    • Updates model start/stop logic to use multi-line service calls.
  • Model/Provider Selection Logic:
    • Improves auto-selection logic in DropdownModelProvider.tsx to avoid race conditions.
    • Excludes certain dependencies from useEffect to prevent re-renders.
  • UI Consistency:
    • Improves conditional rendering and formatting for provider settings UI elements.
  • Code Cleanup:
    • Removes unused state variables and old import logic from provider settings.

This description was created by Ellipsis for a5b0ced. You can customize this summary. It will automatically update as commits are pushed.

@urmauur urmauur self-assigned this Sep 7, 2025
@urmauur urmauur added this to the v0.7.0 milestone Sep 7, 2025
@urmauur urmauur moved this to Needs Review in Jan Sep 7, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 1b035fd in 1 minute and 55 seconds. Click for details.
  • Reviewed 693 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/ChatInput.tsx:107
  • Draft comment:
    Refactored mmproj check call using multiline chaining enhances readability.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. web-app/src/containers/DropdownModelProvider.tsx:194
  • Draft comment:
    Improved auto-selection logic using a currentState object helps avoid race conditions.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. web-app/src/routes/settings/providers/$providerName.tsx:527
  • Draft comment:
    Refactored inline model import logic to use ImportVisionModelDialog, improving maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_akhTy6MGV3Xx2nqj

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2025

Barecheck - Code coverage report

Total: 30.52%

Your code coverage diff: -0.47% ▾

Uncovered files and lines
FileLines
web-app/src/containers/ChatInput.tsx88-90, 115-121, 123-125, 141-142, 183-184, 206-208, 215-216, 219-222, 225-235, 238, 240-242, 248, 250, 252-253, 255-259, 262-263, 266, 268-271, 273-277, 279-291, 293-303, 305-314, 316-319, 322-323, 325-328, 331-332, 335-339, 342-343, 345-348, 351-353, 356-358, 361-364, 366-367, 369-373, 375-377, 381-383, 386-389, 391-392, 394-395, 397-402, 405-411, 413-417, 420, 422-426, 429-436, 438-441, 443-445, 447-458, 460-466, 468-474, 477-480, 482, 518-526, 528-533, 535-537, 539-541, 543-544, 602, 642-656, 672-674, 679-683, 698-702, 717-731, 734-748, 758, 776, 793, 795-798
web-app/src/containers/DropdownModelProvider.tsx42-49, 52-60, 90-94, 103, 109-111, 113-120, 123-128, 130-138, 147-150, 152-159, 161-162, 165-175, 177-179, 181-192, 202-209, 241-250, 253-254, 259-262, 264-267, 272-273, 283, 285-291, 293, 295-297, 300-301, 303-309, 325, 333-340, 342-346, 357-358, 364-367, 370-371, 373, 381-388, 391-398, 400-401, 404-412, 441-443, 456-462, 494-500, 507-509, 514, 516-520, 523-528, 530-540, 542-555, 557-558, 560-561, 566, 571-573, 575, 577-580, 583-602, 604-608, 610, 613, 615, 617-623, 625-635, 637-640, 642-643, 645-649, 651-652, 654, 656
web-app/src/containers/dialogs/ImportVisionModelDialog.tsx1, 10-15, 28-42, 44-45, 47-57, 59-60, 63, 65-66, 68, 70-73, 76-78, 81-95, 97-102, 104, 106, 108-110, 112-115, 118-121, 124-147, 149-161, 163-165, 167-169, 171-175, 177-178, 180-181, 183-187, 190-192, 194-197, 199-203, 205-208, 210-213, 216-218, 220-225, 227, 229-230, 232-237, 239-240, 242-243, 245-247, 250-262, 264-273, 275-282, 284-289, 291-292, 295-296, 298, 300-306, 308-309, 312-328, 331-334, 336-341, 345, 347-349, 351-352, 354-355, 357-371, 373, 375-385, 387-389, 392-400, 402-408, 412-419, 421-423, 425, 427-433, 435, 437, 440-444, 446-447, 449-463, 465, 467-477, 479-481, 484-492, 494-500, 504-511, 513-515, 517, 519-525, 527, 529, 531-532, 534-540, 542-553, 555, 557-559, 561, 563-566, 568
web-app/src/routes/settings/providers/$providerName.tsx1-6, 12-36, 39-41, 43-47, 49-80, 83-91, 93, 95, 98-101, 103-104, 106-112, 115-120, 122-132, 134, 136-139, 142-147, 149-150, 153-154, 156, 158-163, 166-167, 169-172, 177-178, 180-183, 185-191, 193-197, 200-206, 209-212, 214, 216-220, 222-246, 248, 250-251, 253-256, 258-271, 273-275, 277, 279-282, 284-292, 295-308, 310-314, 316, 318-355, 357-363, 366-367, 369-376, 378-388, 392-394, 397, 400-402, 404-415, 418-422, 424-427, 430-431, 434, 436-440, 442-451, 453-456, 458, 461-470, 472-477, 479-489, 491-493, 495-507, 509, 511-512, 514, 516-517, 520-537, 539-544, 546-549, 551-557, 559-560, 562-571, 573-582, 584, 586-587, 590-600, 602-605, 607-613, 615-619, 621-630, 632-644, 646-647, 649-654, 656-662, 664, 666, 668, 670, 672, 674, 676-683, 685-687, 689-695, 697
web-app/src/services/models/default.ts74-76, 135, 137-141, 185-193, 197-199, 201-202, 204, 206, 208, 210-216, 219-239, 241-242, 245-254, 306, 318-319, 321-322, 325-326, 330-332, 334-335, 338-339, 342-345, 347-348, 351, 353-373, 376-381, 383-393, 395, 397-407, 409-423, 425-431, 434-435, 438-445, 471-472, 476-478, 481-493

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2025

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 4141910 in 1 minute and 39 seconds. Click for details.
  • Reviewed 17 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:42
  • Draft comment:
    Removing the file filters allows any file type to be selected. Consider re-adding filters (with correct extensions: 'gguf' for model and 'mmproj' for vision models) or adding client-side validation to prevent incorrect file types.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While removing filters does allow any file type to be selected initially, the application has multiple layers of validation: 1) Clear UI labeling of required file types 2) File extension validation when processing the file name 3) Backend validation during import. The filters were also incorrect before (using 'gguf' for both model and mmproj). Having filters might provide slightly better UX but isn't a critical issue. I might be underestimating the importance of UX - letting users select wrong files initially only to fail later could be frustrating. Also, I'm assuming the backend does proper validation. While better UX is valuable, this isn't a critical issue - the application handles invalid files gracefully and clearly communicates requirements. The previous filters were actually wrong, so removing them may be better than having incorrect ones. This comment should be deleted. While file filters could improve UX, the application has sufficient validation and clear communication about file requirements. The change doesn't introduce any bugs or critical issues.

Workflow ID: wflow_bWrIbKrTl6RvXL11

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 836990b in 1 minute and 22 seconds. Click for details.
  • Reviewed 100 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. extensions/llamacpp-extension/src/index.ts:1738
  • Draft comment:
    checkMmprojExists now verifies mmproj existence by first checking for a YAML field and then falling back to fs.existsSync. Consider validating that a defined mmproj_path is non‐empty and optionally checking the file’s existence even when mmproj_path is provided.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:25
  • Draft comment:
    The onSuccess callback signature now accepts an optional importedModelName, and it is correctly called with modelName on success. This enables downstream components to update state based on the imported model.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. web-app/src/routes/settings/providers/$providerName.tsx:93
  • Draft comment:
    The handleModelImportSuccess function refreshes the provider settings and, for llamacpp, checks for mmproj existence to add the 'vision' capability to the model. Note that it assumes the imported model's id equals the model name passed from the dialog; ensure this mapping remains consistent.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_Fg4Qu6rEX9JQ59mF

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@Minh141120
Copy link
Member

LGTM!
image

Next actions:

  • Add validation for import model:
    • import model file in mmproj field and model file in mmproj field (read metadata of gguf file to check)
    • import mmproj from different model (gemma3-4b model but import mmproj from qwen-2.5-vl)
image

Copy link
Member

@Minh141120 Minh141120 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed be851eb in 2 minutes and 45 seconds. Click for details.
  • Reviewed 596 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. extensions/llamacpp-extension/src/index.ts:2004
  • Draft comment:
    Ensure validateGgufFile documents its dual role clearly: for text generation models it rejects clip architecture, while for vision models (via mmproj) clip is expected. Adding an inline comment to clarify this difference would be beneficial.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:64
  • Draft comment:
    The validation logic for model vs. MMProj files is duplicated. Consider refactoring the common code into a helper to improve maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
3. web-app/src/services/models/default.ts:470
  • Draft comment:
    In the fallback of validateGgufFile, returning isValid:true along with an error message is potentially confusing. Consider omitting the error field when isValid is true or adjusting the fallback logic.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment raises a valid point about API design - having both isValid=true and an error message is somewhat contradictory and could confuse consumers of this API. However, this is a fallback case where we're deliberately being lenient by assuming validity when we can't validate. The error message serves as documentation of why we couldn't properly validate. The current implementation seems like a reasonable tradeoff. The comment may be too nitpicky about API design in a fallback case. The current implementation provides useful information while maintaining backward compatibility. While the API design could be cleaner, the current implementation serves a practical purpose by both allowing the file through (isValid=true) while documenting why proper validation couldn't occur. The comment should be deleted. The current implementation makes a reasonable tradeoff between usability and proper error documentation in a fallback case.
4. web-app/src/services/models/types.ts:72
  • Draft comment:
    The types and interfaces look clean. Ensure that any future changes to model validation also update the ModelValidationResult interface if additional fields are required.
  • Reason this comment was not posted:
    Confidence changes required: 10% <= threshold 50% None
5. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:99
  • Draft comment:
    Typo suggestion: The error message for MMProj files refers to the expected architecture as "clip" (in lowercase) on this line, whereas the corresponding model file error message uses "CLIP". Consider standardizing the casing (e.g., using "CLIP" in both messages) for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the inconsistency exists, it's a very minor issue that doesn't affect functionality. The code correctly handles both cases since the comparison is done with lowercase. The error messages are still clear and understandable regardless of casing. This seems like an overly pedantic comment that doesn't warrant a code change. The inconsistency could potentially confuse users who are trying to debug issues, as they might think the casing matters when it actually doesn't. The potential for confusion is minimal since these are just error messages, and the actual validation logic uses lowercase comparison. Users are unlikely to even notice the casing difference. Delete this comment as it addresses a trivial cosmetic issue that doesn't impact functionality or clarity.

Workflow ID: wflow_HDpxHehGafX7XIx8

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed f259413 in 1 minute and 40 seconds. Click for details.
  • Reviewed 66 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:15
  • Draft comment:
    Remove unused import 'IconFileImport'.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:430
  • Draft comment:
    Updated CSS classes for error messages to use standardized design tokens ('text-destructive' and 'text-destructive/90'). Verify that these changes match the intended design system.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:459
  • Draft comment:
    Changed file selection button variant to 'link' with updated styling classes. Ensure the new styling provides the expected visual affordance.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_dO4OZjXmgaNbnPSE

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 94dc298 in 1 minute and 58 seconds. Click for details.
  • Reviewed 151 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:65
  • Draft comment:
    If serviceHub.models().validateGgufFile isn’t available for model files, no validation occurs. Consider logging a warning or handling this case explicitly.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
2. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:118
  • Draft comment:
    Before accessing nested metadata (metadata.metadata), consider verifying the structure to guard against undefined values.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
3. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:124
  • Draft comment:
    If 'architecture' is undefined, the error message may be confusing. Consider checking for undefined before using it in the error message.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None
4. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:60
  • Draft comment:
    Multiple console.log statements output file paths and metadata. In production, consider a more secure logging approach or removal of debug logs.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:106
  • Draft comment:
    Using a dynamic import for Tauri's invoke is useful; ensure this pattern is supported in all target environments and errors are handled gracefully.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
6. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:47
  • Draft comment:
    Consider extracting the file validation logic into separate utility functions to improve readability and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_4aF0tAsrwG7Rw4Aa

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@Minh141120
Copy link
Member

Minh141120 commented Sep 8, 2025

@urmauur, the MMPROJ file should be cleaned up when we disable vision model support, otherwise when we try to import a text-based model, we'll encounter this error

mismatch between text model (n_embd = 1536) and mmproj (n_embd = 2048) hint: you may be using wrong mmproj srv load_model: failed to load multimodal mode

image image image

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed a5b0ced in 1 minute and 8 seconds. Click for details.
  • Reviewed 20 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/dialogs/ImportVisionModelDialog.tsx:314
  • Draft comment:
    Good update: The onCheckedChange handler now resets mmProj-related state when toggling off vision mode, preventing stale state. Consider memoizing the handler if performance becomes a concern.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_96P7r7xsQkUK4Iwk

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@urmauur urmauur merged commit 5e30e10 into dev Sep 9, 2025
17 checks passed
@urmauur urmauur deleted the feat/import-vision-model branch September 9, 2025 02:42
@github-project-automation github-project-automation bot moved this from Needs Review to QA in Jan Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Importing vision model requires mmproj

4 participants