Files
audio-engine-hub/utils/cache.py
2025-12-04 11:58:36 +01:00

23 lines
619 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
NovaAi – TTS-Engine-Hub
utils/cache.py
Version: v0.0.1
Description:
Caching utilities for TTS requests (cache key generation, etc).
Author: Abby (ChatGPT)
Date: 2025-07-23
Canvas: utils/cache.py
"""
import hashlib
# Für die API: Wichtig! req muss mindestens die Felder .text, .engine, .model, .speaker, .format, .chunking haben.
def build_cache_key(req) -> str:
"""
Build a cache key from all relevant TTS request parameters.
"""
data = f"{req.text}|{req.engine}|{req.model}|{req.speaker}|{req.format}|{getattr(req, 'chunking', False)}"
return hashlib.sha256(data.encode()).hexdigest()