# context_engine **Repository Path**: gspspop/context_engine ## Basic Information - **Project Name**: context_engine - **Description**: free style context engine implementation - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-02 - **Last Updated**: 2025-09-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1. version 0903 ## 数据定义层 创建了核心数据结构: - Entity.h :定义了12种实体类型(PERSON/LOCATION等)和Entity结构体 - Intent.h :定义了11种意图类型(INFORM/REQUEST等)和Intent结构体 - ContextModel.h/cpp :实现了上下文模型,支持实体、意图、会话上下文、长期记忆和系统上下文的管理 ## 解析层 - InputParser.h/cpp :实现了用户输入解析功能,支持意图识别、实体提取和约束条件识别 ## 建模层 - ContextBuilder.h/cpp :实现了上下文构建功能,支持会话上下文、长期记忆上下文和混合上下文的构建 ## 生成层 - PromptGenerator.h/cpp :实现了基于上下文动态拼接Prompt的功能,支持模板管理和变量替换 ## 优化层 - ContextOptimizer.h/cpp :实现了上下文优化功能,支持多种优化策略(Token优化、上下文优化、记忆优化等) ## 统一处理入口 更新了 ContextProcessor.h/cpp ,整合了所有组件: - 添加了新的上下文处理接口(ProcessInput/GeneratePromptFromContext等) - 实现了组件管理功能(GetInputParser/GetContextBuilder等) - 支持四个核心模块: - token编码+压缩(EncodeContext/CompressContext等) - 存储+整合(SaveAllToStorage/LoadAllFromStorage等) - 检索+排序(SearchMemoryFragments等) - 遗忘+更新(CleanupExpiredConversations等)