feat: Add Media Assets sidebar tab for file management

- Implement new sidebar tab for managing imported/generated files
- Add separate composables for internal and cloud environments
- Display execution time from history API on generated outputs
- Support gallery view with keyboard navigation
- Auto-truncate long filenames in cloud environment
- Add utility functions for media type detection
- Enable feature only in development mode

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jin Yi
2025-10-18 00:05:54 +09:00
parent fd2a52500c
commit 2bb54650b4
12 changed files with 720 additions and 157 deletions

View File

@@ -474,3 +474,51 @@ export function formatDuration(milliseconds: number): string {
return parts.join(' ')
}
/**
* Determines the media type from a filename's extension
* @param filename The filename to analyze
* @returns The media type: 'images', 'videos', 'audios', '3D' for gallery compatibility
*/
export function getMediaTypeFromFilename(filename: string): string {
if (!filename) return 'images'
const ext = filename.split('.').pop()?.toLowerCase()
if (!ext) return 'images'
const imageExts = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp']
const videoExts = ['mp4', 'webm', 'mov', 'avi']
const audioExts = ['mp3', 'wav', 'ogg', 'flac']
const threeDExts = ['obj', 'fbx', 'gltf', 'glb']
if (imageExts.includes(ext)) return 'images'
if (videoExts.includes(ext)) return 'videos'
if (audioExts.includes(ext)) return 'audios'
if (threeDExts.includes(ext)) return '3D'
return 'images'
}
/**
* Determines the media kind from a filename's extension
* @param filename The filename to analyze
* @returns The media kind: 'image', 'video', 'audio', or '3D'
*/
export function getMediaKindFromFilename(
filename: string
): 'image' | 'video' | 'audio' | '3D' {
if (!filename) return 'image'
const ext = filename.split('.').pop()?.toLowerCase()
if (!ext) return 'image'
const imageExts = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp']
const videoExts = ['mp4', 'webm', 'mov', 'avi']
const audioExts = ['mp3', 'wav', 'ogg', 'flac']
const threeDExts = ['obj', 'fbx', 'gltf', 'glb']
if (imageExts.includes(ext)) return 'image'
if (videoExts.includes(ext)) return 'video'
if (audioExts.includes(ext)) return 'audio'
if (threeDExts.includes(ext)) return '3D'
return 'image'
}