Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opsre/ZenOps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: opsre/ZenOps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: feat_agent
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 20 commits
  • 40 files changed
  • 2 contributors

Commits on Jan 2, 2026

  1. 📝 docs: 添加 Eino 框架集成设计方案

    详细设计了 Eino 框架集成方案,包括:
    - Memory Manager (SQLite + Redis 混合存储)
    - Knowledge Retriever (文档检索和知识库)
    - Agent Orchestrator (智能编排引擎)
    - 完整的迁移计划和风险控制
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    d79fe6c View commit details
    Browse the repository at this point in the history
  2. ✨ feat(agent): 实现 Eino 框架集成基础设施(阶段一)

    添加核心模块:
    - Memory Manager: SQLite + Redis 混合存储,会话记忆和 QA 缓存
    - Knowledge Retriever: FTS5 全文检索,文档知识库管理
    - Agent Orchestrator: 简化版编排器(未来将使用 Eino Graph)
    - MCP Tool Adapter: 将 MCP 工具适配为 Eino Tool
    
    数据库变更:
    - 新增 user_contexts 表(用户上下文)
    - 新增 qa_cache 表(问答缓存)
    - 新增 knowledge_documents 表(知识库文档)
    - 创建 FTS5 全文索引和触发器
    
    依赖更新:
    - 添加 github.com/cloudwego/eino@v0.7.17
    - 添加 github.com/cloudwego/eino-ext
    - 添加 github.com/redis/go-redis/v9
    
    说明:
    - 所有代码编译通过
    - 现有功能不受影响
    - 为阶段二的完整实现奠定基础
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    1d14525 View commit details
    Browse the repository at this point in the history
  3. ✨ feat(agent): 完成 Phase 2 - Eino 框架核心集成

    实现了完整的 Eino Agent 系统,包括:
    
    ## 核心组件
    - Stream Handler: 流式对话处理器,支持多轮工具调用
    - Agent Orchestrator: 简化版编排器(完整 Graph 实现留待未来)
    - MCP Tool Adapter: MCP 工具适配到 Eino Tool 接口
    - Agent 初始化系统: 统一的启动和配置管理
    
    ## Redis 支持
    - 在配置文件中添加 Redis 连接配置
    - Memory Manager 自动使用 Redis 作为 L1 缓存(如果启用)
    - 优雅降级:Redis 不可用时回退到纯 SQLite 模式
    
    ## 集成点
    - 在应用启动时自动初始化 Agent 系统
    - 全局 Agent 实例可供 HTTP 服务使用
    - 与现有 MCP Server 完美集成
    
    ## 技术细节
    - 使用 Eino ChatModel 进行 LLM 调用
    - 支持流式输出到 IM 客户端
    - 工具调用支持多次迭代(最多 10 轮)
    - QA 缓存、对话历史、用户上下文完整支持
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    ce0d912 View commit details
    Browse the repository at this point in the history
  4. ✨ feat(agent): 迁移 Web Chat API 和钉钉机器人到新 Agent 系统

    完成 Phase 3 部分迁移工作:
    
    ## Web Chat API (/api/v1/chat/completions)
    - 使用新的 Agent StreamHandler 替换旧的 llm.Client
    - Agent 内部已处理消息保存,移除重复保存逻辑
    - 保留会话标题生成和时间更新逻辑
    - 会话标题生成也切换为使用 Agent
    
    ## 钉钉机器人 (DingTalk Stream Mode)
    - 使用新的 Agent 系统替换旧的 llm.Client
    - 移除 LLM 客户端初始化代码
    - 重写消息处理流程使用 processAgentMessage
    - 简化代码逻辑,Agent 统一处理消息保存
    
    ## 优点
    - 统一的对话处理逻辑
    - 自动支持 MCP 工具调用
    - 多轮推理能力
    - QA 缓存和知识库检索
    - Redis 缓存支持(如果启用)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    f8b47ea View commit details
    Browse the repository at this point in the history
  5. ✅ feat(agent): 完成 Phase 3 - 删除旧 LLM 代码

    删除旧的 LLM 实现和未使用的 HTTP 回调模式代码:
    - 删除 internal/llm/ 目录 (client.go, openai.go)
    - 删除未使用的 DingTalk HTTP 回调模式处理器
      - internal/dingtalk/handler.go
      - internal/api/handler/dingtalk.go
    - 清理 Feishu 和 WeCom 处理器中的旧数据库保存逻辑
      - 移除 chatLogService 字段和相关调用
      - Agent 系统已内置消息持久化
    
    现在所有 IM 平台 (钉钉/飞书/企业微信) 和 Web Chat API
    都统一使用新的 Agent 系统 (Eino 框架)。
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    7f4d45a View commit details
    Browse the repository at this point in the history
  6. 🐛 fix(agent): 修复 LLM 配置优先级问题

    **问题**: Agent 初始化时只从 config.yaml 读取 LLM 配置,
    忽略了数据库 llm_configs 表中的配置,导致用户在 Web UI
    中配置的 LLM 无法生效。
    
    **修复**:
    - 在 initializeStreamHandler 中优先从数据库读取配置
    - 使用 ConfigService.GetDefaultLLMConfig() 获取第一个启用的配置
    - 如果数据库没有启用的配置,回退到 config.yaml
    - 增加日志输出,明确显示使用的配置来源
    
    **配置优先级**:
    1. 数据库 llm_configs 表(第一个 enabled=true 的记录)
    2. config.yaml 中的 llm 配置(回退方案)
    
    **日志示例**:
    ```
    📦 Using LLM config from database: provider=openai, model=gpt-4, base_url=https://api.example.com
    ```
    或
    ```
    📦 Using LLM config from config.yaml: model=gpt-3.5-turbo, base_url=https://api.openai.com
    ```
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    3d9bc91 View commit details
    Browse the repository at this point in the history
  7. ✨ feat(memory): 智能 QA 缓存 - 不缓存错误响应

    **问题**:
    之前的错误响应(如 LLM 超时)也会被缓存,导致修复问题后
    仍然返回缓存的错误信息,用户体验很差。
    
    **解决方案**:
    
    1. **错误检测** - 在保存缓存前检测答案质量
       - 检测错误关键词:❌、失败、错误、timeout 等
       - 检测答案长度(<10字符的不缓存)
       - 错误响应不会被保存到缓存
    
    2. **缓存清理** - 提供手动清理工具
       - ClearQACache(username, questionHash) - 清理特定缓存
       - ClearErrorCache() - 批量清理所有错误缓存
       - 同时清理 SQLite 和 Redis
    
    3. **调试优化** - 增加日志
       - 缓存保存时记录 question_hash
       - 跳过错误响应时输出 debug 日志
    
    **错误关键词列表**:
    - ❌, LLM 调用失败, Agent 调用失败
    - i/o timeout, connection refused, dial tcp
    - error:, Error:, 失败:, 错误:, 异常:
    
    **使用示例**:
    ```go
    // 手动清理特定缓存
    memoryMgr.ClearQACache("user1", "abc123")
    
    // 清理所有错误缓存
    count, _ := memoryMgr.ClearErrorCache()
    ```
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 2, 2026
    Configuration menu
    Copy the full SHA
    55b2d14 View commit details
    Browse the repository at this point in the history

Commits on Jan 3, 2026

  1. 🐛 fix: 修复前端 SSE 流式响应解析问题

    后端:
    - 优化日志输出,增加 stream 参数信息
    
    前端 (zenops-web):
    - 添加缓冲区正确处理跨 chunk 边界的数据
    - 使用 \n\n 作为 SSE 消息分隔符
    - 处理流结束时缓冲区中的剩余数据
    - 添加解析错误日志帮助调试
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    0880f63 View commit details
    Browse the repository at this point in the history
  2. 📝 docs: 添加知识库功能完整设计方案

    详细设计了知识库管理系统,包括:
    - 功能架构:文档管理、分类、标签、搜索
    - 数据模型:扩展 KnowledgeDocument,支持 Tags
    - API 设计:8 个 REST 接口(CRUD + 统计 + 搜索)
    - UI/UX 设计:主页面布局、编辑器、分类导航
    - 技术方案:后端 Go Handler、前端 React 组件
    - 实施计划:Phase 1 (MVP 2-3天) + Phase 2 (优化 1-2天)
    
    核心特性:
    - Markdown 编辑器(分屏预览)
    - 分类 + 标签混合组织
    - FTS5 + 向量混合检索
    - AI 对话自动引用知识库
    - 为 URL 导入、PDF 解析预留接口
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    35fa348 View commit details
    Browse the repository at this point in the history
  3. add new

    eryajf committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    c33273f View commit details
    Browse the repository at this point in the history
  4. 📝 docs: 添加知识库 Phase 1 实施计划

    详细的分步实施计划,包含 16 个任务:
    
    **后端任务 (Task 1-4):**
    - 扩展数据模型添加 Tags 字段
    - 创建 KnowledgeHandler
    - 实现 10 个 API 接口
    - 注册路由
    
    **前端任务 (Task 5-13):**
    - TypeScript 类型定义
    - API Service 实现
    - 组件骨架创建
    - KnowledgeView 主组件
    - StatsCards 统计卡片
    - CategoryTree 分类导航
    - DocumentList 文档列表
    - DocumentEditor 编辑器
    - 导航和路由集成
    
    **测试任务 (Task 14-16):**
    - 端到端测试
    - 优化修复
    - 文档更新
    
    每个任务包含:
    - 明确的目标和文件路径
    - 详细步骤和完整代码
    - 验证命令和预期结果
    - Git 提交信息
    
    预计时间:2-3 天(10-12 小时)
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    1fe6624 View commit details
    Browse the repository at this point in the history
  5. feat(model): 为 KnowledgeDocument 添加 Tags 字段

    - 在 model.KnowledgeDocument 中添加 tags 字段(JSON 格式)
    - 在 knowledge.Document 中添加 tags 字段(数组格式)并补充 enabled/created_at/updated_at 字段
    - 在 knowledge.AddDocumentRequest 中添加 tags 字段
    - 更新 retriever 所有方法支持 tags 序列化和反序列化
    - 更新 ListDocuments/GetDocumentByID/retrieveByFTS5 返回完整文档信息
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    35a9f3d View commit details
    Browse the repository at this point in the history
  6. feat(handler): 创建 KnowledgeHandler 基础结构

    - 创建 Handler 结构体
    - 注册 10 个 API 路由
    - 准备实现具体接口
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    a74ec3e View commit details
    Browse the repository at this point in the history
  7. feat(handler): 实现知识库所有 API 接口

    - ListDocuments: 支持分类和状态筛选
    - GetDocument: 获取单个文档详情
    - CreateDocument: 创建新文档
    - UpdateDocument: 更新文档内容
    - DeleteDocument: 删除文档
    - ToggleDocument: 启用/禁用文档
    - GetStats: 统计信息
    - GetCategories: 分类列表
    - GetTags: 标签列表(待实现)
    - SearchDocuments: 搜索并支持分类过滤
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    cca47c5 View commit details
    Browse the repository at this point in the history
  8. feat(router): 注册知识库 API 路由

    - 在 Orchestrator 添加 GetKnowledgeRetriever() 公开方法
    - 创建 registerKnowledgeRoutes() 方法注册知识库路由
    - 在 SetMCPServer() 中调用注册方法
    - 注册 /api/v1/knowledge/* 路由组
    - 连接 KnowledgeHandler 和 Retriever
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    621eba8 View commit details
    Browse the repository at this point in the history
  9. feat: 完成知识库前端实现

    - 添加知识库 TypeScript 类型定义
    - 实现知识库 API Service
    - 实现 KnowledgeView 主组件
    - 实现 StatsCards 统计卡片组件
    - 实现 CategoryTree 分类导航组件
    - 实现 DocumentList 文档列表组件
    - 实现 DocumentEditor 编辑器组件
    - 添加知识库导航和路由
    - 添加中英文国际化翻译
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    733765f View commit details
    Browse the repository at this point in the history
  10. docs: 更新知识库 Phase 1 实施计划完成状态

    - 添加完成总结和测试结果
    - 记录所有交付成果
    - 标记所有 16 个任务为已完成
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    0bf52e1 View commit details
    Browse the repository at this point in the history
  11. fix: 修复 non-constant format string 编译警告

    - 修复 mcp_adapter.go 中的格式化字符串问题
    - 修复 stream_handler.go 中的两处格式化字符串问题
    - 修复 dingtalk_stream_handler.go 中的格式化字符串问题
    
    所有 logx.Error 调用现在使用常量格式字符串
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
    eryajf and claude committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    9042081 View commit details
    Browse the repository at this point in the history
  12. fix(knowledge): 添加 LIKE 搜索降级支持中文检索

    问题分析:
    - FTS5 使用 porter unicode61 分词器主要为英文设计
    - 对中文文本无法正确分词和检索
    - 导致中文查询返回 0 结果
    
    解决方案:
    - 实现混合检索策略
    - FTS5 查询失败时自动降级到 LIKE 搜索
    - LIKE 搜索支持中文模糊匹配
    - 按匹配位置排序(标题 > 内容 > 标签)
    
    测试结果:
    - '阿里云': FTS5 0 结果 → LIKE 1 结果 ✅
    - 'ack集群': FTS5 0 结果 → LIKE 1 结果 ✅
    - 'rokid': FTS5 1 结果(无需降级)✅
    eryajf committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    b461930 View commit details
    Browse the repository at this point in the history
  13. ✨ feat(orchestrator): 增强知识库文档注入功能

    - 添加知识库文档数量日志记录
    - 改进参考资料提示词格式,添加序号和标题
    - 限制文档内容预览长度为500字符
    - 添加知识库为空时的警告日志
    
    ✨ feat(stream_handler): 增加详细的聊天流程日志
    
    - 添加聊天流开始、缓存命中/未命中日志
    - 增加知识检索过程和结果的详细日志
    - 添加知识检索器为空时的警告日志
    
    ♻️ refactor(retriever): 重构LIKE检索算法
    
    - 实现关键词提取功能,移除停用词
    - 改进SQL查询逻辑,支持多关键词OR匹配
    - 优化排序规则,标题匹配优先
    - 添加详细的关键词提取和查询日志
    
    🔧 chore(dingtalk_stream_handler): 增加钉钉处理日志
    
    - 添加Agent系统可用性检查日志
    - 改进消息处理流程的日志信息
    - 统一日志格式,增加模块标识
    eryajf committed Jan 3, 2026
    Configuration menu
    Copy the full SHA
    a64cfda View commit details
    Browse the repository at this point in the history
Loading