fix: handle checking compatible gated model

This commit is contained in:
Faisal Amir 2025-08-28 12:57:11 +07:00
parent 8166f3a32f
commit 6bb66b2b93
2 changed files with 13 additions and 5 deletions

View File

@ -79,6 +79,15 @@ export const ModelInfoHoverCard = ({
</span> </span>
</div> </div>
) )
} else if (status === 'GREY') {
return (
<div className="flex items-start gap-2">
<div className="size-2 shrink-0 bg-neutral-500 rounded-full mt-1"></div>
<span className="text-neutral-500 font-medium">
Unable to determine model compatibility with your current device
</span>
</div>
)
} else { } else {
return ( return (
<div className="flex items-start gap-2"> <div className="flex items-start gap-2">
@ -121,9 +130,7 @@ export const ModelInfoHoverCard = ({
<> <>
<div> <div>
<span className="text-main-view-fg/50 block"> <span className="text-main-view-fg/50 block">
{isDefaultVariant {isDefaultVariant ? 'Default Quantization' : 'Quantization'}
? 'Maybe Default Quantization'
: 'Quantization'}
</span> </span>
<span className="text-main-view-fg font-medium mt-1 inline-block"> <span className="text-main-view-fg font-medium mt-1 inline-block">
{variant?.model_id.split('-').pop()?.toUpperCase() || 'N/A'} {variant?.model_id.split('-').pop()?.toUpperCase() || 'N/A'}

View File

@ -592,7 +592,7 @@ export const checkMmprojExists = async (modelId: string): Promise<boolean> => {
export const isModelSupported = async ( export const isModelSupported = async (
modelPath: string, modelPath: string,
ctxSize?: number ctxSize?: number
): Promise<'RED' | 'YELLOW' | 'GREEN'> => { ): Promise<'RED' | 'YELLOW' | 'GREEN' | 'GREY'> => {
try { try {
const engine = getEngine('llamacpp') as AIEngine & { const engine = getEngine('llamacpp') as AIEngine & {
isModelSupported?: ( isModelSupported?: (
@ -600,6 +600,7 @@ export const isModelSupported = async (
ctx_size?: number ctx_size?: number
) => Promise<'RED' | 'YELLOW' | 'GREEN'> ) => Promise<'RED' | 'YELLOW' | 'GREEN'>
} }
console.log(engine, 'engine')
if (engine && typeof engine.isModelSupported === 'function') { if (engine && typeof engine.isModelSupported === 'function') {
return await engine.isModelSupported(modelPath, ctxSize) return await engine.isModelSupported(modelPath, ctxSize)
} }
@ -608,6 +609,6 @@ export const isModelSupported = async (
return 'YELLOW' // Conservative fallback return 'YELLOW' // Conservative fallback
} catch (error) { } catch (error) {
console.error(`Error checking model support for ${modelPath}:`, error) console.error(`Error checking model support for ${modelPath}:`, error)
return 'RED' // Error state, assume not supported return 'GREY' // Error state, assume not supported
} }
} }