fix: auto-fix code issues (cron)

- 修复重复导入/字段
- 修复异常处理(将裸 except: 改为具体异常类型)
- 修复PEP8格式问题
- 添加类型注解
This commit is contained in:
OpenClaw Bot
2026-02-28 00:11:06 +08:00
parent d767f0dddc
commit a7ecf6f0ea
7 changed files with 12 additions and 14 deletions

View File

@@ -374,7 +374,7 @@ class FullTextSearch:
# 排序和分页
scored_results.sort(key=lambda x: x.score, reverse=True)
return scored_results[offset : offset + limit]
return scored_results[offset: offset + limit]
def _parse_boolean_query(self, query: str) -> dict:
"""
@@ -574,7 +574,7 @@ class FullTextSearch:
return None
return row["project_id"] if row else None
except Exception:
except (sqlite3.Error, KeyError):
return None
def _score_results(self, results: list[dict], parsed_query: dict) -> list[SearchResult]:
@@ -1078,7 +1078,7 @@ class SemanticSearch:
metadata={},
)
)
except Exception:
except (KeyError, ValueError):
continue
results.sort(key=lambda x: x.similarity, reverse=True)