005ce566a8
- Provider model_settings (Provider+Model 级别参数配置): DB JSONB → API → GSM → AgentFactory.resolve → 三节点 agent.run 注入 - 新增 data/toolset/regulatory_toolset/: 监管节点专属工具(query_workflow_status / query_task_list / send_file) - send_file 从 interactive_toolset 迁移至 regulatory_toolset,interactive 仅保留 approval - mcp_helper 合入 GlobalPluginManager dispatch tools - 前端 Provider 弹窗参数设置区加 JSON 编辑器(model_settings) - 前端 Plugin 页面新增"重型插件"Tab(HeavyPluginList 占位) - .gitignore 精简:去除系统默认项,修复 data/ 子目录追踪 - data/toolset/ 与 data/plugin/ 首次纳入版本控制 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
24 lines
704 B
Python
24 lines
704 B
Python
async def file_reader(file_path: str) -> str:
|
|
"""读取本地文件的内容。
|
|
|
|
Args:
|
|
file_path: 文件的绝对路径或相对路径
|
|
|
|
Returns:
|
|
文件内容文本,若文件不存在则返回错误信息
|
|
"""
|
|
from kilostar.utils.sandbox import validate_path, PathViolation
|
|
|
|
try:
|
|
file_path = validate_path(file_path, write=False)
|
|
except PathViolation as e:
|
|
return f"[Sandbox] {e}"
|
|
|
|
try:
|
|
with open(file_path, "r", encoding="utf-8") as f:
|
|
return f.read()
|
|
except FileNotFoundError:
|
|
return f"[Error] File not found: {file_path}"
|
|
except Exception as e:
|
|
return f"[Error] Failed to read file: {str(e)}"
|