flying-hero 7be35039ed 🔧 修改端口:避免与会议厅冲突
变更:
- 前端:3000 → 4000
- 后端:8000 → 9000

原因:
- 会议厅使用 3000/8000
- 避免端口冲突

新访问地址:
- 前端:http://localhost:4000
- 后端 API: http://localhost:9000/api/
2026-04-04 18:20:02 +08:00
2026-04-04 18:20:02 +08:00
2026-04-03 19:14:21 +08:00
2026-04-03 19:14:21 +08:00
2026-04-03 19:14:21 +08:00
2026-04-03 19:14:21 +08:00
2026-04-03 19:14:21 +08:00
2026-04-04 18:20:02 +08:00
2026-04-03 19:14:21 +08:00

Agent Diary 🤖

AI Agent 日记管理系统 | 工作记忆隔离 | RAG 支持

License: MIT Python 3.12 React 18 PostgreSQL


📖 项目介绍

Agent Diary 是一个专为 AI 助手设计的日记和工作记忆管理系统。

核心功能

  • 多 AI Agent 实例管理
  • 日记系统(成长之路)
  • 工作记忆隔离
  • 日历视图
  • 标签和分类
  • RAG 支持(预留 embedding 字段)

适用场景

  • AI 助手开发者管理多个 Agent 实例
  • OpenClaw/AutoGen/LangChain 用户
  • 个人知识库管理
  • 团队协作和知识共享

🚀 快速开始

方法 1: Docker Compose推荐

# 1. 克隆项目
git clone https://github.com/yourusername/agent-diary.git
cd agent-diary

# 2. 复制环境变量
cp .env.example .env

# 3. 启动服务
docker-compose up -d

# 4. 访问应用
# 前端http://localhost:3000
# 后端 API: http://localhost:8000/api/agents/

方法 2: 本地开发

后端

cd code/backend

# 创建虚拟环境
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 安装依赖
pip install -r requirements.txt

# 数据库迁移
python manage.py migrate

# 启动服务
python manage.py runserver 0.0.0.0:8000

前端

cd code/frontend

# 安装依赖
npm install

# 启动开发服务器
npm start

📊 功能展示

多 Agent 管理

curl http://localhost:8000/api/agents/

响应示例:

[
  {
    "id": 1,
    "name": "飞行侠",
    "emoji": "🦸",
    "specialty": "主力/通用",
    "port": 18789
  },
  {
    "id": 2,
    "name": "道童",
    "emoji": "☯️",
    "specialty": "道德经注解",
    "port": 18889
  }
]

日记系统

每个 Agent 可以记录:

  • 成长之路:学习心得、成长记录
  • 工作记忆:日常工作、任务进展
  • 技术笔记:技术总结、问题解决

🗄️ 数据库配置

SQLite开发环境

# .env
DATABASE_URL=sqlite:///db.sqlite3

PostgreSQL生产环境

# .env
DATABASE_URL=postgresql://user:pass@localhost:5432/agent_diary_db

📝 API 文档

Agent 相关

端点 方法 说明
/api/agents/ GET 获取所有 Agent
/api/agents/<id>/ GET 获取 Agent 详情
/api/agents/<id>/memory/dates/ GET 获取工作记忆日期
/api/agents/<id>/memory/<date>/ GET 获取工作记忆内容
/api/agents/<id>/diary/dates/ GET 获取日记日期
/api/agents/<id>/diary/<date>/ GET 获取日记内容

🏗️ 技术架构

后端

  • Django 4.x
  • Django REST Framework
  • PostgreSQL / SQLite

前端

  • React 18
  • React Router 6
  • Axios

部署

  • Docker
  • Docker Compose

📂 项目结构

agent-diary/
├── code/
│   ├── backend/          # Django 后端
│   │   ├── agents/       # Agent 模型
│   │   ├── api/          # API 视图
│   │   └── manage.py
│   └── frontend/         # React 前端
│       ├── src/
│       │   ├── components/
│       │   └── pages/
│       └── package.json
├── docker-compose.yml
├── .env.example
├── README.md
└── requirements.txt

🔧 配置说明

环境变量

变量名 说明 默认值
WORKSPACE_BASE 工作区基础路径 /home/node/.openclaw/workspace
DATABASE_URL 数据库连接 URL -
SECRET_KEY Django 密钥 -
DEBUG 调试模式 True
POSTGRES_DB PostgreSQL 数据库名 agent_diary_db
POSTGRES_USER PostgreSQL 用户名 agent_user
POSTGRES_PASSWORD PostgreSQL 密码 agent2026

🤝 贡献指南

欢迎提交 Issue 和 Pull Request

  1. Fork 项目
  2. 创建特性分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

📄 开源协议

本项目采用 MIT 协议开源 - 查看 LICENSE 文件了解详情。


🙏 致谢

感谢所有贡献者和使用者!


Made with ❤️ by Agent Diary Team

Description
No description provided
Readme MIT 1 MiB
Languages
JavaScript 62.7%
Python 34.1%
Shell 2.5%
Dockerfile 0.4%
HTML 0.3%