feat(y-log): 操作日志上报(前端直连 + 后端公开只读下发地址)
- 后端新增 y_log 公开只读配置:YLogConfig + AppConfig.y_log + GET /api/public/config/y-log,地址写在 config.yaml(mtime 热重载) - 前端核心 src/core/log/:writeYLog(双门控/异步即发即忘/永不抛错/ 去ip-host/对象序列化裁剪/optResult恒0)+ 配置加载 + token1 隔离存取 - 登录(token)持久化 token1 并报登录、登出先报后清;启动预热配置 - 各 API client 成功路径埋点:敏感词/菜单/按钮/技能地址/轻应用、 会商草稿+任务草稿+后台任务、智能体/定时任务/知识库、Word导出, 以及问答完成钩子(ChatPage/AgentChatPage onFinish) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
dd942cdd60
commit
d2be3b206d
26 files changed
+808
-40
No files matched your search
@@ -26,3 +26,10 @@ async def get_task_deeplink_config() -> dict:
|
||||
"""返回 ``config.yaml`` 的 ``task_deeplink`` 段(含 test/delete_test/各 URL/mock)。"""
|
||||
config = get_app_config()
|
||||
return config.task_deeplink.model_dump()
|
||||
|
||||
|
||||
@router.get("/y-log")
|
||||
async def get_y_log_config() -> dict:
|
||||
"""返回 ``config.yaml`` 的 ``y_log`` 段(enabled / write_url),无密钥,公开只读。"""
|
||||
config = get_app_config()
|
||||
return config.y_log.model_dump()
|
||||
@@ -39,6 +39,7 @@ from deerflow.config.token_usage_config import TokenUsageConfig
|
||||
from deerflow.config.tool_config import ToolConfig, ToolGroupConfig
|
||||
from deerflow.config.tool_search_config import ToolSearchConfig, load_tool_search_config_from_dict
|
||||
from deerflow.config.vision_config import VisionConfig
|
||||
from deerflow.config.y_log_config import YLogConfig
|
||||
|
||||
load_dotenv()
|
||||
|
||||
@@ -141,6 +142,7 @@ class AppConfig(BaseModel):
|
||||
knowledge: KnowledgeConfig = Field(default_factory=KnowledgeConfig, description="Product knowledge base (obsidian-wiki compatible vault) configuration")
|
||||
knowledge_ingest: KnowledgeIngestConfig = Field(default_factory=KnowledgeIngestConfig, description="External knowledge-ingest endpoint configuration")
|
||||
task_deeplink: TaskDeeplinkConfig = Field(default_factory=TaskDeeplinkConfig, description="任务深链(rwfx)目的树闸门与跳转地址配置(前端经 /api/public/config/task-deeplink 读取)")
|
||||
y_log: YLogConfig = Field(default_factory=YLogConfig, description="操作日志上报配置(前端经 /api/public/config/y-log 读取)")
|
||||
|
||||
@classmethod
|
||||
def resolve_config_path(cls, config_path: str | None = None) -> Path:
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
"""操作日志(Y-Log)上报配置。
|
||||
|
||||
前端经公开只读接口 ``GET /api/public/config/y-log`` 读取本段(地址 + 开关),
|
||||
据此决定是否把用户的关键操作上报到外部日志接口。段内只有地址与开关,无密钥,
|
||||
公开只读。仿 :mod:`deerflow.config.log_system_config` 的写法。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class YLogConfig(BaseModel):
|
||||
"""操作日志(Y-Log)上报配置:前端经 /api/public/config/y-log 读取。"""
|
||||
|
||||
enabled: bool = Field(default=False, description="是否启用操作日志上报")
|
||||
write_url: str = Field(
|
||||
default="",
|
||||
description="日志上报外部接口完整地址(POST),如 https://ch1.b.uat.4.cn/api/y-log/write",
|
||||
)
|
||||
@@ -308,6 +308,14 @@ log_system:
|
||||
url: "https://your-log-system.example.com"
|
||||
label: "日志系统"
|
||||
|
||||
# ───────────────────────────────────────────────────────────────────────────
|
||||
# 操作日志(Y-Log)上报:前端直连外部接口记录用户的关键操作(审计/统计)。
|
||||
# 仅在「token 登录」(存在 token1)时上报;前端经公开只读接口
|
||||
# GET /api/public/config/y-log 读取本段,改这里即时生效(Gateway mtime 热重载)。
|
||||
y_log:
|
||||
enabled: true
|
||||
write_url: https://ch1.b.uat.4.cn/api/y-log/write
|
||||
|
||||
summarization:
|
||||
# 开关已移到聊天框下方(参考文献下面)的「上下文压缩」按钮,默认关闭。
|
||||
# 这里 enabled 仅作为非 Web 路径(渠道/定时任务)的后备开关;下面的 trigger/keep
|
||||
|
||||
Reference in new issue
Block a user