UNPKG

claude-gemini-multimodal-bridge

Version:

Enterprise-grade AI integration bridge connecting Claude Code, Gemini CLI, and Google AI Studio with intelligent routing and advanced multimodal processing capabilities

105 lines (104 loc) 3.55 kB
export const COMPLEXITY_MULTIPLIERS = { low: { tokens: 1, score: 1, duration: 1, cost: 1 }, medium: { tokens: 1.5, score: 1.3, duration: 2, cost: 1.5 }, high: { tokens: 2.5, score: 2, duration: 4, cost: 2.5 }, }; export const DURATION_FACTORS = { low: 1, medium: 1.5, high: 2.5, }; export const COST_FACTORS = { low: 1, medium: 1.5, high: 2.5, }; export function scoreToComplexity(score) { if (score >= 6) { return 'high'; } if (score >= 3) { return 'medium'; } return 'low'; } export function getThresholdScore(value, thresholds) { for (const [threshold, score] of thresholds) { if (value > threshold) { return score; } } return 0; } export function calculateResourceEstimate(baseValues, inputMultiplier, complexity) { const multiplier = COMPLEXITY_MULTIPLIERS[complexity]; return { estimated_tokens: baseValues.memory * inputMultiplier * multiplier.tokens, complexity_score: baseValues.cpu * multiplier.score, estimated_duration: baseValues.duration * inputMultiplier * multiplier.duration, recommended_execution_mode: 'adaptive', required_capabilities: ['claude', 'gemini', 'aistudio'], estimated_cost: baseValues.cost * inputMultiplier * multiplier.cost, }; } export function estimateDuration(baseTime, multiplier, complexity) { return baseTime * multiplier * DURATION_FACTORS[complexity]; } export function estimateCost(baseCost, multiplier, complexity) { return baseCost * multiplier * COST_FACTORS[complexity]; } export const FILE_CATEGORIES = { document: ['pdf', 'doc', 'docx', 'txt', 'md', 'rtf', 'odt'], image: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'bmp', 'tiff'], audio: ['mp3', 'wav', 'ogg', 'flac', 'aac', 'm4a'], video: ['mp4', 'webm', 'avi', 'mov', 'mkv'], data: ['json', 'xml', 'csv', 'yaml', 'yml'], code: ['ts', 'js', 'py', 'java', 'cpp', 'c', 'go', 'rs', 'rb'], }; export function getFileCategory(extension) { const ext = extension.toLowerCase().replace('.', ''); for (const [category, extensions] of Object.entries(FILE_CATEGORIES)) { if (extensions.includes(ext)) { return category; } } return 'unknown'; } export const SUPPORTED_FORMATS = { document: { input: ['pdf', 'doc', 'docx', 'txt', 'md', 'rtf', 'html'], output: ['pdf', 'docx', 'md', 'txt', 'html'], }, image: { input: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp'], output: ['png', 'jpg', 'webp', 'gif'], }, audio: { input: ['mp3', 'wav', 'ogg', 'flac', 'aac'], output: ['mp3', 'wav', 'ogg'], }, data: { input: ['json', 'xml', 'csv', 'yaml'], output: ['json', 'xml', 'csv', 'yaml'], }, }; export function validateConversionFormat(type, sourceFormat, targetFormat) { const formats = SUPPORTED_FORMATS[type]; const sourceExt = sourceFormat.toLowerCase().replace('.', ''); const targetExt = targetFormat.toLowerCase().replace('.', ''); const inputFormats = formats.input; const outputFormats = formats.output; if (!inputFormats.includes(sourceExt)) { return { valid: false, error: `Unsupported source format for ${type}: ${sourceFormat}`, }; } if (!outputFormats.includes(targetExt)) { return { valid: false, error: `Unsupported target format for ${type}: ${targetFormat}`, }; } return { valid: true }; }