Hacker News showcase using tegg
npm i
npm run dev
open http://localhost:7001/Don't tsc compile at development mode, if you had run tsc then you need to npm run clean before npm run dev.
npm run tsc
npm start- Use
npm run lintto check code style - Use
npm testto run unit test - se
npm run cleanto clean compiled js at development mode once
- Node.js >= 18.x
- Typescript >= 5.x
系统支持Agent短期记忆和长期记忆功能,增强对话连贯性和个性化体验。
-
短期记忆:
- 存储在内存中,针对当前会话
- 用于维持会话上下文和临时状态
- 随会话结束而清除
-
长期记忆:
- 存储在数据库中,持久化保存
- 用于记住用户偏好、事实和重要信息
- 在会话中被检索并加入到对话上下文
系统提供以下API接口管理Agent记忆:
GET /api/agent-memories- 获取Agent的长期记忆POST /api/agent-memories- 添加或更新长期记忆DELETE /api/agent-memories- 删除长期记忆POST /api/agent-memories/short-term/clear- 清除短期记忆POST /api/agent-memories/process- 从对话中提取记忆
- 用户发送消息时,系统检索相关长期记忆
- 相关记忆和RAG检索结果一起加入到Agent的系统提示中
- 对话完成后,系统自动分析对话内容,提取重要信息存入长期记忆
- 记忆按重要性和最近访问时间排序,确保优先使用最相关的信息
- 使用内存Map存储短期记忆
- 使用MySQL数据库存储长期记忆
- 通过LLM分析确定记忆的重要性和相关性
- 实现按需检索,只加载与当前对话相关的记忆