fix: improve name matching logic in _voice_reply_with_name function
deploy / deploy (push) Successful in 31s
deploy / deploy (push) Successful in 31s
This commit is contained in:
@@ -611,10 +611,10 @@ def _voice_reply_with_name(language: str, reply_text: str, name: str | None) ->
|
|||||||
normalized_short = _voice_text_key(short_name)
|
normalized_short = _voice_text_key(short_name)
|
||||||
if reply_text.startswith(prefix):
|
if reply_text.startswith(prefix):
|
||||||
rest = reply_text[len(prefix) :].lstrip()
|
rest = reply_text[len(prefix) :].lstrip()
|
||||||
if _voice_text_key(rest).startswith(normalized_short):
|
if normalized_short in _voice_text_key(rest).split(" "):
|
||||||
return reply_text
|
return reply_text
|
||||||
return f"{prefix}{short_name}, {rest}"
|
return f"{prefix}{short_name}, {rest}"
|
||||||
if _voice_text_key(reply_text).startswith(normalized_short):
|
if normalized_short in _voice_text_key(reply_text).split(" "):
|
||||||
return reply_text
|
return reply_text
|
||||||
return f"{short_name}, {reply_text}"
|
return f"{short_name}, {reply_text}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user