# emotion-analysis-expert **Repository Path**: architect-training/emotion-analysis-expert ## Basic Information - **Project Name**: emotion-analysis-expert - **Description**: Claude Code 使用 LangChainGo 库开发的男性情感咨询专家智能体。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-03 - **Last Updated**: 2026-06-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Emotion Analysis Expert 基于大语言模型的情商培训专家系统,提供情感分析、关系评估和沟通优化等功能。 ## 项目简介 本项目是一个用于情感分析的 AI Agent 系统,结合了 RAG(检索增强生成)技术,可以对聊天记录进行情感分析、评估人际关系质量并提供沟通建议。系统支持以命令行工具或 HTTP API 服务两种方式运行。 ## 功能特性 - **情感分析**:识别文本中的情感倾向和情绪关键词 - **关系评分**:基于正向和负向信号评估人际关系质量 - **聊天记录分析**:检测冲突标记和情感变化趋势 - **RAG 知识库**:基于文档构建向量知识库,提供专业沟通技巧建议 - **会话记忆**:支持多会话上下文管理,记住对话历史 - **HTTP API**:提供 RESTful API 接口,方便第三方集成 ## 技术架构 ``` ┌─────────────────────────────────────────────────────┐ │ CLI / HTTP API │ ├─────────────────────────────────────────────────────┤ │ Agent (情感分析智能体) │ │ ┌──────────┐ ┌───────────┐ ┌──────────────────┐ │ │ │ Tools │ │ Memory │ │ RAG (知识库) │ │ │ │ - 情感 │ │ 会话管理 │ │ 向量存储+检索 │ │ │ │ - 关系 │ │ │ │ │ │ │ │ - 日志 │ │ │ │ │ │ │ └──────────┘ └───────────┘ └──────────────────┘ │ ├─────────────────────────────────────────────────────┤ │ LLM Model │ │ (OpenAI / Claude 等) │ └─────────────────────────────────────────────────────┘ ``` ## 快速开始 ### 环境要求 - Go 1.21+ - SQLite3 ### 安装配置 1. 克隆项目: ```bash git clone https://gitee.com/architect-training/emotion-analysis-expert.git cd emotion-analysis-expert ``` 2. 修改配置文件 `configs/config.yaml`,配置你的 LLM API: ```yaml llm: provider: "openai" # 或 "anthropic" 等 model: "gpt-4" base_url: "https://api.openai.com/v1" api_key: "your-api-key" temperature: 0.7 max_tokens: 2000 timeout_sec: 120 embedding: provider: "openai" model: "text-embedding-ada-002" base_url: "https://api.openai.com/v1" api_key: "your-api-key" rag: db_path: "data/memory.db" chunk_size: 500 chunk_overlap: 50 top_k: 3 memory: db_path: "data/memory.db" max_history: 100 server: port: 8080 ``` ### 构建与运行 ```bash # 构建二进制 ./scripts/build.sh # 或直接运行 go run cmd/male-agent/main.go ``` ## 使用方式 ### 命令行模式 ```bash # 交互式对话 go run cmd/male-agent/main.go chat --session-id "user123" # 单次问答 go run cmd/male-agent/main.go ask --message "你好" # 分析聊天记录 go run cmd/male-agent/main.go analyze --content "聊天内容..." ``` ### API 服务模式 ```bash # 启动 HTTP 服务 go run cmd/male-agent/main.go server # 调用 API curl -X POST http://localhost:8080/api/chat \ -H "Content-Type: application/json" \ -d '{"session_id": "user123", "message": "今天工作好累"}' ``` ### API 接口 | 接口 | 方法 | 说明 | |------|------|------| | `/api/chat` | POST | 对话接口 | | `/api/emotion` | POST | 情感分析接口 | | `/api/analyze` | POST | 聊天记录分析接口 | | `/health` | GET | 健康检查 | ## 内置工具 系统内置三个核心分析工具: 1. **EmotionTool** - 情感分析工具 - 识别文本中的情感关键词 - 判断情感倾向(正面/负面/中性) 2. **RelationshipScoreTool** - 关系评分工具 - 基于正向信号(关心、支持、信任等)评分 - 基于负向信号(忽视、冷漠、批评等)扣分 3. **ChatLogAnalyzerTool** - 聊天记录分析工具 - 检测冲突标记 - 分析情感变化趋势 - 提供改进建议 ## 目录结构 ``` emotion-analysis-expert/ ├── cmd/ # 程序入口 │ └── male-agent/ │ └── main.go ├── configs/ # 配置文件 │ └── config.yaml ├── data/ # 数据目录 │ └── memory.db ├── internal/ # 内部包 │ ├── agent/ # Agent 实现 │ ├── cli/ # CLI 命令 │ ├── llm/ # LLM 工厂 │ ├── memory/ # 会话内存管理 │ ├── prompt/ # 提示词 │ ├── rag/ # RAG 组件 │ ├── server/ # HTTP 服务器 │ └── tools/ # 分析工具 ├── knowledge/ # 知识库文档 │ └── communication_skills.md ├── scripts/ # 构建脚本 └── go.mod # Go 模块定义 ``` ## 许可证 本项目仅供学习和研究使用。