Skip to content

Commit

Permalink
判断typing.TYPE_CHECKING来处理编译器检查
Browse files Browse the repository at this point in the history
  • Loading branch information
xiabo0816 committed May 1, 2024
1 parent c95bde7 commit 8c520b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion erniebot-agent/src/erniebot_agent/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import logging
from typing import (
TYPE_CHECKING,
Any,
AsyncIterator,
Dict,
Expand Down Expand Up @@ -298,7 +299,8 @@ async def _run_stream(
This method should yield a sequence of (AgentStep, List[Message]) tuples based on the given
prompt and optionally accompanying files.
"""
if False:
if TYPE_CHECKING:
# HACK
# This conditional block is strictly for static type-checking purposes (e.g., mypy)
# and will not be executed.
only_for_mypy_type_check: Tuple[AgentStep, List[Message]] = (DEFAULT_FINISH_STEP, [])
Expand Down

0 comments on commit 8c520b2

Please sign in to comment.