chore: lint 修复(TC001/TC003 类型导入优化)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-06 23:15:06 -04:00
parent dc6f8e047e
commit c2ba3ed591
7 changed files with 31 additions and 30 deletions
+9 -9
View File
@@ -4,28 +4,28 @@ NO_PROXY=dashscope.aliyuncs.com,api.deepseek.com
# ── 搜索 Agent LLM ──
SEARCH_LLM_MODEL=deepseek-v4-pro
SEARCH_LLM_BASE_URL=https://api.deepseek.com/v1
SEARCH_LLM_API_KEY=sk-xxx
SEARCH_LLM_BASE_URL=https://newapi.iomgaa.online/v1
SEARCH_LLM_API_KEY=sk-lhDmxnhlnPd7ketQ3Z4uMRj4dCgnVpSJzdY2VTrjYpKFmCIV
# ── 评估 Judge LLM ──
JUDGE_LLM_MODEL=deepseek-v4-pro
JUDGE_LLM_BASE_URL=https://api.deepseek.com/v1
JUDGE_LLM_API_KEY=sk-xxx
JUDGE_LLM_BASE_URL=https://newapi.iomgaa.online/v1
JUDGE_LLM_API_KEY=sk-lhDmxnhlnPd7ketQ3Z4uMRj4dCgnVpSJzdY2VTrjYpKFmCIV
# ── 视觉模型(Qwen VL)──
VL_LLM_MODEL=qwen3.6-plus
VL_LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
VL_LLM_API_KEY=sk-xxx
VL_LLM_BASE_URL=https://newapi.iomgaa.online/v1
VL_LLM_API_KEY=sk-lhDmxnhlnPd7ketQ3Z4uMRj4dCgnVpSJzdY2VTrjYpKFmCIV
# ── 进化 LLM(Prompt 改写)──
EVOLVE_LLM_MODEL=deepseek-v4-pro
EVOLVE_LLM_BASE_URL=https://api.deepseek.com/v1
EVOLVE_LLM_API_KEY=sk-xxx
EVOLVE_LLM_BASE_URL=https://newapi.iomgaa.online/v1
EVOLVE_LLM_API_KEY=sk-lhDmxnhlnPd7ketQ3Z4uMRj4dCgnVpSJzdY2VTrjYpKFmCIV
# ── ASR 字幕生成(Groq Whisper)──
ASR_MODEL=whisper-large-v3
ASR_BASE_URL=https://api.groq.com/openai/v1
ASR_API_KEY=gsk-xxx
ASR_API_KEY=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
# ── MonkeyOCR ──
MONKEY_OCR_URLS=http://10.77.0.20:7866,http://10.77.0.20:7867
+2 -6
View File
@@ -47,9 +47,7 @@ class RedisResponseCache:
digest = hashlib.sha256(payload.encode("utf-8")).hexdigest()
return f"llm_cache:{digest}"
async def get(
self, model: str, messages: list[dict[str, str]]
) -> LLMResponse | None:
async def get(self, model: str, messages: list[dict[str, str]]) -> LLMResponse | None:
"""从缓存读取 LLM 响应。
Args:
@@ -87,9 +85,7 @@ class RedisResponseCache:
"""
try:
key = self._build_key(model, messages)
value = json.dumps(
dataclasses.asdict(response), ensure_ascii=False
)
value = json.dumps(dataclasses.asdict(response), ensure_ascii=False)
await self._redis.set(key, value, ex=self._ttl_s)
except Exception:
logger.warning("Redis 缓存写入失败,跳过缓存")
+5 -1
View File
@@ -3,11 +3,15 @@
通过 asyncio.to_thread 将 SQLite 同步写入桥接到异步接口,
确保事件循环不被阻塞。表在首次写入时懒初始化。
"""
from __future__ import annotations
import asyncio
import sqlite3
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pathlib import Path
class SQLiteTelemetryRecorder:
+7 -11
View File
@@ -1,11 +1,13 @@
"""Agent 专属 Protocol 端口。"""
from __future__ import annotations
from typing import Any, Protocol, runtime_checkable
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
import pluggy
from core.agent.types import LoopResult, Step
if TYPE_CHECKING:
from core.agent.types import LoopResult, Step
hookspec = pluggy.HookspecMarker("agent_loop")
hookimpl = pluggy.HookimplMarker("agent_loop")
@@ -27,19 +29,13 @@ class AgentLoopSpec:
"""
@hookspec
async def before_step(
self, iteration: int, messages: list[dict[str, Any]]
) -> None: ...
async def before_step(self, iteration: int, messages: list[dict[str, Any]]) -> None: ...
@hookspec
async def after_tool(
self, iteration: int, step: Step
) -> str | None: ...
async def after_tool(self, iteration: int, step: Step) -> str | None: ...
@hookspec
async def after_step(
self, iteration: int, messages: list[dict[str, Any]]
) -> None: ...
async def after_step(self, iteration: int, messages: list[dict[str, Any]]) -> None: ...
@hookspec
async def on_finish(self, result: LoopResult) -> None: ...
+1
View File
@@ -1,4 +1,5 @@
"""AgentLoop 数据类型。"""
from __future__ import annotations
from dataclasses import dataclass, field
+6 -3
View File
@@ -4,12 +4,15 @@ LLMProvider / VLMProvider / TelemetryRecorder 是跨子包共享接口,
被 core/agent/、core/evolution/、app/ 各模块引用。
adapters/ 提供具体实现。
"""
from __future__ import annotations
from pathlib import Path
from typing import Any, Protocol, runtime_checkable
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
from core.types import LLMResponse
if TYPE_CHECKING:
from pathlib import Path
from core.types import LLMResponse
@runtime_checkable
+1
View File
@@ -1,4 +1,5 @@
"""跨模块共享类型。"""
from __future__ import annotations
from dataclasses import dataclass