fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -204,15 +204,13 @@ class LLMClient:
|
||||
messages = [ChatMessage(role="user", content=prompt)]
|
||||
content = await self.chat(messages, temperature=0.1)
|
||||
|
||||
import re
|
||||
|
||||
json_match = re.search(r"\{{.*?\}}", content, re.DOTALL)
|
||||
if not json_match:
|
||||
return {"intent": "unknown", "explanation": "无法解析指令"}
|
||||
|
||||
try:
|
||||
return json.loads(json_match.group())
|
||||
except BaseException:
|
||||
except (json.JSONDecodeError, KeyError, TypeError):
|
||||
return {"intent": "unknown", "explanation": "解析失败"}
|
||||
|
||||
async def analyze_entity_evolution(self, entity_name: str, mentions: list[dict]) -> str:
|
||||
|
||||
Reference in New Issue
Block a user