mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 14:34:18 +08:00
fix(ci): mypy 三处类型修正(lastrowid 直赋 / json.loads 收窄 / 移除失效 ignore)
This commit is contained in:
@@ -244,7 +244,8 @@ def _post_json(
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
||||
return json.loads(resp.read().decode("utf-8"))
|
||||
data: dict[str, Any] = json.loads(resp.read().decode("utf-8"))
|
||||
return data
|
||||
except urllib.error.HTTPError as exc:
|
||||
body = exc.read().decode("utf-8", errors="replace")[:500]
|
||||
raise LlmError(f"LLM API HTTP {exc.code}: {body}", status=exc.code) from exc
|
||||
|
||||
@@ -133,7 +133,7 @@ class LlmHistoryStore:
|
||||
rec.end_date,
|
||||
),
|
||||
)
|
||||
rec.id = int(cur.lastrowid)
|
||||
rec.id = cur.lastrowid
|
||||
return rec
|
||||
|
||||
def list_all(self, limit: int = 50) -> list[LlmHistoryRecord]:
|
||||
|
||||
@@ -111,7 +111,7 @@ async def get_llm_config() -> dict[str, Any]:
|
||||
if preset.needs_key and not cfg.api_key:
|
||||
missing.append("api_key")
|
||||
except ValueError as exc:
|
||||
resolved = cfg # type: ignore[assignment]
|
||||
resolved = cfg
|
||||
missing = [str(exc)]
|
||||
return {
|
||||
"config": cfg.to_dict(mask_api_key=True),
|
||||
|
||||
Reference in New Issue
Block a user