feat: productionize learning engine and classroom
This commit is contained in:
@@ -50,25 +50,25 @@ const KNOWN_TTS_PROVIDERS: TTSProviderId[] = [
|
||||
];
|
||||
|
||||
/** Resolve the default TTS provider: env override, else first configured. */
|
||||
export function resolveQaTtsProvider(): TTSProviderId | undefined {
|
||||
function resolveQaTtsProvider(): TTSProviderId | undefined {
|
||||
const configured = process.env.QA_TTS_PROVIDER;
|
||||
if (configured) return configured as TTSProviderId;
|
||||
return KNOWN_TTS_PROVIDERS.find((id) => isServerConfiguredProvider('tts', id));
|
||||
}
|
||||
|
||||
export interface TtsCacheKey {
|
||||
interface TtsCacheKey {
|
||||
providerId: string;
|
||||
voice: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export function ttsCacheKey(input: TtsCacheKey): string {
|
||||
function ttsCacheKey(input: TtsCacheKey): string {
|
||||
return createHash('sha256')
|
||||
.update(`${input.providerId}|${input.voice}|${input.text}`)
|
||||
.digest('hex');
|
||||
}
|
||||
|
||||
export function ttsCachePath(key: string, format: string): string {
|
||||
function ttsCachePath(key: string, format: string): string {
|
||||
return path.join(TTS_CACHE_DIR, `${key}.${format}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user