Rewrite frontend as single self-contained HTML file — all CSS/JS inline, no external files to fail loading

This commit is contained in:
2026-05-13 17:24:10 +02:00
parent 3432d362e2
commit ddb0f88257
116 changed files with 4240 additions and 921 deletions

29
dist/cli/args.d.ts vendored Normal file
View File

@@ -0,0 +1,29 @@
export interface CLIArgs {
_: (string | number)[];
$0: string;
video_file_path?: string;
captureIntervalSeconds?: number;
contextWindowSize?: number;
visionProvider?: string;
visionModel?: string;
ttsProvider?: string;
ttsModel?: string;
ttsVoice?: string;
ttsSpeedFactor?: number;
ttsInstructions?: string;
outputDir?: string;
tempDir?: string;
batchTimeMode?: boolean;
batchWindowDuration?: number;
framesInBatch?: number;
defaultPrompt?: string;
changePrompt?: string;
batchPrompt?: string;
estimate?: boolean;
config?: string;
saveConfig?: string;
}
/**
* Parse command line arguments
*/
export declare function parseCommandLineArgs(): CLIArgs;

120
dist/cli/args.js vendored Normal file
View File

@@ -0,0 +1,120 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseCommandLineArgs = parseCommandLineArgs;
const yargs_1 = __importDefault(require("yargs/yargs"));
const helpers_1 = require("yargs/helpers");
/**
* Parse command line arguments
*/
function parseCommandLineArgs() {
const parsed = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
.usage('Usage: $0 <video_file_path> [options]')
.positional('video_file_path', {
describe: 'Path to the input video file',
type: 'string'
})
.option('captureIntervalSeconds', {
alias: 'i',
describe: 'Interval in seconds between frame captures',
type: 'number'
})
.option('contextWindowSize', {
alias: 'c',
describe: 'Number of frames to keep in context',
type: 'number'
})
.option('visionProvider', {
describe: 'Provider to use for vision AI',
type: 'string'
})
.option('visionModel', {
describe: 'Model to use for vision AI',
type: 'string'
})
.option('ttsProvider', {
describe: 'Provider to use for text-to-speech',
type: 'string'
})
.option('ttsModel', {
alias: 'm',
describe: 'TTS model to use',
type: 'string'
})
.option('ttsVoice', {
alias: 'v',
describe: 'Voice to use for text-to-speech',
type: 'string'
})
.option('ttsSpeedFactor', {
alias: 's',
describe: 'Speed factor for the audio playback',
type: 'number'
})
.option('ttsInstructions', {
describe: 'Instructions for TTS voice style (gpt-4o-mini-tts)',
type: 'string'
})
.option('outputDir', {
alias: 'o',
describe: 'Directory for output files',
type: 'string'
})
.option('tempDir', {
alias: 't',
describe: 'Directory for temporary files',
type: 'string'
})
.option('batchTimeMode', {
alias: 'b',
describe: 'Use batch time mode for processing',
type: 'boolean'
})
.option('batchWindowDuration', {
describe: 'Duration in seconds for each batch window',
type: 'number'
})
.option('framesInBatch', {
describe: 'Number of frames to capture within each batch',
type: 'number'
})
.option('defaultPrompt', {
describe: 'Prompt for describing individual frames',
type: 'string'
})
.option('changePrompt', {
describe: 'Prompt for describing changes between frames',
type: 'string'
})
.option('batchPrompt', {
describe: 'Prompt for describing batches of frames',
type: 'string'
})
.option('estimate', {
alias: 'e',
describe: 'Only estimate the cost without generating the audio description',
type: 'boolean',
default: false
})
.option('config', {
alias: 'f',
describe: 'Path to JSON config file',
type: 'string'
})
.option('saveConfig', {
describe: 'Save current configuration to specified JSON file',
type: 'string'
})
.help()
.alias('help', 'h')
.example('$0 video.mp4', 'Process a video with default settings')
.example('$0 video.mp4 --ttsVoice nova --visionProvider openai', 'Process with custom voice and vision provider')
.example('$0 video.mp4 --estimate', 'Only estimate the processing cost')
.example('$0 video.mp4 --config myconfig.json', 'Use settings from a config file')
.example('$0 video.mp4 --saveConfig myconfig.json', 'Save current settings to a config file')
.argv;
return parsed;
}
//# sourceMappingURL=args.js.map

1
dist/cli/args.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":";;;;;AAgCA,oDA4GC;AA5ID,wDAAgC;AAChC,2CAAwC;AA4BxC;;GAEG;AACH,SAAgB,oBAAoB;IAClC,MAAM,MAAM,GAAG,IAAA,eAAK,EAAC,IAAA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AAO,CAAC,yBAAyB,EAAE,mCAAmC,CAAC;SACvE,OAAO,CAAC,qCAAqC,EAAE,iCAAiC,CAAC;SACjF,OAAO,CAAC,yCAAyC,EAAE,wCAAwC,CAAC;SAC5F,IAA0B,CAAC;IAE9B,OAAO,MAAM,CAAC;AAChB,CAAC"}

1
dist/cli/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
import 'dotenv/config';

83
dist/cli/index.js vendored Normal file
View File

@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("dotenv/config");
const config_1 = require("../config/config");
const stats_1 = require("../config/stats");
const visionProviderFactory_1 = require("../providers/vision/visionProviderFactory");
const ttsProviderFactory_1 = require("../providers/tts/ttsProviderFactory");
const processor_1 = require("../utils/processor");
const costEstimator_1 = require("../utils/costEstimator");
const configUtils_1 = require("../utils/configUtils");
const args_1 = require("./args");
async function main() {
const argv = (0, args_1.parseCommandLineArgs)();
let config = (0, config_1.getDefaultConfig)();
if (argv.config) {
const fileConfig = (0, configUtils_1.loadConfigFromFile)(argv.config);
config = { ...config, ...fileConfig };
}
const argvObj = argv;
Object.keys(argvObj).forEach(key => {
if (key !== '_' && key !== '$0' && key !== 'config' && key !== 'saveConfig' &&
key !== 'estimate' && key !== 'help' && key !== 'version' &&
argvObj[key] !== undefined) {
config[key] = argvObj[key];
}
});
if (argv.visionModel) {
if (!config.visionProviders[config.visionProvider]) {
config.visionProviders[config.visionProvider] = { model: '' };
}
config.visionProviders[config.visionProvider].model = argv.visionModel;
}
if (argv.ttsModel) {
if (!config.ttsProviders[config.ttsProvider]) {
config.ttsProviders[config.ttsProvider] = { model: '' };
}
config.ttsProviders[config.ttsProvider].model = argv.ttsModel;
}
if (argv.ttsVoice) {
if (!config.ttsProviders[config.ttsProvider]) {
config.ttsProviders[config.ttsProvider] = { model: '', voice: '' };
}
config.ttsProviders[config.ttsProvider].voice = argv.ttsVoice;
}
if (argv.saveConfig) {
(0, configUtils_1.saveConfigToFile)(argv.saveConfig, config);
}
if (argv._.length < 1) {
console.error('Error: No video file specified');
console.log('Usage: node script.js <video_file_path> [options]');
console.log('Use --help for more information');
process.exit(1);
}
const videoFilePath = String(argv._[0]);
if (argv.estimate) {
try {
const costBreakdown = await (0, costEstimator_1.estimateCost)(videoFilePath, config);
console.log('\n=== COST ESTIMATION ===');
console.log(JSON.stringify(costBreakdown, null, 2));
console.log(`\nEstimated total cost: ${costBreakdown.apiCosts.total}`);
console.log(`Estimated processing time: ${costBreakdown.estimates.estimatedProcessingTimeMinutes.toFixed(1)} minutes`);
console.log('Note: Actual costs may vary based on image complexity and actual response lengths.');
}
catch (err) {
console.error('Error estimating costs:', err);
}
}
else {
try {
const stats = (0, stats_1.createStats)();
const visionProvider = visionProviderFactory_1.VisionProviderFactory.getProvider(config);
const ttsProvider = ttsProviderFactory_1.TTSProviderFactory.getProvider(config);
await (0, processor_1.generateAudioDescription)(videoFilePath, visionProvider, ttsProvider, config, stats);
}
catch (err) {
console.error('Error generating audio description:', err);
}
}
}
if (require.main === module) {
main().catch(err => console.error('Unhandled error:', err));
}
//# sourceMappingURL=index.js.map

1
dist/cli/index.js.map vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AACvB,6CAAoD;AACpD,2CAA8C;AAC9C,qFAAkF;AAClF,4EAAyE;AACzE,kDAA8D;AAC9D,0DAAsD;AACtD,sDAA4E;AAC5E,iCAA8C;AAG9C,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,IAAA,2BAAoB,GAAE,CAAC;IAEpC,IAAI,MAAM,GAAW,IAAA,yBAAgB,GAAE,CAAC;IAExC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,UAAU,GAAG,IAAA,gCAAkB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,UAA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