采用向量数据库实现长期记忆
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled

This commit is contained in:
2026-04-15 23:52:13 +08:00
parent de68916c5a
commit a92a220ff3
24 changed files with 1237 additions and 713 deletions

48
.env
View File

@@ -1,33 +1,55 @@
# =============================================================================
# 本地开发环境配置
# 用于 python app/backend.py 和 streamlit run frontend/frontend.py
# Agent1 环境配置文件
# 用法: cp .env.example .env 然后修改配置值
# =============================================================================
# -----------------------------------------------------------------------------
# AI 模型 API 密钥
# AI 模型 API 密钥(必需 - 请填入真实值)
# -----------------------------------------------------------------------------
ZHIPUAI_API_KEY=4d568a4367f1442bbc226cc0daf84566.44SsKVWkVIM2Mkeg
DEEPSEEK_API_KEY=sk-e74b13ac778f4b7eb29afa418a14421e
VLLM_LOCAL_KEY=token-abc123
LLAMACPP_API_KEY=token-abc123
# -----------------------------------------------------------------------------
# vLLM 服务配置
# llama.cpp 服务配置
# -----------------------------------------------------------------------------
# 本地开发时vLLM 通常在 localhost 运行
VLLM_BASE_URL=http://localhost:8000/v1
# 主 LLM 服务 (Gemma-4-E2B GGUF) - 端口 8081
VLLM_BASE_URL=http://localhost:8081/v1
# Embedding 服务 (embeddinggemma-300M GGUF) - 端口 8082
VLLM_EMBEDDING_URL=http://localhost:8082/v1
# -----------------------------------------------------------------------------
# Mem0 记忆层配置
# -----------------------------------------------------------------------------
# ⭐ 注意Mem0 现在直接复用主 LLM 实例,无需单独配置
# Qdrant 向量数据库地址(远程服务器)
QDRANT_URL=http://115.190.121.151:6333
QDRANT_COLLECTION_NAME=mem0_user_memories
# -----------------------------------------------------------------------------
# 数据库配置
# -----------------------------------------------------------------------------
# 本地开发时,数据库在 localhost 运行
DB_URI=postgresql://postgres:mysecretpassword@localhost:5432/langgraph_db?sslmode=disable
# PostgreSQL 连接字符串(远程服务器)
DB_URI=postgresql://postgres:mysecretpassword@115.190.121.151:5432/langgraph_db?sslmode=disable
# -----------------------------------------------------------------------------
# 前端配置
# -----------------------------------------------------------------------------
# 本地开发时,后端也在 localhost 运行
API_URL=http://localhost:8001/chat
# 后端 API 地址(本地开发使用 8003 端口,避免与 vLLM 冲突)
API_URL=http://localhost:8003/chat
# 本地开发 - 显示所有调试信息
# -----------------------------------------------------------------------------
# 应用行为配置
# -----------------------------------------------------------------------------
# 记忆提取间隔:每 N 轮对话执行一次记忆提取
MEMORY_SUMMARIZE_INTERVAL=10
# 是否启用 Graph 执行追踪(调试用)
ENABLE_GRAPH_TRACE=true
# -----------------------------------------------------------------------------
# 日志配置
# -----------------------------------------------------------------------------
LOG_LEVEL=DEBUG
DEBUG=true
DEBUG=true