refactor: route agent llm settings through runtime

This commit is contained in:
jxxghp
2026-08-23 02:49:00 +08:00
parent 1ede083fb2
commit 41ee5aacdc
8 changed files with 24 additions and 17 deletions
+3 -1
View File
@@ -12,7 +12,9 @@ from pathlib import Path
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
from uuid import uuid4 from uuid import uuid4
from app.runtime.config import settings from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger from app.runtime.log import logger
from app.adapters.network.http import RequestUtils from app.adapters.network.http import RequestUtils
+3 -1
View File
@@ -11,7 +11,9 @@ from urllib.parse import urlsplit
from langchain_core.messages import AIMessage, AIMessageChunk from langchain_core.messages import AIMessage, AIMessageChunk
from app.agent.llm.gateway import resolve_llm_provider_runtime from app.agent.llm.gateway import resolve_llm_provider_runtime
from app.runtime.config import settings from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.log import logger from app.runtime.log import logger
if TYPE_CHECKING: if TYPE_CHECKING:
+3 -1
View File
@@ -20,7 +20,9 @@ import aiofiles
import httpx import httpx
import jwt import jwt
from app.runtime.config import settings from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.configuration import get_configured_system_config as SystemConfigOper from app.application.configuration import get_configured_system_config as SystemConfigOper
from app.runtime.log import logger from app.runtime.log import logger
from app.schemas.types import LlmProviderAction, SystemConfigKey from app.schemas.types import LlmProviderAction, SystemConfigKey
+3 -1
View File
@@ -68,7 +68,9 @@ from app.agent.tools.impl.mcp import (
) )
from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool from app.agent.tools.impl.query_system_settings import QuerySystemSettingsTool
from app.chain.agent import AgentChain from app.chain.agent import AgentChain
from app.runtime.config import settings from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.runtime.events import eventmanager from app.runtime.events import eventmanager
from app.runtime.observability import record_metric from app.runtime.observability import record_metric
from app.application.plugin.runtime import get_plugin_manager from app.application.plugin.runtime import get_plugin_manager
+3 -1
View File
@@ -17,7 +17,9 @@ from app.agent.policy.sanitizer import (
) )
from app.agent.tools.tags import ToolTag from app.agent.tools.tags import ToolTag
from app.chain import ChainBase from app.chain import ChainBase
from app.runtime.config import settings from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.application.messaging.agent import matches_channel_admin from app.application.messaging.agent import matches_channel_admin
from app.runtime.extensions.service_config import ServiceConfigHelper from app.runtime.extensions.service_config import ServiceConfigHelper
from app.runtime.log import logger from app.runtime.log import logger
@@ -1048,6 +1048,8 @@ runtime provider,旧插件或测试替换模块级 `settings` 时仍保持原
查询装饰器由 112 个降至 106 个,插件数据与事务专项测试及架构基线通过。 查询装饰器由 112 个降至 106 个,插件数据与事务专项测试及架构基线通过。
Agent 能力适配器、记忆和提示词模块改用 `RuntimeSettingsCompat` 动态运行时端口,保留模块级覆盖和 Agent 能力适配器、记忆和提示词模块改用 `RuntimeSettingsCompat` 动态运行时端口,保留模块级覆盖和
导入早期回退;配置债务由 101 个文件降至 98 个,Agent 能力、提示词与运行时专项测试通过。 导入早期回退;配置债务由 101 个文件降至 98 个,Agent 能力、提示词与运行时专项测试通过。
随后将 LLM capability/helper/provider、Agent orchestrator 和工具基础类统一切换到同一动态运行时端口;
配置债务由 98 个文件降至 93 个,LLM、Agent 生命周期与工具专项测试通过。
同日修正适配器配置下沉边界:OCR、CookieCloud、DoH、Rust 和资源签名等低层实现不再直接依赖 同日修正适配器配置下沉边界:OCR、CookieCloud、DoH、Rust 和资源签名等低层实现不再直接依赖
`app.application`,由 `app.runtime.settings` 端口承接组合根注入;未启动装配时仍回退旧 Settings ABI `app.application`,由 `app.runtime.settings` 端口承接组合根注入;未启动装配时仍回退旧 Settings ABI
@@ -9,15 +9,10 @@
"root": "app" "root": "app"
}, },
"settings_imports": { "settings_imports": {
"count": 98, "count": 93,
"files": [ "files": [
"app/adapters/system/fsproxy.py", "app/adapters/system/fsproxy.py",
"app/agent/llm/capability.py",
"app/agent/llm/helper.py",
"app/agent/llm/provider.py",
"app/agent/orchestrator.py",
"app/agent/skills/registry.py", "app/agent/skills/registry.py",
"app/agent/tools/base.py",
"app/agent/tools/impl/_plugin_tool_utils.py", "app/agent/tools/impl/_plugin_tool_utils.py",
"app/agent/tools/impl/_terminal_session.py", "app/agent/tools/impl/_terminal_session.py",
"app/agent/tools/impl/add_download_tasks.py", "app/agent/tools/impl/add_download_tasks.py",
+6 -6
View File
@@ -14,7 +14,7 @@
"workflow_to_db": [] "workflow_to_db": []
}, },
"edge_count": 6419, "edge_count": 6419,
"edge_sha256": "d5ae653cf616d76dfefea690bb71c32f54b07612af9c5c9cd4372ac6b55b6cae", "edge_sha256": "91e14e6acb6220fccd8ac3e2df899303f4e4fe6532c92079378d4b350be4d06e",
"edges": [ "edges": [
"app -> app.runtime", "app -> app.runtime",
"app -> app.runtime.compat", "app -> app.runtime.compat",
@@ -199,10 +199,10 @@
"app.agent.llm.capability -> app.agent.llm", "app.agent.llm.capability -> app.agent.llm",
"app.agent.llm.capability -> app.agent.llm.helper", "app.agent.llm.capability -> app.agent.llm.helper",
"app.agent.llm.capability -> app.runtime", "app.agent.llm.capability -> app.runtime",
"app.agent.llm.capability -> app.runtime.config",
"app.agent.llm.capability -> app.runtime.extensions", "app.agent.llm.capability -> app.runtime.extensions",
"app.agent.llm.capability -> app.runtime.extensions.service_config", "app.agent.llm.capability -> app.runtime.extensions.service_config",
"app.agent.llm.capability -> app.runtime.log", "app.agent.llm.capability -> app.runtime.log",
"app.agent.llm.capability -> app.runtime.settings",
"app.agent.llm.capability -> app.schemas", "app.agent.llm.capability -> app.schemas",
"app.agent.llm.capability -> app.schemas.notification", "app.agent.llm.capability -> app.schemas.notification",
"app.agent.llm.capability -> app.schemas.types", "app.agent.llm.capability -> app.schemas.types",
@@ -211,8 +211,8 @@
"app.agent.llm.helper -> app.agent.llm.gateway", "app.agent.llm.helper -> app.agent.llm.gateway",
"app.agent.llm.helper -> app.agent.llm.server_tools", "app.agent.llm.helper -> app.agent.llm.server_tools",
"app.agent.llm.helper -> app.runtime", "app.agent.llm.helper -> app.runtime",
"app.agent.llm.helper -> app.runtime.config",
"app.agent.llm.helper -> app.runtime.log", "app.agent.llm.helper -> app.runtime.log",
"app.agent.llm.helper -> app.runtime.settings",
"app.agent.llm.provider -> app.agent", "app.agent.llm.provider -> app.agent",
"app.agent.llm.provider -> app.agent.llm", "app.agent.llm.provider -> app.agent.llm",
"app.agent.llm.provider -> app.agent.llm.helper", "app.agent.llm.provider -> app.agent.llm.helper",
@@ -221,8 +221,8 @@
"app.agent.llm.provider -> app.foundation", "app.agent.llm.provider -> app.foundation",
"app.agent.llm.provider -> app.foundation.singleton", "app.agent.llm.provider -> app.foundation.singleton",
"app.agent.llm.provider -> app.runtime", "app.agent.llm.provider -> app.runtime",
"app.agent.llm.provider -> app.runtime.config",
"app.agent.llm.provider -> app.runtime.log", "app.agent.llm.provider -> app.runtime.log",
"app.agent.llm.provider -> app.runtime.settings",
"app.agent.llm.provider -> app.schemas", "app.agent.llm.provider -> app.schemas",
"app.agent.llm.provider -> app.schemas.types", "app.agent.llm.provider -> app.schemas.types",
"app.agent.mcp -> app.adapters", "app.agent.mcp -> app.adapters",
@@ -352,10 +352,10 @@
"app.agent.orchestrator -> app.foundation", "app.agent.orchestrator -> app.foundation",
"app.agent.orchestrator -> app.foundation.identity", "app.agent.orchestrator -> app.foundation.identity",
"app.agent.orchestrator -> app.runtime", "app.agent.orchestrator -> app.runtime",
"app.agent.orchestrator -> app.runtime.config",
"app.agent.orchestrator -> app.runtime.events", "app.agent.orchestrator -> app.runtime.events",
"app.agent.orchestrator -> app.runtime.log", "app.agent.orchestrator -> app.runtime.log",
"app.agent.orchestrator -> app.runtime.observability", "app.agent.orchestrator -> app.runtime.observability",
"app.agent.orchestrator -> app.runtime.settings",
"app.agent.orchestrator -> app.schemas", "app.agent.orchestrator -> app.schemas",
"app.agent.orchestrator -> app.schemas.event", "app.agent.orchestrator -> app.schemas.event",
"app.agent.orchestrator -> app.schemas.message", "app.agent.orchestrator -> app.schemas.message",
@@ -422,10 +422,10 @@
"app.agent.tools.base -> app.application.messaging.agent", "app.agent.tools.base -> app.application.messaging.agent",
"app.agent.tools.base -> app.chain", "app.agent.tools.base -> app.chain",
"app.agent.tools.base -> app.runtime", "app.agent.tools.base -> app.runtime",
"app.agent.tools.base -> app.runtime.config",
"app.agent.tools.base -> app.runtime.extensions", "app.agent.tools.base -> app.runtime.extensions",
"app.agent.tools.base -> app.runtime.extensions.service_config", "app.agent.tools.base -> app.runtime.extensions.service_config",
"app.agent.tools.base -> app.runtime.log", "app.agent.tools.base -> app.runtime.log",
"app.agent.tools.base -> app.runtime.settings",
"app.agent.tools.base -> app.schemas", "app.agent.tools.base -> app.schemas",
"app.agent.tools.base -> app.schemas.message", "app.agent.tools.base -> app.schemas.message",
"app.agent.tools.base -> app.schemas.types", "app.agent.tools.base -> app.schemas.types",