Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ModelStoreRepository(private val context: Context) {
private val GGUF_SUFFIX_REGEX = Regex("\\.gguf$", RegexOption.IGNORE_CASE)
private val QUANTIZATION_MATCH_REGEX = Regex("""(?:^|[.-])((?:I?Q)\d+(?:_[A-Z0-9]+)*)""")
private val TRAILING_QUANTIZATION_REGEX = Regex("""([.-])(?:I?Q)\d+(?:_[A-Z0-9]+)*(?:-[A-Z0-9]+)*$""")
private val PROJECTOR_MARKERS = listOf("mmproj", "vision-adapter", "projector")
private val PROJECTOR_MARKERS = listOf("mmproj", "mmjproj", "vision-adapter", "projector")
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

Adding a new projector marker changes the GGUF filtering behavior that feeds the on-disk model store cache. To prevent stale caches from continuing to show *mmjproj*.gguf as selectable models, bump ModelStoreCache.CURRENT_VERSION so existing caches are invalidated as intended by the comment above it.

Copilot uses AI. Check for mistakes.

internal fun isProjectorGgufFile(path: String): Boolean {
return path.endsWith(".gguf", ignoreCase = true) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ class ModelDownloadService : Service() {
if (modelFamilyKey.isNotBlank() && lowerPath.contains(modelFamilyKey)) {
score += 3
}
if (lowerPath.contains("mmproj")) {
if (lowerPath.contains("mmproj") || lowerPath.contains("mmjproj")) {
score += 1
}
Comment on lines +416 to 418

Choose a reason for hiding this comment

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

medium

For better maintainability and readability, consider using a list of markers and the any function. This makes it easier to add more projector markers in the future without extending the if condition.

Suggested change
if (lowerPath.contains("mmproj") || lowerPath.contains("mmjproj")) {
score += 1
}
if (listOf("mmproj", "mmjproj").any { lowerPath.contains(it) }) {
score += 1
}

file to score
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ class ChatViewModel @Inject constructor(
return "Please load a text generation model first"
}
if (!LlmModelWorker.isVlmLoaded.value) {
return "Please load a compatible projector (mmproj) first"
return "Please load a compatible projector (mmproj or mmjproj) first"
}
if (_isGenerating.value) {
return "Please wait for the current generation to finish"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ModelStoreRepositoryTest {
@Test
fun supportedGgufFileRejectsProjectionArtifacts() {
assertFalse(ModelStoreRepository.isSupportedGgufFile("models/whisper-mmproj.Q4_K_M.GGUF"))
assertFalse(ModelStoreRepository.isSupportedGgufFile("models/whisper-mmjproj.Q4_K_M.GGUF"))
assertFalse(ModelStoreRepository.isSupportedGgufFile("models/whisper-vision-adapter.gguf"))
assertFalse(ModelStoreRepository.isSupportedGgufFile("models/whisper-projector.gguf"))
}
Expand Down
Loading