Update utils.py

Updated typing time calculation to use global configuration for typing delays.
pull/1477/head
A0000Xz 2026-01-03 16:35:45 +08:00 committed by GitHub
parent 881df0c8bf
commit f8216a689e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -524,15 +524,15 @@ def process_llm_response(text: str, enable_splitter: bool = True, enable_chinese
def calculate_typing_time( def calculate_typing_time(
input_string: str, input_string: str,
thinking_start_time: float, thinking_start_time: float,
chinese_time: float = 0.3, chinese_time: float = global_config.response_typing.typing_delay_per_chinese_char,
english_time: float = 0.15, english_time: float = global_config.response_typing.typing_delay_per_english_char,
is_emoji: bool = False, is_emoji: bool = False,
) -> float: ) -> float:
""" """
计算输入字符串所需的时间中文和英文字符有不同的输入时间 计算输入字符串所需的时间中文和英文字符有不同的输入时间
input_string (str): 输入的字符串 input_string (str): 输入的字符串
chinese_time (float): 中文字符的输入时间默认为0.2 chinese_time (float): 中文字符的输入时间默认配置为0.3
english_time (float): 英文字符的输入时间默认为0.1 english_time (float): 英文字符的输入时间默认配置为0.1
is_emoji (bool): 是否为emoji默认为False is_emoji (bool): 是否为emoji默认为False
特殊情况 特殊情况