WIP typescript conversion

This commit is contained in:
2025-06-10 19:24:13 +02:00
parent 9425b4b256
commit 507d4f6474
26 changed files with 2128 additions and 27 deletions

83
src/config/config.ts Normal file
View File

@@ -0,0 +1,83 @@
import { VisionProviderConfig, TTSProviderConfig } from '../interfaces';
export interface Config {
captureIntervalSeconds: number;
contextWindowSize: number;
defaultPrompt: string;
changePrompt: string;
batchPrompt: string;
// Vision AI settings
visionProvider: string;
visionModel: string;
visionProviders: {
[key: string]: VisionProviderConfig;
};
// TTS settings
ttsProvider: string;
ttsVoice: string;
ttsSpeedFactor: number;
ttsProviders: {
[key: string]: TTSProviderConfig;
};
// Video processing settings
outputDir: string;
tempDir: string;
batchTimeMode: boolean;
batchWindowDuration: number;
framesInBatch: number;
}
// Default configuration options
export const defaultConfig: Config = {
captureIntervalSeconds: 10,
contextWindowSize: 5,
defaultPrompt: "Describe this frame from a video in 1-2 sentences for someone who cannot see it. Focus on key visual elements. Avoid using terms like 'in this frame', simply describe the actual frame. Keep sentences short and concise, as this will be used to generate an audio track which is overlayed on the video.",
changePrompt: "Describe what has changed between these frames in 1-2 sentences for someone who cannot see the video. Focus on significant visual changes only. Avoid talking about meta information such as 'in this frame', or 'the significant change is', and merely describe the actual change taking place. Only describe the changes relevant to the last frame. The previous frames are attached for you to build context and build situational awareness. Keep it short and concise, as your text will be used to generate audio description tracks to be played with the video.",
batchPrompt: "Describe the sequence of frames in this batch over time for someone who cannot see it. Focus on what happens, changes, or stands out visually during these seconds. Keep it to 1-3 concise sentences, avoiding words like 'in these frames'—just describe what's happening. Use context from the previous batch if relevant. Keep sentences short and concise. Avoid speculation or overly verbose or unnecessary sentences. Try not to use nested sentences and keep sentences short to help flow. This will be used for audio description and mixed back in with the video file later, so we need to maintain consistency and quick pacing. Avoid using phrases such as 'as evidenced by' or 'suggesting'. Only focus on describing the visual scene. Do not repeat information given in the previous prompt, and focus only on what has changed since that description. Avoid talking about the scene or sequence, simply focus on the action within these frames. The listener knows that this is a video, so we do not need to remind them. Also avoid overusing phrases such as 'the scene shifts', the shifting or perspective change should be evident from the description of the sequence itself.",
// Vision AI settings
visionProvider: "gemini",
visionModel: "gemini-2.0-flash",
visionProviders: {
openai: {
apiKey: process.env.OPENAI_API_KEY,
model: "gpt-4o",
maxTokens: 300
},
gemini: {
apiKey: process.env.GOOGLE_API_KEY,
model: "gemini-2.0-flash",
maxTokens: 300
},
ollama: {
// Example config; adjust to match your local Ollama setup
baseUrl: "http://localhost:11434", // or wherever Ollama is hosted
model: "gemma3:12b",
maxTokens: 3000
}
// Add other vision providers here
},
// TTS settings
ttsProvider: "openai",
ttsVoice: "alloy", // Voice option for TTS
ttsSpeedFactor: 1.5, // Speed up audio by 50%
ttsProviders: {
openai: {
apiKey: process.env.OPENAI_API_KEY,
model: "tts-1-hd",
voice: "alloy"
},
// Add other TTS providers here
},
// Video processing settings
outputDir: "./desc/output/",
tempDir: "./desc/tmp/",
batchTimeMode: true, // Whether to use the new batch time mode
batchWindowDuration: 15, // How many seconds each batch covers
framesInBatch: 10, // How many frames to capture within each batch
};