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),