Commit Graph

162 Commits

Author SHA1 Message Date
朱潮
f1107ea35a 增加enable_thinking和enable_memory 2026-01-28 17:13:41 +08:00
朱潮
3dc119bca8 refactor(mem0): optimize connection pool and async memory handling
- Fix mem0 connection pool exhausted error with proper pooling
- Convert memory operations to async tasks
- Optimize docker-compose configuration
- Add skill upload functionality
- Reduce cache size for better performance
- Update dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:39:12 +08:00
朱潮
99755ceab5 remove settingsetting 2026-01-21 10:38:29 +08:00
朱潮
b53174ae9f 需要 openai_api_key的环境变量 2026-01-21 08:38:06 +08:00
朱潮
f694101747 refactor: migrate from Memori to Mem0 for long-term memory
Replace Memori with Mem0 for memory management:
- Delete memori_config.py, memori_manager.py, memori_middleware.py
- Add mem0_config.py, mem0_manager.py, mem0_middleware.py
- Update environment variables (MEMORI_* -> MEM0_*)
- Integrate Mem0 with LangGraph middleware
- Add sync connection pool for Mem0 in DBPoolManager
- Move checkpoint message prep to config creation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 21:15:30 +08:00
朱潮
4d6ee6ae0c fix: pass db_url to init_global_memori
Add db_url property to MemoriManager that falls back to
CHECKPOINT_DB_URL setting, and pass it explicitly from
fastapi_app.py to ensure Memori can create sync connections.

This fixes the error "Either db_pool or db_url must be provided"
when recalling memories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 08:27:34 +08:00
朱潮
455a48409d feat: integrate Memori long-term memory system
Add Memori (https://github.com/MemoriLabs/Memori) integration for
persistent cross-session memory capabilities in both create_agent
and create_deep_agent.

## New Files

- agent/memori_config.py: MemoriConfig dataclass for configuration
- agent/memori_manager.py: MemoriManager for connection and instance management
- agent/memori_middleware.py: MemoriMiddleware for memory recall/storage
- tests/: Unit tests for Memori components

## Modified Files

- agent/agent_config.py: Added enable_memori, memori_semantic_search_top_k, etc.
- agent/deep_assistant.py: Integrated MemoriMiddleware into init_agent()
- utils/settings.py: Added MEMORI_* environment variables
- pyproject.toml: Added memori>=3.1.0 dependency

## Features

- Semantic memory search with configurable top-k and threshold
- Multi-tenant isolation (entity_id=user, process_id=bot, session_id)
- Memory injection into system prompt
- Background asynchronous memory augmentation
- Graceful degradation when Memori is unavailable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 00:12:43 +08:00
朱潮
05744cb9f4 批量保存聊天记录 2026-01-19 09:44:57 +08:00
朱潮
f9ba3c8e51 添加聊天记录查询 2026-01-18 12:29:20 +08:00
朱潮
20d5e96986 feat: 添加 PostgreSQL 支持用于 checkpoint 存储
- 添加 postgres:16-alpine 服务配置
- 配置 CHECKPOINT_DB_URL 环境变量
- 添加服务依赖和健康检查

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 00:32:23 +08:00
朱潮
90117b41fe 修复符号链接的问题,和deep_agent提示词 2026-01-13 14:22:44 +08:00
朱潮
b93c40d5a5 merge 2026-01-08 23:10:09 +08:00
朱潮
d45079ca55 feat: 将system_prompt解析从markdown代码块改为XML标签格式
- agent_config.py: enable_thinking判断从 ```guideline 改为 <guidelines>
- fastapi_utils.py:
  - preamble解析从 ```preamble``` 改为 <preamble>
  - guidelines/tools/scenarios/terms 块解析从 markdown 格式改为 XML 标签格式
  - 移除不再使用的 parse_guidelines_text 函数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 22:56:43 +08:00
朱潮
342932030f feat(skills): add skill management API module
- Create new skill_manager.py with list and upload endpoints
- Add GET /api/v1/skill/list to retrieve official and user skills
- Add POST /api/v1/skill/upload for skill file upload
- Parse SKILL.md frontmatter to extract name and description
- Move skill upload endpoint from files.py to skill_manager.py
- Add SKILLS_DIR configuration to settings.py
- Register skill_manager router in fastapi_app.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-07 19:45:04 +08:00
朱潮
f74f09c191 fix(skills): improve skill extraction and handling logic
- Refactor _extract_skills_to_robot to accept bot_id instead of robot_dir
  - Add multi-directory skill search with priority order
  - Switch from zip extraction to direct directory copying
  - Add rag-retrieve skill directory
2026-01-07 14:56:10 +08:00
朱潮
1233bdda0c ♻️ refactor(deep-agent): customize agent memory middleware path display
- Change workspace_root from ~/.deepagents/{bot_id} to projects/robot/{bot_id}
- Refactor CustomSkillsMiddleware to support user and project skills separately
- Update skill path formatting for better visibility in system prompts
- Remove unused symlink_utils module and related setup code
- Clean up imports in fastapi_app.py and utils/__init__.py
2026-01-07 12:05:40 +08:00
朱潮
8bb8c3fbc8 add scripts/ 2026-01-04 17:19:03 +08:00
朱潮
a6f166d51e refactor: simplify path displays and remove sensitive config data
- Add CustomSkillsMiddleware to show ./skills instead of full paths
- Enable virtual_mode for FilesystemBackend in local mode
- Display "." instead of ~/.deepagents/{bot_id} in system prompt
- Remove backend_host and masterkey from robot project config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 20:30:44 +08:00
朱潮
306cebd8f1 refactor(project-manager): simplify project path resolution logic
- Remove complex symlink resolution in _get_robot_dir
- Simplify skills source directory path calculation
- Remove project_path parameter from create_project_directory call

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:27:46 +08:00
朱潮
78c413f4ea feat(robot): add default rag-retrieve skill for catalog/deep agents
When skills parameter is empty or None and robot_type is
catalog_agent or deep_agent, automatically load rag-retrieve skill.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 13:42:24 +08:00
朱潮
766b9becda feat(deep-agent): add skills support and improve project structure
- Add skills parameter to ChatRequest for skill file processing
- Extract and unzip skill files to robot project skills directory
- Add robot_config.json with bot_id and environment variables
- Update symlink setup to skip if ~/.deepagents already exists
- Enhance system prompt with directory access restrictions
- Refactor _get_robot_dir to handle symlink paths correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 13:21:58 +08:00
朱潮
0e6b2f1511 add CHECKPOINT_DB_URL 2025-12-24 20:43:10 +08:00
朱潮
b86a8364e9 db 2025-12-24 11:05:10 +08:00
朱潮
e117f1ee07 新增checkpoint清理机制 2025-12-24 00:12:01 +08:00
朱潮
bf11975183 修改balance资源配置 2025-12-23 23:11:24 +08:00
朱潮
06102559ef add SUMMARIZATION_MESSAGES_TO_KEEP 2025-12-23 22:31:26 +08:00
朱潮
d8dc973b95 sqlite pool and change agent cache to tools cache 2025-12-23 22:18:18 +08:00
朱潮
09a9c8be93 add MCP_HTTP_TIMEOUT and try catch 2025-12-23 20:13:46 +08:00
朱潮
d3465d418e add symlink 2025-12-23 17:36:45 +08:00
朱潮
aaad9df20a add skills 2025-12-22 23:47:12 +08:00
朱潮
a92bea5b58 删除一些环境变量 2025-12-18 09:41:43 +08:00
朱潮
b78b178c03 删除agent manager 2025-12-17 20:27:06 +08:00
朱潮
c9a91f8f4d add DEFAULT_THINKING_ENABLE 2025-12-17 12:33:58 +08:00
朱潮
e36787fb63 修改agent_config 2025-12-16 21:26:20 +08:00
朱潮
de72321875 add safe_print 2025-12-16 16:28:11 +08:00
朱潮
b8dcccbb1d add AgentConfig 2025-12-16 16:10:09 +08:00
朱潮
9525c0f883 add AgentConfig 2025-12-16 16:06:47 +08:00
朱潮
73b87bd2eb add x-request-id 2025-12-16 10:49:32 +08:00
朱潮
402e2ea5c3 增加默认上下文长度 2025-12-16 10:19:48 +08:00
朱潮
403df9de35 修复工具调用问题 2025-12-16 09:09:17 +08:00
朱潮
12cdb7679a TOOL_OUTPUT_MAX_LENGTH 2025-12-15 23:56:38 +08:00
朱潮
60f311e8b7 TOOL_OUTPUT_MAX_LENGTH 2025-12-15 23:55:30 +08:00
朱潮
b6975e1762 TOOL_OUTPUT_MAX_LENGTH 2025-12-15 23:54:32 +08:00
朱潮
77c8f5e501 settings 2025-12-15 21:58:54 +08:00
朱潮
0d50cd8e9f session_id 2025-12-15 21:36:13 +08:00
朱潮
a97ff5a185 优化思考 2025-12-15 11:57:31 +08:00
朱潮
c32ecdfeb6 tool_response 2025-12-14 21:37:35 +08:00
朱潮
ec9558fd4c update guidline 2025-12-13 02:52:01 +08:00
朱潮
720db80ae9 add deep_agent 2025-12-12 18:41:52 +08:00
朱潮
4a909cd846 process_message只保留find、get工具 2025-12-10 18:06:55 +08:00
朱潮
55651c38d0 remove guildline 2025-12-08 19:13:36 +08:00
朱潮
e1dbcad755 agent不传输历史工具调用的文字 2025-12-05 13:15:33 +08:00
朱潮
25f8f7c98f 修改guideline_prompt 2025-12-04 12:22:08 +08:00
朱潮
cf33da310d 修改general_agent提示词 2025-12-03 17:53:18 +08:00
朱潮
a7f27fe33b 修改guideline提示词 2025-12-03 14:13:39 +08:00
朱潮
154662ac6e 只传输执行计划给agent 2025-12-01 23:20:09 +08:00
朱潮
08b7d0e2b8 add cot 2025-12-01 21:52:14 +08:00
朱潮
8be1acb9f2 增加PREAMBLE标签 2025-12-01 19:22:59 +08:00
朱潮
b000fe6b6d modify process_messages 2025-12-01 18:53:03 +08:00
朱潮
38d22ff92e final_messages 移除 tool_call 和 tool_response内容 2025-12-01 16:18:53 +08:00
朱潮
498b98c5dc modify _get_optimal_batch_size 2025-11-28 17:50:45 +08:00
朱潮
13e2ba56a7 language 2025-11-28 17:42:58 +08:00
朱潮
5e26d88d18 优化推理逻辑,提升推理i速度 2025-11-28 14:26:37 +08:00
朱潮
af29716571 custom preamble 2025-11-28 12:06:23 +08:00
朱潮
fb34d45735 preamble 2025-11-28 09:04:01 +08:00
朱潮
95577c07a8 preamble 2025-11-27 23:51:03 +08:00
朱潮
3973174c83 日志优化 2025-11-27 21:50:03 +08:00
朱潮
116f1cb471 优化并发 2025-11-27 16:01:30 +08:00
朱潮
6f2e898e2d 优化并发 2025-11-27 15:49:55 +08:00
朱潮
a40da62413 add terms 2025-11-27 14:42:22 +08:00
朱潮
58ac6e3024 新增agent文件夹,修改import引用,增加custom_mcp_manager 2025-11-26 17:23:02 +08:00
朱潮
7002019229 优化工具次数耗尽的提示 2025-11-26 15:00:49 +08:00
朱潮
51b6d085fd guildlines filter 2025-11-26 09:51:59 +08:00
朱潮
fe6c4f77d7 update fastapi 2025-11-25 22:34:44 +08:00
朱潮
363c80d9cb remove datetime 2025-11-25 15:25:27 +08:00
朱潮
9b8c07a2e6 替换embedding模型 2025-11-20 22:45:11 +08:00
朱潮
081089a053 general_agent 2025-11-16 20:11:46 +08:00
朱潮
9b9d81a098 general_agent 2025-11-16 20:01:53 +08:00
朱潮
58fb623d66 general_agent 2025-11-16 19:50:06 +08:00
朱潮
bd93ae663d add generic_agent 2025-11-16 19:46:27 +08:00
朱潮
ed3c28174a 性能优化 2025-11-16 12:25:45 +08:00
朱潮
1a19d6d3db agent加锁 2025-11-16 10:47:08 +08:00
朱潮
0ac0fcbfb3 添加datetime & process_message逆运算 2025-11-14 00:28:08 +08:00
朱潮
6c1393e96a 新增user_identifier 2025-11-12 19:11:45 +08:00
朱潮
987d34c4c8 replace_mcp_placeholders 2025-11-10 16:07:47 +08:00
朱潮
41c6e010d1 修改robot目录窗口逻辑 2025-11-09 13:08:43 +08:00
朱潮
09690a101e 新增folder功能,删除unique_id 2025-11-09 11:54:03 +08:00
朱潮
764a723023 update _get_cache_key 2025-11-07 10:19:20 +08:00
朱潮
bff5817520 add /api/v1/files/process/incremental 2025-11-05 10:33:46 +08:00
朱潮
40aa71b966 add v2 api 2025-11-04 23:16:21 +08:00
朱潮
432fb214d4 suport dataset_ids 2025-10-30 21:50:43 +08:00
朱潮
29a3a17d28 新增dataset逻辑 2025-10-30 21:19:39 +08:00
朱潮
fd6539353d add agent prompt 2025-10-29 20:10:49 +08:00
朱潮
02a6d3e0d7 修改了助手实例的缓存机制,现在缓存key的生成会同时考虑 mcp_settings 和 prompt 参数。 2025-10-29 12:14:17 +08:00
朱潮
fc85a36157 add rag_retrieve api 2025-10-29 11:18:26 +08:00
朱潮
f13b1aaec9 add upload 2025-10-28 14:48:30 +08:00
朱潮
91b75990bb AGENT to agent 2025-10-27 19:05:18 +08:00
朱潮
a823daa0dc 修改readme文件的路径增加doc_dir 2025-10-26 00:13:32 +08:00
朱潮
906dc35dd5 embedding.pkl 2025-10-25 22:02:04 +08:00
朱潮
cec83ac4a9 优化文件上传处理功能实现分组删除,按需embedding 2025-10-25 10:09:11 +08:00