import { VoiceTask } from './generator.js';
import { TranslateConfig, CharacterVoiceConfig } from './config.js';
import { GPTSoVITSAPI } from './request.js';
import { ITranslationService } from './translate/index.js';
import { EmotionRecognitionResult } from '@webgal-tools/config';
interface TranslateTask {
    id: string;
    character: string;
    originalText: string;
    targetLanguage: string;
    audioFileName: string;
    context?: string;
    characterConfig?: CharacterVoiceConfig;
    translationService: ITranslationService;
}
interface TranslateResult {
    id: string;
    character: string;
    originalText: string;
    translatedText: string;
    audioFileName: string;
    success: boolean;
    error?: string;
    isAutoMode?: boolean;
    emotionResult?: EmotionRecognitionResult;
}
/**
 * 并发控制器 - 基于Promise而非多进程
 */
export declare class ParallelProcessor {
    private api;
    private audioOutputDir;
    private translationFactory;
    private gptSovitsPath;
    private totalTasks;
    private completedTranslateCount;
    private completedVoiceCount;
    private completedVoiceTasks;
    private voiceQueue;
    private isVoiceSynthesizing;
    private currentModelKey;
    private maxConcurrency;
    private onTranslateProgress?;
    private onVoiceProgress?;
    private onError?;
    constructor(api: GPTSoVITSAPI, audioOutputDir: string, gptSovitsPath?: string);
    /**
     * 设置进度回调函数
     */
    setCallbacks(callbacks: {
        onTranslateProgress?: (completed: number, total: number, result: TranslateResult) => void;
        onVoiceProgress?: (completed: number, total: number, result: VoiceTask) => void;
        onError?: (error: Error, task: TranslateTask | VoiceTask) => void;
    }): void;
    /**
     * 限制并发执行的Promise工具函数
     */
    private limitConcurrency;
    /**
     * 执行单个翻译任务
     */
    private translateSingleTask;
    /**
     * 并发执行翻译任务
     */
    private translateTasks;
    /**
     * 将翻译结果加入语音合成队列
     */
    private enqueueVoiceSynthesis;
    /**
     * 处理语音合成队列（保持单线程以避免模型切换冲突）
     */
    private processVoiceQueue;
    /**
     * 执行语音合成
     */
    private synthesizeVoice;
    private characterConfigs?;
    /**
     * 处理翻译和语音合成任务（重构版本 - 使用翻译服务接口）
     */
    processTasksParallel(voiceTasks: VoiceTask[], characterConfigs: Map<string, CharacterVoiceConfig>, translateConfig: TranslateConfig, contextMap: Map<string, string>, gptSovitsPath?: string): Promise<VoiceTask[]>;
    /**
     * 清理资源
     */
    cleanup(): void;
}
export {};
//# sourceMappingURL=parallel-processor.d.ts.map