[BUG] Multimodal fields not persisted when creating new models via API #13

Closed
opened 2026-05-08 23:46:27 +00:00 by Mark · 0 comments
Owner

Summary

When creating a new model via POST /api/models, the ModelRepository.create() method in backend/app/repositories/model_repository.py does not pass the multimodal, mmproj_path, and mmproj_sha256 fields from the creation payload to the database ModelRecord. These fields are silently dropped.

Affected File

backend/app/repositories/model_repository.py line 78-92

Root Cause

The ModelRecord constructor call omits the multimodal fields:

record = ModelRecord(
    id=model_id,
    name=payload.name,
    hf_repo=payload.hf_repo,
    description=payload.description,
    tags=payload.tags,
    parameters=payload.parameters,
    context_length=payload.context_length,
    backend=payload.backend,
    added_at=datetime.utcnow(),
    settings=settings_dict,
    is_active=False,
    status="idle",
    chat_template=payload.chat_template,  # present
    # MISSING: multimodal, mmproj_path, mmproj_sha256
)

Impact

Models created as multimodal (vision) models via the API or frontend will not have their multimodal flag or projector file paths saved. When the model is later started, the mmproj argument will not be passed to llama.cpp, causing vision inference to fail.

Expected

Add the missing fields:

record = ModelRecord(
    ...
    chat_template=payload.chat_template,
    multimodal=payload.multimodal,
    mmproj_path=payload.mmproj_path,
    mmproj_sha256=payload.mmproj_sha256,
)
## Summary When creating a new model via `POST /api/models`, the `ModelRepository.create()` method in `backend/app/repositories/model_repository.py` does not pass the `multimodal`, `mmproj_path`, and `mmproj_sha256` fields from the creation payload to the database `ModelRecord`. These fields are silently dropped. ## Affected File `backend/app/repositories/model_repository.py` line 78-92 ## Root Cause The `ModelRecord` constructor call omits the multimodal fields: ```python record = ModelRecord( id=model_id, name=payload.name, hf_repo=payload.hf_repo, description=payload.description, tags=payload.tags, parameters=payload.parameters, context_length=payload.context_length, backend=payload.backend, added_at=datetime.utcnow(), settings=settings_dict, is_active=False, status="idle", chat_template=payload.chat_template, # present # MISSING: multimodal, mmproj_path, mmproj_sha256 ) ``` ## Impact Models created as multimodal (vision) models via the API or frontend will not have their multimodal flag or projector file paths saved. When the model is later started, the `mmproj` argument will not be passed to llama.cpp, causing vision inference to fail. ## Expected Add the missing fields: ```python record = ModelRecord( ... chat_template=payload.chat_template, multimodal=payload.multimodal, mmproj_path=payload.mmproj_path, mmproj_sha256=payload.mmproj_sha256, ) ```
Mark closed this issue 2026-05-17 21:11:56 +00:00
Sign in to join this conversation.
No description provided.