Merge branch 'dev' of https://github.com/MoFox-Studio/MoFox_Bot into dev
This commit is contained in:
@@ -956,16 +956,11 @@ def filter_system_format_content(content: str | None) -> str:
|
||||
cleaned_content = cleaned_content[last_bracket_index + 1 :].strip()
|
||||
|
||||
# 在处理完回复格式后,再清理其他简单的格式
|
||||
# 移除表情包格式:[表情包:xxx]
|
||||
cleaned_content = re.sub(r"\[表情包:[^\]]*\]", "", cleaned_content)
|
||||
# 移除图片格式:[图片:xxx]
|
||||
cleaned_content = re.sub(r"\[图片:[^\]]*\]", "", cleaned_content)
|
||||
# 新增:移除所有残余的 [...] 格式,例如 [at=...] 等
|
||||
cleaned_content = re.sub(r"\[.*?\]", "", cleaned_content)
|
||||
|
||||
# 移除@格式:@<xxx>
|
||||
cleaned_content = re.sub(r"@<[^>]*>", "", cleaned_content)
|
||||
# [表情包(描述生成失败)] 等错误格式
|
||||
cleaned_content = re.sub(r"\[表情包\([^)]*\)\]", "", cleaned_content)
|
||||
# [图片(描述生成失败)] 等错误格式
|
||||
cleaned_content = re.sub(r"\[图片\([^)]*\)\]", "", cleaned_content)
|
||||
|
||||
# 记录过滤操作
|
||||
if cleaned_content != original_content.strip():
|
||||
|
||||
@@ -46,12 +46,12 @@ def generate_cache_key(
|
||||
|
||||
if args:
|
||||
args_str = ",".join(str(arg) for arg in args)
|
||||
args_hash = hashlib.md5(args_str.encode()).hexdigest()[:8]
|
||||
args_hash = hashlib.sha256(args_str.encode()).hexdigest()[:8]
|
||||
cache_key_parts.append(f"args:{args_hash}")
|
||||
|
||||
if kwargs:
|
||||
kwargs_str = ",".join(f"{k}={v}" for k, v in sorted(kwargs.items()))
|
||||
kwargs_hash = hashlib.md5(kwargs_str.encode()).hexdigest()[:8]
|
||||
kwargs_hash = hashlib.sha256(kwargs_str.encode()).hexdigest()[:8]
|
||||
cache_key_parts.append(f"kwargs:{kwargs_hash}")
|
||||
|
||||
return ":".join(cache_key_parts)
|
||||
|
||||
Reference in New Issue
Block a user