Skip to content

Commit

Permalink
补充本地问答-文本&助播的 [1|2]语法支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikaros-521 committed May 18, 2024
1 parent 8ad3a8b commit 91e835a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ def audio_synthesis_handle(self, data_json):
# 使用字典进行字符串替换
if any(var in tmp for var in variables):
tmp = tmp.format(**{var: value for var, value in variables.items() if var in tmp})

# [1|2]括号语法随机获取一个值,返回取值完成后的字符串
tmp = My_handle.common.brackets_text_randomize(tmp)

logging.info(f"助播 本地问答库-文本回答为: {tmp}")

Expand Down Expand Up @@ -671,6 +674,9 @@ def local_qa_handle(self, data):
if any(var in tmp for var in variables):
tmp = tmp.format(**{var: value for var, value in variables.items() if var in tmp})

# [1|2]括号语法随机获取一个值,返回取值完成后的字符串
tmp = My_handle.common.brackets_text_randomize(tmp)

logging.info(f"本地问答库-文本回答为: {tmp}")

resp_content = tmp
Expand Down

0 comments on commit 91e835a

Please sign in to comment.