From 06b5d380d5c4b288afc06d3621b8726da465c062 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 2 Sep 2026 20:30:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20mypy=20=E4=B8=89=E5=A4=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BF=AE=E6=AD=A3=EF=BC=88lastrowid=20=E7=9B=B4?= =?UTF-8?q?=E8=B5=8B=20/=20json.loads=20=E6=94=B6=E7=AA=84=20/=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=A4=B1=E6=95=88=20ignore=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/easy_tdx/ai/llm.py | 3 ++- src/easy_tdx/web/llm_history_store.py | 2 +- src/easy_tdx/web/routers/llm.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/easy_tdx/ai/llm.py b/src/easy_tdx/ai/llm.py index 1ab0f4d..44fc960 100644 --- a/src/easy_tdx/ai/llm.py +++ b/src/easy_tdx/ai/llm.py @@ -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 diff --git a/src/easy_tdx/web/llm_history_store.py b/src/easy_tdx/web/llm_history_store.py index d928416..f6534f3 100644 --- a/src/easy_tdx/web/llm_history_store.py +++ b/src/easy_tdx/web/llm_history_store.py @@ -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]: diff --git a/src/easy_tdx/web/routers/llm.py b/src/easy_tdx/web/routers/llm.py index ef85627..f3ce782 100644 --- a/src/easy_tdx/web/routers/llm.py +++ b/src/easy_tdx/web/routers/llm.py @@ -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),