Yasin

Yasin

Css常用单位速查表

读取 ,行 1 到 80

读取 ,行 1 到 80

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取

读取 ,行 1 到 20

读取

[我严格遵守规则]

下面是 AgentVerse 项目的完整结构与作用梳理:


项目概述

AgentVerse 是一个多 AI 智能体协作对话的开源平台,支持多个 AI 专家自主交流、讨论,提供多角度专业见解。前端基于 React 19 + Vite + TypeScript,后端使用 Cloudflare Pages Functions + D1 数据库,部署在 Cloudflare Pages 上。


整体架构图

架构图

目录详解

1. 根目录配置文件

文件 作用
package.json 项目依赖与脚本(dev/build/deploy/test/i18n 等)
vite.config.ts Vite 构建配置
tsconfig.json TypeScript 配置
wrangler.toml Cloudflare Pages 部署配置(D1 数据库绑定、域名等)
eslint.config.js ESLint 代码规范
pnpm-workspace.yaml pnpm monorepo 工作空间配置

2. src — 前端源码

core — 核心架构层(与 UI 无关的纯逻辑)

采用 Presenter → Manager → Store/Repository 分层架构:

层级 目录 作用
Presenter presenter 单例入口,只暴露 Manager 属性,供 UI 层消费
Managers managers 业务逻辑核心:Agent 管理、讨论管理、消息管理、导航、活动栏等
Stores stores 基于 RxJS 的响应式状态容器(agents/discussions/messages/navigation 等)
Repositories repositories 数据访问层:持久化读写(IndexedDB、API 调用、AI 客户端)
Hooks hooks React hooks,桥接 core 层与 UI 层(useDiscussion/useMessages/useAuth 等)
Bootstrap bootstrap 应用及 Agent 初始化引导
Config config 配置常量(AI 设置、i18n、guide 场景等)
Utils utils 通用工具函数(认证客户端、消息处理、错误工具等)

数据流向:UI → Hook → Presenter.manager → Store (状态) / Repository (持久化)

common — 跨端共享层

目录 作用
components/ui/ 基础 UI 组件(基于 Radix UI + shadcn/ui 风格)
components/layout/ 布局组件
features/agents/ Agent 创建/编辑/列表
features/chat/ 聊天核心 UI(消息列表、输入框、Markdown 渲染等)
features/discussion/ 讨论房间管理
features/auth/ 登录/注册/邮箱验证
features/home/ 首页/引导页
features/world-class-chat/ 增强版聊天(HTML 预览等)
features/all-in-one-agent/ 一体化 Agent 体验

desktop — 桌面端专属

目录 作用
features/chat/ 桌面端聊天布局适配
features/agents/ 桌面端 Agent 相关 UI
features/file-manager/ 基于 LightningFS 的文件管理系统
features/indexeddb/ IndexedDB 数据管理/调试

mobile — 移动端专属

目录 作用
features/chat/ 移动端聊天 UI 适配

3. functions — 后端 (Cloudflare Pages Functions)

目录/文件 作用
api/auth/ 认证相关 API(邮箱验证、登录、会话管理)
_lib/ 后端工具库(配置、加密、邮件、HTTP、会话、校验)
_types.ts 后端类型定义

4. packages — 内部 Monorepo 包

包名 作用
rx-nested-bean RxJS 嵌套响应式 Bean 工具库(状态管理辅助)
@cardos/service-bus-portal 跨上下文通信系统(Web Worker / iframe / Shared Worker / Service Worker 间通信)

5. migrations — 数据库迁移

0001_auth.sql — Cloudflare D1 数据库认证表迁移脚本。

6. docs — 文档

目录 作用
architecture/ 系统架构设计文档
development/ 开发指南与功能设计
logs/ 迭代日志(按版本号组织)
workflows/ 开发工作流规范
prompts/ AI prompt 实验
根文件 Agent 行为、MCP 集成、i18n、开发计划等专题文档

7. 其他

目录/文件 作用
commands Agent 指令定义(/commit/validate 等)
scripts 辅助脚本(i18n 覆盖率检查、代码度量等)
public 静态资源(iframe-portal、worker-portal)
screenshots 项目截图

核心分层架构总结

UI 层 (desktop/mobile/common features)
  ↓ 调用
Hooks 层 (core/hooks — useDiscussion, useMessages...)
  ↓ 读取
Presenter 单例 (core/presenter — 只暴露 Manager)
  ↓ 包含
Manager 层 (core/managers — 业务编排)
  ↓ 读写
Store 层 (core/stores — RxJS 响应式状态)
Repository 层 (core/repositories — 持久化/API)

关键约束

  • Repository 只能在 Manager 层访问,UI/Hook 不可直接依赖
  • Presenter 只暴露 Manager 属性,不暴露方法或其他属性
  • UI 组件不依赖业务逻辑,通过 hooks 桥接