docs: Add project baseline architecture file and update README.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# Project Baseline: AI-Native CRM (Frontend)
|
||||
|
||||
## 🏗️ 全局架构 (Global Architecture)
|
||||
本项目是一个 **AI 原生 (AI-Native) CRM** 系统的客户端。
|
||||
- **核心理念**:通过 AI 驱动的消息流实现动态 UI 生成和业务处理。
|
||||
- **技术栈**:Next.js 15 (App Router) + Tailwind CSS + Lucide Icons。
|
||||
- **关键组件**:
|
||||
- `UniversalModuleRenderer.tsx`: 后端 AI 下发 UI 指令的监听与执行枢纽,负责实时绘制界面。
|
||||
- `DynamicForm.tsx`: 基于 JSON Schema 的动态表单渲染器,支持实体关联选择 (`x-link-entity`)。
|
||||
- `EntityDataPage`: 动态列表展示页面,通过 AI 代理执行编辑和删除操作。
|
||||
|
||||
## 💼 业务逻辑 (Business Logic)
|
||||
- **事实报告 (Fact Reporting)**:前端不直接调用保存接口,而是向 AI 报告“用户填写的业务事实”,由 AI 决定调用的工具。
|
||||
- **Session 维护**:从 `localStorage` 获取 `crm_user_id`,并通过 API Header `X-Creator-Id` 透传给后端实现数据隔离。
|
||||
|
||||
## 📈 当前开发进度 (Current Progress)
|
||||
- [x] **AI 动态 UI 渲染**:`UniversalModuleRenderer` 基础架构就绪。
|
||||
- [x] **动态表单与关联**:支持枚举、模式匹配及实体级联选择。
|
||||
- [x] **会话隔离适配**:前端已实现 Header 注入逻辑。
|
||||
- [x] **CORS 联调**:已完成与后端的跨域联调。
|
||||
|
||||
## ⚠️ 尚未解决的隐患 (Known Issues/Risks)
|
||||
- **状态同步**:多组件间由于 AI 异步返回导致的 UI 闪烁问题。
|
||||
- **离线能力**:目前完全依赖实时 AI 交互,缺乏离线暂存机制。
|
||||
|
||||
## 🚀 下一步计划 (Next Steps)
|
||||
1. **AI 智能搜索界面**:对接后端的 AI 增强搜索功能。
|
||||
2. **动态看板 (Dashboard)**:实现可视化图表的 AI 渲染支持。
|
||||
3. **引导流程优化**:提升用户通过对话创建新模块的体验。
|
||||
|
||||
---
|
||||
*Last Updated: 2026-03-25 by Antigravity*
|
||||
@@ -1,36 +1,53 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# AI-Native CRM Frontend
|
||||
|
||||
## Getting Started
|
||||
🎨 **AI 原生客户关系管理系统 - 前端界面**
|
||||
|
||||
First, run the development server:
|
||||
这是一个基于 [Next.js](https://nextjs.org/) 构建的现代化 CRM 界面,深度集成 AI 驱动的动态 UI 渲染引擎。
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
## 🌟 核心特性 (Key Features)
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
- **生成式 UI (Generative UI)**:集成 `UniversalModuleRenderer`,根据 AI 的指令实时绘制业务界面。
|
||||
- **动态表单 (Dynamic Form)**:支持 JSON Schema 驱动的复杂表单,具备实体关联选择功能。
|
||||
- **Copilot 深度集成**:内置 AI 助手,用户可通过对话直接创建页面、生成报表。
|
||||
- **低代码/零代码**:业务模型和界面布局完全由后端 AI 元数据驱动。
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
## 🛠️ 技术栈 (Tech Stack)
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
- **框架**: Next.js 15 (App Router)
|
||||
- **样式**: Tailwind CSS + Shadcn UI
|
||||
- **字体**: Geist (Vercel Typography)
|
||||
- **图标**: Lucide Icons
|
||||
- **交互**: CopilotKit React SDK
|
||||
|
||||
## Learn More
|
||||
## 🚀 快速开始 (Quick Start)
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
### 前置条件
|
||||
- Node.js 18+
|
||||
- 已安装 npm 或 yarn
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
### 运行应用
|
||||
1. 安装依赖:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
2. 配置环境变量:
|
||||
在根目录创建 `.env.local`,配置 API 地址:
|
||||
```env
|
||||
NEXT_PUBLIC_API_URL=http://localhost:8080
|
||||
```
|
||||
3. 启动开发服务器:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
## 📂 关键组件
|
||||
|
||||
## Deploy on Vercel
|
||||
- `src/components/UniversalModuleRenderer.tsx`: 万能渲染枢纽。
|
||||
- `src/components/DynamicForm.tsx`: 基于模式定义的动态表单。
|
||||
- `src/app/data/[entityCode]/page.tsx`: 动态列表展示页。
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
## 📈 当前进度与基准
|
||||
详细的功能实现状况请参阅:[.antigravity/BASELINE.md](.antigravity/BASELINE.md)
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
---
|
||||
*Created by Antigravity*
|
||||
|
||||
Reference in New Issue
Block a user