mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 12:05:54 +00:00
refactor(types): remove quoted annotations under postponed evaluation
This commit is contained in:
@@ -25,7 +25,7 @@ def _get_box_config(ap) -> dict:
|
||||
return config_data.get('box', {})
|
||||
|
||||
|
||||
def resolve_box_ws_relay_url(ap: 'core_app.Application') -> str:
|
||||
def resolve_box_ws_relay_url(ap: core_app.Application) -> str:
|
||||
"""Derive the ws relay base URL used for managed-process attach."""
|
||||
runtime_url = str(_get_box_config(ap).get('runtime_url', '')).strip()
|
||||
if runtime_url:
|
||||
@@ -39,7 +39,7 @@ def resolve_box_ws_relay_url(ap: 'core_app.Application') -> str:
|
||||
class BoxRuntimeConnector:
|
||||
"""Connect to the Box runtime via action RPC (stdio or ws)."""
|
||||
|
||||
def __init__(self, ap: 'core_app.Application'):
|
||||
def __init__(self, ap: core_app.Application):
|
||||
self.ap = ap
|
||||
self.configured_runtime_url = self._load_configured_runtime_url()
|
||||
self.manages_local_runtime = self._should_manage_local_runtime()
|
||||
|
||||
@@ -39,7 +39,7 @@ if TYPE_CHECKING:
|
||||
class BoxService:
|
||||
def __init__(
|
||||
self,
|
||||
ap: 'core_app.Application',
|
||||
ap: core_app.Application,
|
||||
client: BoxRuntimeClient | None = None,
|
||||
output_limit_chars: int = 4000,
|
||||
):
|
||||
@@ -77,7 +77,7 @@ class BoxService:
|
||||
async def execute_spec_payload(
|
||||
self,
|
||||
spec_payload: dict,
|
||||
query: 'pipeline_query.Query',
|
||||
query: pipeline_query.Query,
|
||||
*,
|
||||
skip_host_mount_validation: bool = False,
|
||||
) -> dict:
|
||||
@@ -105,7 +105,7 @@ class BoxService:
|
||||
)
|
||||
return self._serialize_result(result)
|
||||
|
||||
async def execute_sandbox_tool(self, parameters: dict, query: 'pipeline_query.Query') -> dict:
|
||||
async def execute_sandbox_tool(self, parameters: dict, query: pipeline_query.Query) -> dict:
|
||||
spec_payload = dict(parameters)
|
||||
spec_payload.setdefault('session_id', str(query.query_id))
|
||||
return await self.execute_spec_payload(spec_payload, query)
|
||||
@@ -365,7 +365,7 @@ class BoxService:
|
||||
|
||||
# ── Observability ─────────────────────────────────────────────────
|
||||
|
||||
def _record_error(self, exc: Exception, query: 'pipeline_query.Query'):
|
||||
def _record_error(self, exc: Exception, query: pipeline_query.Query):
|
||||
self._recent_errors.append(
|
||||
{
|
||||
'timestamp': _dt.datetime.now(_UTC).isoformat(),
|
||||
|
||||
@@ -29,17 +29,17 @@ class RequestRunner(abc.ABC):
|
||||
|
||||
name: str = None
|
||||
|
||||
ap: 'app.Application'
|
||||
ap: app.Application
|
||||
|
||||
pipeline_config: dict
|
||||
|
||||
def __init__(self, ap: 'app.Application', pipeline_config: dict):
|
||||
def __init__(self, ap: app.Application, pipeline_config: dict):
|
||||
self.ap = ap
|
||||
self.pipeline_config = pipeline_config
|
||||
|
||||
@abc.abstractmethod
|
||||
async def run(
|
||||
self, query: 'pipeline_query.Query'
|
||||
) -> typing.AsyncGenerator['provider_message.Message | provider_message.MessageChunk', None]:
|
||||
self, query: pipeline_query.Query
|
||||
) -> typing.AsyncGenerator[provider_message.Message | provider_message.MessageChunk, None]:
|
||||
"""运行请求"""
|
||||
pass
|
||||
|
||||
@@ -30,9 +30,9 @@ class ToolLoader(abc.ABC):
|
||||
|
||||
name: str = None
|
||||
|
||||
ap: 'app.Application'
|
||||
ap: app.Application
|
||||
|
||||
def __init__(self, ap: 'app.Application'):
|
||||
def __init__(self, ap: app.Application):
|
||||
self.ap = ap
|
||||
|
||||
async def initialize(self):
|
||||
|
||||
@@ -18,13 +18,13 @@ importutil.import_modules_in_pkg(loaders)
|
||||
class ToolManager:
|
||||
"""LLM工具管理器"""
|
||||
|
||||
ap: 'app.Application'
|
||||
ap: app.Application
|
||||
|
||||
native_tool_loader: native_loader.NativeToolLoader
|
||||
plugin_tool_loader: plugin_loader.PluginToolLoader
|
||||
mcp_tool_loader: mcp_loader.MCPLoader
|
||||
|
||||
def __init__(self, ap: 'app.Application'):
|
||||
def __init__(self, ap: app.Application):
|
||||
self.ap = ap
|
||||
|
||||
async def initialize(self):
|
||||
|
||||
Reference in New Issue
Block a user