Merge pull request #6316 from menloresearch/fix/handle-checking-model-gated
fix: handle checking model gated
This commit is contained in:
commit
7a657477de
@ -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'}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ export const ModelSupportStatus = ({
|
|||||||
className,
|
className,
|
||||||
}: ModelSupportStatusProps) => {
|
}: ModelSupportStatusProps) => {
|
||||||
const [modelSupportStatus, setModelSupportStatus] = useState<
|
const [modelSupportStatus, setModelSupportStatus] = useState<
|
||||||
'RED' | 'YELLOW' | 'GREEN' | 'LOADING' | null
|
'RED' | 'YELLOW' | 'GREEN' | 'LOADING' | null | 'GREY'
|
||||||
>(null)
|
>(null)
|
||||||
|
|
||||||
// Helper function to check model support with proper path resolution
|
// Helper function to check model support with proper path resolution
|
||||||
@ -32,7 +32,7 @@ export const ModelSupportStatus = ({
|
|||||||
async (
|
async (
|
||||||
id: string,
|
id: string,
|
||||||
ctxSize: number
|
ctxSize: number
|
||||||
): Promise<'RED' | 'YELLOW' | 'GREEN' | null> => {
|
): Promise<'RED' | 'YELLOW' | 'GREEN' | 'GREY' | null> => {
|
||||||
try {
|
try {
|
||||||
const janDataFolder = await getJanDataFolderPath()
|
const janDataFolder = await getJanDataFolderPath()
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ function HubModelDetail() {
|
|||||||
|
|
||||||
// State for model support status
|
// State for model support status
|
||||||
const [modelSupportStatus, setModelSupportStatus] = useState<
|
const [modelSupportStatus, setModelSupportStatus] = useState<
|
||||||
Record<string, 'RED' | 'YELLOW' | 'GREEN' | 'LOADING'>
|
Record<string, 'RED' | 'YELLOW' | 'GREEN' | 'LOADING' | 'GREY'>
|
||||||
>({})
|
>({})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -924,7 +924,7 @@ describe('models service', () => {
|
|||||||
expect(result).toBe('YELLOW') // Should use fallback
|
expect(result).toBe('YELLOW') // Should use fallback
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return RED when there is an error', async () => {
|
it('should return GREY when there is an error', async () => {
|
||||||
const mockEngineWithError = {
|
const mockEngineWithError = {
|
||||||
...mockEngine,
|
...mockEngine,
|
||||||
isModelSupported: vi.fn().mockRejectedValue(new Error('Test error')),
|
isModelSupported: vi.fn().mockRejectedValue(new Error('Test error')),
|
||||||
@ -934,7 +934,7 @@ describe('models service', () => {
|
|||||||
|
|
||||||
const result = await isModelSupported('/path/to/model.gguf')
|
const result = await isModelSupported('/path/to/model.gguf')
|
||||||
|
|
||||||
expect(result).toBe('RED')
|
expect(result).toBe('GREY')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -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?: (
|
||||||
@ -608,6 +608,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user