Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
8efac17
Merge pull request #1 from derisk-ai/feat/aisre
csunny May 27, 2025
bd49f80
Docs: add features and architecture introduction (#2)
csunny May 28, 2025
2828582
chore: add vedio link (#5)
csunny Jun 3, 2025
7d5d3ec
fix the new_max_token for deepseek-0528 (#8)
csunny Jun 8, 2025
5e7739f
chore: add default scene (#9)
csunny Jun 13, 2025
fb517e1
adjust pylint (#10)
csunny Jun 13, 2025
bf3276f
feat: add claude llms and dynamic model choose (#14)
csunny Jun 15, 2025
854ba7a
fix: remove extra unuseful code (#16)
csunny Jun 18, 2025
3002716
fix: optimize desc and ignore file (#17)
csunny Jun 18, 2025
4e3ae4c
style: fix markdown symbols (#18)
anotherso1a Jun 20, 2025
ef11230
Reduce the problem of undefined global variables (#23)
dusx1981 Jun 24, 2025
10322cb
feat: add tongyi proxy model (#25)
csunny Jun 28, 2025
611c846
feat: add roadmap for openderisk (#26)
csunny Jul 1, 2025
715e2cb
feat:add storage client cache (#27)
Aries-ckt Jul 7, 2025
f6d7e40
feat: fix mysql table schema error and add aisre eval script (#28)
csunny Jul 10, 2025
086bc40
Feature mcp web (#33)
heyzcat Jul 28, 2025
34c89e5
fix: the parameter passing bug when connecting to mcp (#43)
gallopxiong Jul 30, 2025
a6f27e1
Dev/open derisk v0.2.2 (#47)
yhjun1026 Aug 26, 2025
30665a3
feat: open derisk clean temp file (#49)
yhjun1026 Aug 26, 2025
eb516e5
Dev/fix default model (#50)
yhjun1026 Aug 26, 2025
aa4f84a
docs: add docs for how to use (#51)
csunny Aug 27, 2025
2de39c7
feat: optimize the dialogue entry code logic (#52)
yhjun1026 Aug 27, 2025
49ac83d
feat: chat bug fixed (#53)
XinyueDu Aug 27, 2025
cbcba1c
feat: workflow node-version change (#54)
XinyueDu Aug 28, 2025
963c5ad
feat: fixed stop chat (#55)
XinyueDu Aug 29, 2025
e55f24c
feat: web theme & prompt edit fixed (#56)
XinyueDu Aug 29, 2025
263209d
feat: mcp (#61)
XinyueDu Sep 3, 2025
2e3b6e2
feat: add new vis components config file (#63)
XinyueDu Sep 5, 2025
a172578
docs: add Japanese README (#64)
eltociear Sep 6, 2025
92b85b3
docs: add deepwiki for OpenDerisk v0.2 (#65)
csunny Sep 8, 2025
8205c47
feat: fixed Agent update loading (#66)
XinyueDu Sep 11, 2025
4f589fb
fix:batch process embeddings while call OpenAI embedding API (#68)
lpq131004 Sep 16, 2025
be2c3aa
feat: Website i18n Translation (#69)
XinyueDu Sep 17, 2025
001a1f9
feat: add-knowledge-chunk (#70)
XinyueDu Sep 18, 2025
859e8da
feat: add mcp server registry and call features (#71)
csunny Sep 18, 2025
1685476
feat: add mermaid (#72)
XinyueDu Sep 19, 2025
a01badc
feat: build mcp frontend & fix agents translate (#73)
csunny Sep 19, 2025
73a7ff4
Feat/fix kn (#74)
yhjun1026 Sep 20, 2025
a5f46f2
Feat/fix kn (#75)
yhjun1026 Sep 21, 2025
c644d23
fix:reasoning agent find knowledge empty. (#76)
Aries-ckt Sep 22, 2025
63cca90
feat: add mcp (#78)
XinyueDu Sep 29, 2025
54f142f
docs: add docs for OpenDerisk v0.2 version (#80)
csunny Oct 13, 2025
7a4b88f
fix: mcp tool execute error (#82)
csunny Oct 14, 2025
396ab2c
docs: add Citation paper links
csunny Oct 16, 2025
a6384ae
docs: add Citation paper links (#85)
Aries-ckt Oct 16, 2025
deb1d47
feat/mcp: support resource (#86)
yhjun1026 Oct 18, 2025
272c507
fix/web file problem fix (#87)
yhjun1026 Oct 22, 2025
2f6bdc7
chore: add skills links (#90)
csunny Nov 19, 2025
cbd2562
fix: add kimi & ollama config (#91)
csunny Nov 27, 2025
f765807
fix: NoneType Error fixed (#93)
csunny Nov 27, 2025
78dc9cb
fix: no use of tongxi arg, will occure error when running (#96)
Lin-Zhipeng Feb 11, 2026
acc5a5c
v0.3 init (#97)
yhjun1026 Feb 24, 2026
74a7634
feat: update homepage slogan to 'You Command, We Defend' (#99)
csunny Feb 24, 2026
c694c20
feat: add /v1/chat/query endpoint for conversation state query (#101)
tptpp Feb 24, 2026
40d6431
feat: docker deploy support, vis optimization, and sidebar improvemen…
csunny Feb 24, 2026
6d25883
refactor: reorganize project root directory and update GUI title (#102)
csunny Feb 24, 2026
4d71fc9
fix: replace @alipay/tech-ui Iframe with native iframe (#104)
yhjun1026 Feb 24, 2026
8acd0e7
feat: add default MCP server sync from derisk-mcps repository (#103)
csunny Feb 25, 2026
ba63a08
feat: add curl install script for easy installation (#105)
csunny Feb 25, 2026
febbe72
feat: add chat_query API and enhance chat_completions with multiple w…
tptpp Feb 25, 2026
3b911fd
feat: add npm package for easy installation (#106)
csunny Feb 25, 2026
40fd50b
fix: resolve 'No module named derisk.__main__' error from install.sh …
csunny Feb 25, 2026
d152a9f
feat: add bun package for fast TypeScript-native installation (#108)
csunny Feb 25, 2026
bd94af6
feat: add homebrew formula for easy macOS installation (#107)
csunny Feb 25, 2026
d696c75
feat: Agent Builder UI redesign — layout, source distinction, chat cl…
csunny Feb 25, 2026
c9bc38c
feat: optimize agents and add new features for v2.0 (#113)
yhjun1026 Feb 25, 2026
1d43b8c
Add agent creation modal with auto-select functionality (#114)
csunny Feb 26, 2026
6d6cf41
feat: Version 2.0 features and optimizations (#116)
yhjun1026 Feb 26, 2026
b0a72b5
feat: add cron schedule feature (#115)
tptpp Feb 26, 2026
8551f5a
Fix Skills Tab and restore chat UI elements (#118)
csunny Feb 26, 2026
dc30073
feat: add channel feature for notification integrations (#119)
tptpp Feb 26, 2026
08a5837
feat: optimize UI components and agent system (#117)
yhjun1026 Feb 26, 2026
d698d6e
fix: register ChannelServe and resolve SQLAlchemy DetachedInstanceErr…
tptpp Feb 26, 2026
e41bded
Refactor skill directory discovery with recursive search and deduplic…
csunny Feb 26, 2026
4c6db45
fix: MCP tool parameter passing issue (#123)
yhjun1026 Feb 27, 2026
bd628f2
docs: Add Discord badge to README (#125)
csunny Feb 27, 2026
619655c
fix: add generateStaticParams for channel [id] page to support static…
yhjun1026 Feb 27, 2026
ed357db
feat: Add MySQL DDL script for database initialization (#126)
yhjun1026 Feb 27, 2026
1202ca8
feat: Add Prometheus metrics endpoint for OpenDerisk observability (#…
RichardoMrMu Feb 27, 2026
90e9a6b
feat: add default skill auto-loading on startup and ReActMaster agent…
yhjun1026 Feb 27, 2026
6d7f926
feat: Agent optimization and refactor (#131)
yhjun1026 Feb 27, 2026
732e01d
feat: Agent optimization and performance improvements (#132)
yhjun1026 Feb 27, 2026
e87a750
feat: Enhance OpenTelemetry tracing with semantic conventions and err…
RichardoMrMu Feb 27, 2026
8895ac9
feat: Frontend optimization and enhance OpenTelemetry tracing (#133)
yhjun1026 Feb 27, 2026
fd941ac
cleanup(configs): remove unused configs and update OpenAI configurati…
csunny Feb 28, 2026
3db803e
feat: enhance agent system with no-tool-call handling and UI optimiza…
yhjun1026 Feb 28, 2026
84492f7
docs(readme): add installation section and update documentation (#135)
csunny Feb 28, 2026
a185961
feat: optimize agent system with enhanced LLM client and provider reg…
yhjun1026 Feb 28, 2026
7c885d9
feat(skills): add file rename support and fix delete issues (#139)
niiish32x Mar 5, 2026
dbaa472
feat(skills): add folder upload support for skill file management (…
niiish32x Mar 5, 2026
1747952
feat: Core V2 Agent System - Unified Tool Authorization & Scene Confi…
yhjun1026 Mar 5, 2026
4164b6a
refactor: optimize scene prompt formatting and selection sync logic (…
yhjun1026 Mar 5, 2026
22b7513
feat: Add Layer 4 Session History Manager for Cross-Conversation Cont…
yhjun1026 Mar 5, 2026
0b9ac06
feat(channel): add cron job message delivery via DingTalk/Feishu chan…
tptpp Mar 5, 2026
602b7c1
fix: inject correct skill path into agent context for sandbox and loc…
niiish32x Mar 6, 2026
0497556
Feat/product detail optimize (#146)
yhjun1026 Mar 9, 2026
3f90a72
docs: Add detailed uv installation guide in README files (#148)
csunny Mar 9, 2026
1751da7
fix(mcp): fix MCP update, delete, start/stop functionality (#149)
niiish32x Mar 9, 2026
82bfe1c
Feat/product detail optimize (#147)
yhjun1026 Mar 9, 2026
2c14cfe
Fix/process validation 2026 03 09 (#151)
yhjun1026 Mar 9, 2026
705d1cb
fix: handle non-JSON-serializable objects in MCP tool calls (#150)
niiish32x Mar 9, 2026
b4f4794
Fix/process validation 2026 03 09 (#152)
yhjun1026 Mar 9, 2026
2605134
feat: agent optimze
yhjun1026 Mar 9, 2026
5956d8d
feat: agent optimze
yhjun1026 Mar 9, 2026
e510df2
fix(agent): fix orphaned tool-role message causing API 400 errors (#153)
niiish32x Mar 9, 2026
4a03cf5
feat: agent optimze
yhjun1026 Mar 9, 2026
945cd19
Merge remote-tracking branch 'origin/main' into feature/logic-optimiz…
yhjun1026 Mar 9, 2026
f8c8327
feat(core_v2): implement distributed execution architecture (v7-v8)
yhjun1026 Mar 11, 2026
ff7e9ce
Merge branch 'opencode/hidden-cactus' into feature/verification-20260…
yhjun1026 Mar 11, 2026
9da1f00
feat(backend): apply schema and core backend updates (derisk SQL + Py…
yhjun1026 Mar 11, 2026
c8986ce
feat(frontend): update main app page, API client, and i18n assets
yhjun1026 Mar 11, 2026
ce43841
refactor: remove obsolete Next.js static chunks and stale build artif…
yhjun1026 Mar 11, 2026
c8c3e1f
refactor: optimize unified context and core v2 adapter implementation
yhjun1026 Mar 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/schema/derisk.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use derisk;
-- MySQL DDL Script for Derisk
-- Version: 0.3.0
-- Generated from SQLAlchemy ORM Models
-- Generated: 2026-03-09 22:38:05
-- Generated: 2026-03-11 09:51:58
-- ============================================================

SET NAMES utf8mb4;
Expand Down
248 changes: 248 additions & 0 deletions docs/architecture/FILE_IN_OUT_ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
📋 完整文件处理全流程梳理

一、整体架构图

┌─────────────────────────────────────────────────────────────────────────────┐
│ 用户上传文件 │
│ 前端 → POST /api/v1/files/{bucket} │
└───────────────────────────────────┬─────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ 文件分流决策层 │
│ derisk_serve/agent/nex/file_type_config.py │
│ │
│ ┌─────────────────┐ ┌─────────────────────────────┐ │
│ │ MODEL_DIRECT │ │ SANDBOX_TOOL │ │
│ │ (模型直消费) │ │ (沙箱工具处理) │ │
│ │ 图片/GIF等 │ │ 文档/代码/数据/压缩包 │ │
│ └────────┬────────┘ └──────────────┬──────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌─────────────────┐ ┌─────────────────────────────┐ │
│ │ 多模态模型输入 │ │ SandboxFileRef │ │
│ │ ChatCompletion │ │ 下载到沙箱工作目录 │ │
│ │ ContentPart │ │ 注册到AgentFileSystem │ │
│ └─────────────────┘ └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ 沙箱文件处理层 │
│ derisk/agent/core/file_system/ │
│ │
│ AgentFileSystem ────────────────────────────────────────────────────────── │
│ ├── FileStorageClient (优先) │
│ ├── OSS Client (回退) │
│ └── LocalFileStorage (最后回退) │
└───────────────────────────────────┬─────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ 工具生成文件 │
│ derisk/agent/core/sandbox/tools/ │
│ │
│ ├── create_file_tool.py (创建文件) │
│ ├── edit_file_tool.py (编辑文件) │
│ └── deliver_file_tool.py (交付文件) ⭐ │
└───────────────────────────────────┬─────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ 文件交付标记 │
│ deliver_file_tool.py + dattach_utils.py │
│ │
│ 1. 读取沙箱文件内容 │
│ 2. 上传到OSS获取持久化链接 │
│ 3. 生成d-attach组件 │
│ 4. 注册到AgentFileSystem │
└───────────────────────────────────┬─────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ 前端展示 │
│ VisDAttachList / d-attach-list 组件 │
│ │
│ ├── 预览功能 (preview_url) │
│ ├── 下载功能 (download_url) │
│ └── 批量下载 │
└─────────────────────────────────────────────────────────────────────────────┘
二、文件分流决策逻辑(核心)

关键文件: derisk_serve/agent/nex/file_type_config.py

class FileProcessMode(str, Enum):
MODEL_DIRECT = "model_direct" # 直接发送给模型
SANDBOX_TOOL = "sandbox_tool" # 通过沙箱工具处理

# 分流规则:
# MODEL_DIRECT: 图片类型
# SANDBOX_TOOL: 文档/代码/数据/压缩等
# 默认: SANDBOX_TOOL
分流触发点: derisk_serve/agent/nex/query_builder.py

def get_file_process_mode(file_name: str, mime_type: str) -> FileProcessMode:
# 根据扩展名和MIME类型返回处理模式

# 如果是 MODEL_DIRECT:
# → 返回 ChatCompletionContentPartImageParam
# → 直接作为多模态模型输入

# 如果是 SANDBOX_TOOL:
# → 返回 SandboxFileRef
# → 下载到沙箱工作目录
# → 注册到 AgentFileSystem
三、迁移核心文件清单

✅ 必须迁移(按优先级排序)

序号 文件路径 核心类/函数 职责
1 derisk-core/src/derisk/core/interface/file.py FileStorageClient, FileStorageSystem, StorageBackend, FileMetadata, FileStorageURI 文件存储抽象层核心
2 derisk-core/src/derisk/agent/core/file_system/agent_file_system.py AgentFileSystem Agent文件系统V3
3 derisk-core/src/derisk/agent/core/file_system/dattach_utils.py render_dattach, create_dattach_content d-attach组件生成
4 derisk-core/src/derisk/agent/core/sandbox/tools/deliver_file_tool.py execute_deliver_file 文件交付工具 ⭐
5 derisk-core/src/derisk/agent/core/sandbox_manager.py SandboxManager 沙箱生命周期管理
6 derisk-serve/src/derisk_serve/agent/nex/file_type_config.py FileProcessMode, get_file_process_mode 文件分流决策
7 derisk-serve/src/derisk_serve/agent/nex/query_builder.py QueryBuilder, SandboxFileRef 文件路由处理
8 derisk-serve/src/derisk_serve/file/api/endpoints.py upload_files, download_file 文件API端点
9 derisk-serve/src/derisk_serve/file/service/service.py Service.upload_files 文件服务层
10 derisk-serve/src/derisk_serve/file/api/schemas.py UploadFileResponse, FileMetadataResponse 数据模型
📦 按需迁移

文件路径 核心类/函数 职责
derisk-ext/src/derisk_ext/storage/file/oss/oss_storage.py AliyunOSSStorage 阿里云OSS存储
derisk-ext/src/derisk_ext/storage/file/ant_oss/oss_storage.py AntOSSStorage 蚂蚁OSS存储
derisk-ext/src/derisk_ext/storage/file/s3/s3_storage.py S3Storage S3存储
derisk-core/src/derisk/agent/core/sandbox/tools/create_file_tool.py execute_create_file 创建文件工具
derisk-core/src/derisk/agent/core/sandbox/tools/edit_file_tool.py execute_edit_file 编辑文件工具
derisk-core/src/derisk/agent/core/sandbox/tools/download_file_tool.py execute_download_file 下载文件工具
🔗 依赖文件

文件路径 核心类/函数 职责
derisk-core/src/derisk/agent/core/memory/gpts/file_base.py AgentFileMetadata, FileType 文件元数据模型
derisk-core/src/derisk/vis/schema.py VisAttachContent, VisAttachListContent 可视化数据模型
derisk-core/src/derisk/sandbox/client/file/client.py FileClient 沙箱文件客户端接口
derisk-core/src/derisk/sandbox/client/file/types.py FileInfo, OSSFile 文件类型定义
四、核心数据结构

1. FileMetadata(文件存储层)

@dataclass
class FileMetadata(StorageItem):
file_id: str # 文件ID
bucket: str # 存储桶
file_name: str # 文件名
file_size: int # 文件大小
storage_type: str # 存储类型
storage_path: str # 存储路径
uri: str # 统一资源标识
custom_metadata: Dict # 自定义元数据
file_hash: str # 文件哈希
2. AgentFileMetadata(Agent层)

class AgentFileMetadata:
file_id: str
conv_id: str # 会话ID
file_key: str # 文件键
file_name: str
file_type: FileType # CONCLUSION/DELIVERABLE/TOOL_OUTPUT等
oss_url: str # OSS地址
preview_url: str # 预览URL
download_url: str # 下载URL
mime_type: str
created_at: datetime
expires_at: datetime
3. FileType枚举

class FileType(str, Enum):
TEMP = "temp" # 临时文件
TOOL_OUTPUT = "tool_output" # 工具输出
TRUNCATED_OUTPUT = "truncated" # 截断输出
CONCLUSION = "conclusion" # 结论文件
DELIVERABLE = "deliverable" # 交付物 ⭐
KANBAN = "kanban"
WRITE_FILE = "write_file"
4. SandboxFileRef(分流层)

@dataclass
class SandboxFileRef:
file_name: str # 文件名
file_url: str # 文件URL
mime_type: str # MIME类型
object_path: str # OSS对象路径
sandbox_path: str # 沙箱本地路径
五、关键API接口

文件上传

POST /api/v1/files/{bucket}
Request: multipart/form-data (files[])
Response: List[UploadFileResponse]
- file_name, file_id, bucket, uri
文件下载

GET /api/v1/files/{bucket}/{file_id}
Response: StreamingResponse (application/octet-stream)
文件预览

GET /api/v1/files/preview?url={oss_url}
Response: Response (with Content-Type header)
文件元数据

GET /api/v1/files/metadata?uri={uri}
POST /api/v1/files/metadata/batch
Response: FileMetadataResponse
- file_name, file_id, bucket, uri, file_size
六、迁移步骤建议

第一步:迁移存储抽象层

# 1. 复制核心接口文件
derisk-core/src/derisk/core/interface/file.py

# 2. 选择存储后端实现
# 阿里云OSS
derisk-ext/src/derisk_ext/storage/file/oss/oss_storage.py
# 或 S3
derisk-ext/src/derisk_ext/storage/file/s3/s3_storage.py
第二步:迁移文件服务层

# API端点
derisk-serve/src/derisk_serve/file/api/endpoints.py
derisk-serve/src/derisk_serve/file/api/schemas.py

# 服务实现
derisk-serve/src/derisk_serve/file/service/service.py
第三步:迁移分流决策层

# 文件类型配置
derisk-serve/src/derisk_serve/agent/nex/file_type_config.py

# 路由处理
derisk-serve/src/derisk_serve/agent/nex/query_builder.py
第四步:迁移沙箱文件系统

# Agent文件系统
derisk-core/src/derisk/agent/core/file_system/agent_file_system.py
derisk-core/src/derisk/agent/core/file_system/dattach_utils.py

# 沙箱管理器
derisk-core/src/derisk/agent/core/sandbox_manager.py

# 文件工具
derisk-core/src/derisk/agent/core/sandbox/tools/deliver_file_tool.py
第五步:迁移前端组件

# Vis数据模型
derisk-core/src/derisk/vis/schema.py

# 前端组件(如需要)
web/src/components/chat/chat-content-components/VisComponents/VisDAttachList/
七、注意事项

依赖注入: FileStorageClient 需要通过 SystemApp 注册和获取
配置项: 需要配置OSS/S3的访问凭证和endpoint
沙箱环境: 如使用沙箱功能,需配置沙箱服务(XIC等)
URL生成: 确保存储后端支持生成公开访问URL(签名URL)
元数据存储: 需要配置数据库或内存存储文件元数据
文件类型扩展: 如需新增文件类型分流规则,修改 file_type_config.py
Loading
Loading