Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 190 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# =====================================================================
# Neo Agent v3.1.0 — Local Development .env.example
# =====================================================================
# 用法:
# cp .env.example .env
# vim .env # 填入实际 API 密钥与个性化参数
#
# 注意:.env 已在 .gitignore 中,不会被提交。
# =====================================================================

# ---------------------------------------------------------------------
# 一、LLM 通用配置(v3.1.0+ 推荐使用)
# ---------------------------------------------------------------------
# 供应商预设:openai / deepseek / siliconflow / moonshot / zhipu / custom
LLM_PROVIDER=siliconflow
# API Key(推荐用 LLM_API_KEY,兼容旧 SILICONFLOW_API_KEY)
LLM_API_KEY=
# 自定义 base_url(preset 模式可省略,custom 模式必填)
# LLM_BASE_URL=https://api.openai.com/v1
# 自定义模型名(preset 模式可省略)
# LLM_MODEL_NAME=gpt-4o-mini
# 全局超时/温度/最大 tokens
LLM_TIMEOUT=60
LLM_TEMPERATURE=0.7
LLM_MAX_TOKENS=2000
# 三层模型独立名称(MAIN/TOOL/VISION)
# MAIN_MODEL_NAME=deepseek-ai/DeepSeek-V3.2
# TOOL_MODEL_NAME=zai-org/GLM-4.6V
# VISION_MODEL_NAME=Qwen/Qwen3-VL-32B-Instruct

# ---------------------------------------------------------------------
# 一·A、兼容旧版 LLM 变量(v3.0.x 风格,推荐迁移到上方 LLM 通用配置)
# ---------------------------------------------------------------------
# (兼容旧版,推荐迁移到上方 LLM 通用配置)
# SiliconFlow API 密钥
# 申请:https://cloud.siliconflow.cn/account/ak
SILICONFLOW_API_KEY=your-siliconflow-api-key
SILICONFLOW_API_URL=https://api.siliconflow.cn/v1/chat/completions

# SerpAPI 密钥(用于网络搜索工具)
# 申请:https://serpapi.com/manage-api-key
SERPAPI_API_KEY=your-serpapi-key

# ---------------------------------------------------------------------
# 二、多层模型架构
# ---------------------------------------------------------------------

# 主模型:处理主要对话和复杂推理任务
MAIN_MODEL_NAME=deepseek-ai/DeepSeek-V3.2
MAIN_MODEL_TEMPERATURE=0.8
MAIN_MODEL_MAX_TOKENS=2000
# MAIN_MODEL_TIMEOUT=60 # API请求超时时间(秒),默认60秒

# 小模型:处理工具调用、意图识别等轻量级任务
TOOL_MODEL_NAME=zai-org/GLM-4.6V
TOOL_MODEL_TEMPERATURE=0.3
TOOL_MODEL_MAX_TOKENS=500
# TOOL_MODEL_TIMEOUT=45 # API请求超时时间(秒),默认45秒

# 多模态模型:处理视觉识别和多模态推理
VISION_MODEL_NAME=Qwen/Qwen3-VL-32B-Instruct
VISION_MODEL_TEMPERATURE=0.5
VISION_MODEL_MAX_TOKENS=1000
# VISION_MODEL_TIMEOUT=90 # API请求超时时间(秒),默认90秒

# 兼容旧配置(如果未设置上述新配置,将使用此默认值)
MODEL_NAME=deepseek-ai/DeepSeek-V3
TEMPERATURE=0.8
MAX_TOKENS=2000

# 视觉工具LLM判断配置(可选)
# VISION_LLM_TEMPERATURE=0.3
# VISION_LLM_MAX_TOKENS=10
# VISION_LLM_TIMEOUT=10

# ---------------------------------------------------------------------
# 三、提示词配置(使用 markdown 模板系统)
# ---------------------------------------------------------------------

# 角色提示词文件名(不含 .md 后缀),默认使用 default_character
# CHARACTER_PROMPT_FILE=default_character
# 世界观文件名(不含 .md 后缀),默认使用 default_world
# WORLDVIEW_FILE=default_world

# ---------------------------------------------------------------------
# 四、多智能体协作配置
# ---------------------------------------------------------------------

# 是否启用基于 LangGraph 的动态协作图(默认 True)
# USE_DYNAMIC_MULTI_AGENT=True

# ---------------------------------------------------------------------
# 五、角色 / 人物设定
# ---------------------------------------------------------------------

CHARACTER_NAME=小可
CHARACTER_GENDER=女
CHARACTER_ROLE=学生
CHARACTER_HEIGHT=150cm
CHARACTER_WEIGHT=45kg
CHARACTER_PERSONALITY=活泼开朗
CHARACTER_HOBBY=文科,尤其对历史充满热情
CHARACTER_AGE=18

CHARACTER_BACKGROUND=我是一名高中生,叫小可。我身高150cm,体重45kg。我性格活泼开朗,特别喜欢文科,尤其对历史充满热情。我喜欢阅读历史书籍,常常能从历史故事中获得启发。我说话比较俏皮可爱,喜欢和朋友们分享有趣的历史知识。

# ---------------------------------------------------------------------
# 六、记忆 / 持久化
# ---------------------------------------------------------------------

MEMORY_FILE=memory_data.json
LONG_MEMORY_FILE=longmemory_data.json
MAX_MEMORY_MESSAGES=50
MAX_SHORT_TERM_ROUNDS=20

# SQLite 共享数据库
# 默认 chat_agent.db 在项目根目录
# CHAT_AGENT_DB=/abs/path/to/chat_agent.db

# ---------------------------------------------------------------------
# 七、调试 / 日志
# ---------------------------------------------------------------------

DEBUG_MODE=True
DEBUG_LOG_FILE=debug.log

# Web 后端日志级别(DEBUG/INFO/WARNING/ERROR)
LOG_LEVEL=INFO

# ---------------------------------------------------------------------
# 八、NPS 工具系统 LLM 配置(可选)
# ---------------------------------------------------------------------

# NPS_LLM_TEMPERATURE=0.3
# NPS_LLM_MAX_TOKENS=100
# NPS_LLM_TIMEOUT=10

# ---------------------------------------------------------------------
# 九、DeepAgents 增强配置
# ---------------------------------------------------------------------

# 是否使用 DeepAgents 增强的子智能体(默认 True)
# 读取位置:src/core/multi_agent_coordinator.py
# USE_DEEP_AGENTS=True

# 是否启用持久化状态管理(默认 True)
# 读取位置:src/core/dynamic_multi_agent_graph.py
# ENABLE_PERSISTENT_STATE=True
# 注:USE_DEEPAGENTS_KNOWLEDGE 已弃用(v2.2.0 删除 DeepAgentsKnowledgeManager)

# ---------------------------------------------------------------------
# 十、Feature Flags(功能开关,按需启用)
# ---------------------------------------------------------------------

# 启用生活状态管理(life_state 模块)
# ENABLE_LIFE_STATE=true

# 启用主动消息引擎
# ENABLE_PROACTIVE_ENGINE=true

# 启用情感雷达(Plutchik 八情绪)
# ENABLE_EMOTION_WHEEL=true

# 启用创意写作 / 长篇项目
# ENABLE_CREATIVE_WRITER=true

# ---------------------------------------------------------------------
# 十一、Web GUI 配置(v3.0.0 新增)
# ---------------------------------------------------------------------

# 启用前端 Vite dev server(与 FastAPI 8000 端口并行启动 :5173)
# 生产部署设为 0;本地开发设为 1
# ENABLE_FRONTEND_DEV=1

# FastAPI 监听地址(生产建议 127.0.0.1,由 nginx 反代;本地开发 0.0.0.0)
# WEB_HOST=0.0.0.0

# FastAPI 监听端口
# WEB_PORT=8000

# CORS 允许来源(开发态默认 localhost:5173 + localhost:8000)
# 多个用逗号分隔;生产部署改为实际反代域名
# CORS_ORIGINS=http://localhost:5173,http://localhost:8000,http://127.0.0.1:5173,http://127.0.0.1:8000

# ---------------------------------------------------------------------
# 十二、彩蛋(可选)
# ---------------------------------------------------------------------

# 关闭 ANSI 颜色(CI / 非 TTY 环境)
# NO_COLOR=1
12 changes: 5 additions & 7 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Neo Agent is an intelligent conversation agent system based on LangChain, suppor
- **Language**: Python 3.8+
- **Main Framework**: LangChain (langchain, langchain-community, langchain-core)
- **Database**: SQLite for persistent storage
- **GUI**: Tkinter for graphical user interface
- **GUI**: Web GUI (FastAPI + React + Vite)
- **API**: SiliconFlow API for LLM integration
- **Configuration**: python-dotenv for environment management

Expand All @@ -25,8 +25,6 @@ Neo Agent is an intelligent conversation agent system based on LangChain, suppor
- `event_manager.py` - Event-driven system for notifications and tasks
- `multi_agent_coordinator.py` - Multi-agent collaboration system
- `agent_vision.py` - Vision tool with LLM-based environment perception
- `gui_enhanced.py` - Main GUI application
- `database_gui.py` - Database management GUI
- `base_knowledge.py` - Immutable core knowledge management

### Supporting Modules
Expand Down Expand Up @@ -108,10 +106,10 @@ Neo Agent is an intelligent conversation agent system based on LangChain, suppor

### GUI Development

- Use Tkinter conventions consistent with existing code
- Maintain the modern, user-friendly interface style
- Support real-time updates and visual feedback
- Include proper error dialogs in Chinese
- Web GUI is built with React + TypeScript + Vite + Ant Design
- Backend API is FastAPI; WebSocket endpoints provide real-time updates
- Keep frontend state management predictable and debuggable
- Provide user-friendly error feedback in Chinese

### Event System

Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ Thumbs.db
thinking.md
mermaid.md

# 测试生成产物(settings_migration 等测试自动生成)
test_export.json
full_test_export.json
selective_export.json
test_import.env
test_imported.env
*.env.backup.*
test_*.db

# CodeGraph SQLite 索引(不在仓库内共享;每个开发者本地 init)
.codegraph/

Expand Down
5 changes: 1 addition & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ Matt Pocock 默认 5 类状态机标签。详见 [[docs/agents/triage-labels]]
## 快速命令

```bash
# 启动 GUI(需要 Tkinter)
# 启动 Web / API
python main.py

# 启动方式 2(推荐用 run.py——自动加项目根到 sys.path)
python run.py

# 运行测试
pytest

Expand Down
Loading