webui: support video files as input (#22830)
This commit is contained in:
@@ -45,6 +45,10 @@ export function isFileTypeSupportedByModel(
|
||||
// Audio files require audio support
|
||||
return capabilities.hasAudio;
|
||||
|
||||
case FileTypeCategory.VIDEO:
|
||||
// Video files require video support
|
||||
return capabilities.hasVideo;
|
||||
|
||||
default:
|
||||
// Unknown categories - be conservative and allow
|
||||
return true;
|
||||
@@ -69,7 +73,7 @@ export function filterFilesByModalities(
|
||||
const unsupportedFiles: File[] = [];
|
||||
const modalityReasons: Record<string, string> = {};
|
||||
|
||||
const { hasVision, hasAudio } = capabilities;
|
||||
const { hasVision, hasAudio, hasVideo } = capabilities;
|
||||
|
||||
for (const file of files) {
|
||||
const category = getFileTypeCategory(file.type);
|
||||
@@ -91,6 +95,13 @@ export function filterFilesByModalities(
|
||||
}
|
||||
break;
|
||||
|
||||
case FileTypeCategory.VIDEO:
|
||||
if (!hasVideo) {
|
||||
isSupported = false;
|
||||
reason = 'Video files require a video-capable model';
|
||||
}
|
||||
break;
|
||||
|
||||
case FileTypeCategory.TEXT:
|
||||
case FileTypeCategory.PDF:
|
||||
// Always supported
|
||||
@@ -127,7 +138,7 @@ export function generateModalityErrorMessage(
|
||||
): string {
|
||||
if (unsupportedFiles.length === 0) return '';
|
||||
|
||||
const { hasVision, hasAudio } = capabilities;
|
||||
const { hasVision, hasAudio, hasVideo } = capabilities;
|
||||
|
||||
let message = '';
|
||||
|
||||
@@ -144,6 +155,7 @@ export function generateModalityErrorMessage(
|
||||
const supportedTypes: string[] = ['text files', 'PDFs'];
|
||||
if (hasVision) supportedTypes.push('images');
|
||||
if (hasAudio) supportedTypes.push('audio files');
|
||||
if (hasVideo) supportedTypes.push('video files');
|
||||
|
||||
message += ` This model supports: ${supportedTypes.join(', ')}.`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user