first commit
This commit is contained in:
22
utils/cache.py
Normal file
22
utils/cache.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""
|
||||
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()
|
||||
Reference in New Issue
Block a user