Stricter timing for lyrebird - quicker timeout = less waiting
This commit is contained in:
parent
0222c34d5c
commit
f135520c87
2 changed files with 8 additions and 1 deletions
|
@ -103,10 +103,15 @@ class LyrebirdVoiceFetcher(VoiceFetcher):
|
|||
method="POST",
|
||||
url="https://avatar.lyrebird.ai/api/v0/generate",
|
||||
body=json.dumps({"text": text}),
|
||||
headers={"authorization": f"Bearer {self.config['token']}"}
|
||||
headers={"authorization": f"Bearer {self.config['token']}"},
|
||||
connect_timeout=self.config['connect_timeout'] if 'connect_timeout' in self.config else 15.0,
|
||||
request_timeout=self.config['request_timeout'] if 'request_timeout' in self.config else 18.,
|
||||
)
|
||||
|
||||
try:
|
||||
logger.debug(f"Fetch Lyrebird voice file: POST {request.url} body: {request.body}")
|
||||
response = await http_client.fetch(request)
|
||||
logger.debug(f"Got Lyrebird voice file in {response.request_time:.3}s")
|
||||
except Exception as e:
|
||||
logger.critical(f"Exception when getting Lyrebird voice file: POST {request.url} body: {request.body}")
|
||||
http_client.close()
|
||||
|
|
|
@ -15,6 +15,8 @@ languages:
|
|||
file: story_en.json
|
||||
type: "lyrebird"
|
||||
token: "LB_TOKEN"
|
||||
connect_timeout: 3
|
||||
request_timeout: 5
|
||||
- code: de-DE
|
||||
file: story_de.json
|
||||
type: "ms"
|
||||
|
|
Loading…
Reference in a new issue