feat: 工具系统迁移 + 重型插件骨架 + 前端交互增强
- 工具系统从 kilostar/plugin/tool_plugin/ 迁移到 data/toolset/(manifest.json 声明式) - 新增 plugin_runtime 模块:BaseOrganization / GlobalPluginManager / loader / tool_bridge - 新增 org_task + org_task_event 表及 DAO(alembic 0009) - 新增 /api/v1/plugin 路由(submit/status/stream/install/reload) - 新增 data/plugin/example_dept 示例重型插件 - regulatory_node 支持聊天历史上下文注入 - send_file 改为 artifact 存盘 + SSE 推送下载链接 - 前端 WorkflowFileCard 组件 + ToolSettings README 渲染 - utils 整理:合并 access/role_check、standalone_proxy→ray_compat、删除废弃模块 - 项目结构文档移至 docs/STRUCTURE.md 并详细展开 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,9 @@ class AppSettings(BaseSettings):
|
||||
kilostar_mode: str = "distributed"
|
||||
kilostar_lang: str = "zh"
|
||||
kilostar_cors_origins: str = ""
|
||||
kilostar_plugin_dir: str = ""
|
||||
kilostar_toolset_dir: str = ""
|
||||
kilostar_artifact_dir: str = ""
|
||||
|
||||
db: DatabaseSettings = Field(default_factory=DatabaseSettings)
|
||||
security: SecuritySettings = Field(default_factory=SecuritySettings)
|
||||
@@ -53,3 +56,46 @@ class AppSettings(BaseSettings):
|
||||
@lru_cache(maxsize=1)
|
||||
def get_settings() -> AppSettings:
|
||||
return AppSettings()
|
||||
|
||||
|
||||
def get_plugin_dir() -> "pathlib.Path":
|
||||
"""返回插件根目录路径(包含 tool_plugin/ 和 skill/ 子目录)。
|
||||
|
||||
优先使用环境变量 KILOSTAR_PLUGIN_DIR,否则默认 <project_root>/data/plugin/。
|
||||
"""
|
||||
import pathlib
|
||||
|
||||
custom = get_settings().kilostar_plugin_dir
|
||||
if custom:
|
||||
return pathlib.Path(custom)
|
||||
project_root = pathlib.Path(__file__).parent.parent.parent
|
||||
return project_root / "data" / "plugin"
|
||||
|
||||
|
||||
def get_toolset_dir() -> "pathlib.Path":
|
||||
"""返回工具集根目录路径(包含各 toolset 子目录,如 base_toolset/)。
|
||||
|
||||
优先使用环境变量 KILOSTAR_TOOLSET_DIR,否则默认 <project_root>/data/toolset/。
|
||||
"""
|
||||
import pathlib
|
||||
|
||||
custom = get_settings().kilostar_toolset_dir
|
||||
if custom:
|
||||
return pathlib.Path(custom)
|
||||
project_root = pathlib.Path(__file__).parent.parent.parent
|
||||
return project_root / "data" / "toolset"
|
||||
|
||||
|
||||
def get_artifact_dir() -> "pathlib.Path":
|
||||
"""返回工作流产物(agent 通过 send_file 推送的文件)存放根目录。
|
||||
|
||||
优先使用环境变量 KILOSTAR_ARTIFACT_DIR,否则默认 <project_root>/data/artifact/。
|
||||
每个 trace_id 一个子目录,下载链接走 /api/v1/resource/artifact/{trace_id}/{aid}。
|
||||
"""
|
||||
import pathlib
|
||||
|
||||
custom = get_settings().kilostar_artifact_dir
|
||||
if custom:
|
||||
return pathlib.Path(custom)
|
||||
project_root = pathlib.Path(__file__).parent.parent.parent
|
||||
return project_root / "data" / "artifact"
|
||||
|
||||
Reference in New Issue
Block a user