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