fix(lexiannot): ValueError

This commit is contained in:
wumode
2025-12-22 18:01:19 +08:00
parent d98902e536
commit 00d3346dfc
2 changed files with 6 additions and 10 deletions

View File

@@ -1592,7 +1592,7 @@ class LexiAnnot(_PluginBase):
使用等长的空格替换文本中的 (xxx) 模式。
例如:"(Hi)" 会被替换成 " " (4个空格)
"""
pattern = r"(\(.*?\)|\[.*?\])"
pattern = r"(\([^()]*\)|\[[^\[\]]*\])"
return re.sub(pattern, lambda match: " " * len(match.group(1)), _text)
styles = {}
@@ -1654,9 +1654,9 @@ class LexiAnnot(_PluginBase):
if weights is None:
weights = {"times": 0.5, "text_size": 0.4, "duration": 0.1}
matching_styles = []
max_times = max([analysis.get("times", 0) for _, analysis in analysis.items() if analysis]) or 1
max_text_size = max([analysis.get("text_size", 0) for _, analysis in analysis.items() if analysis]) or 1
max_duration = max([analysis.get("duration", 0) for _, analysis in analysis.items() if analysis]) or 1
max_times = max([analysis.get("times", 0) for _, analysis in analysis.items() if analysis] or [0]) or 1
max_text_size = max([analysis.get("text_size", 0) for _, analysis in analysis.items() if analysis] or [0]) or 1
max_duration = max([analysis.get("duration", 0) for _, analysis in analysis.items() if analysis] or [0]) or 1
for style, analysis in analysis.items():
if not analysis:
continue

View File

@@ -14,9 +14,7 @@ class VocabularyAnnotatingTool(MoviePilotTool):
# 工具名称
name: str = "vocabulary_annotating_tool"
# 工具描述
description: str = (
"Add new vocabulary annotation task to plugin LexiAnnot's task queue."
)
description: str = "Add new vocabulary annotation task to plugin LexiAnnot's task queue."
# 输入参数模型
args_schema: Type[BaseModel] = VocabularyAnnotatingToolInput
@@ -74,9 +72,7 @@ class QueryAnnotationTasksTool(MoviePilotTool):
# 工具名称
name: str = "query_annotation_tasks_tool"
# 工具描述
description: str = (
"Query the latest vocabulary annotation tasks from plugin LexiAnnot."
)
description: str = "Query the latest vocabulary annotation tasks from plugin LexiAnnot."
# 输入参数模型
args_schema: Type[BaseModel] = QueryAnnotationTasksToolInput