diff --git a/tweet/__pycache__/topic_generator.cpython-312.pyc b/tweet/__pycache__/topic_generator.cpython-312.pyc index 504ca61..76c56c4 100644 Binary files a/tweet/__pycache__/topic_generator.cpython-312.pyc and b/tweet/__pycache__/topic_generator.cpython-312.pyc differ diff --git a/tweet/__pycache__/topic_parser.cpython-312.pyc b/tweet/__pycache__/topic_parser.cpython-312.pyc index 2421d48..8d199bf 100644 Binary files a/tweet/__pycache__/topic_parser.cpython-312.pyc and b/tweet/__pycache__/topic_parser.cpython-312.pyc differ diff --git a/tweet/topic_generator.py b/tweet/topic_generator.py index c2ebdee..309431e 100644 --- a/tweet/topic_generator.py +++ b/tweet/topic_generator.py @@ -146,3 +146,4 @@ class TopicGenerator: return topics + \ No newline at end of file diff --git a/tweet/topic_parser.py b/tweet/topic_parser.py index e434fe3..4be3fb8 100644 --- a/tweet/topic_parser.py +++ b/tweet/topic_parser.py @@ -47,6 +47,7 @@ class TopicParser: # 验证每个选题是否包含所有必需的键 valid_topics = [] required_keys = {"index", "date", "logic", "object", "product", "style", "target_audience"} + optional_keys = {"product_logic", "style_logic", "target_audience_logic"} for i, item in enumerate(parsed_json): if isinstance(item, dict) and required_keys.issubset(item.keys()): diff --git a/utils/__pycache__/file_io.cpython-312.pyc b/utils/__pycache__/file_io.cpython-312.pyc index fd6f2e9..7e098a1 100644 Binary files a/utils/__pycache__/file_io.cpython-312.pyc and b/utils/__pycache__/file_io.cpython-312.pyc differ diff --git a/utils/file_io.py b/utils/file_io.py index 947ed54..7d4afbe 100644 --- a/utils/file_io.py +++ b/utils/file_io.py @@ -202,14 +202,12 @@ def process_llm_json_text(text: Any) -> Optional[Dict[str, Any]]: for candidate in json_candidates: # 直接尝试解析 try: - import json return json.loads(candidate) except json.JSONDecodeError: pass # 使用json_repair尝试修复 try: - import json_repair return json_repair.loads(candidate) except Exception: continue