Commit Graph

160 Commits

Author SHA1 Message Date
e779c16595 refactor: 工程标准化 — 组件提取、废弃API清理、console清零
- ChatPage/GraphPage/SettingsPage 拆分为独立子组件
- MainPage 接入 ImmersiveTabNavigation 玻璃拟态导航
- EntryAbility console.* 全替换为 defaultLogger
- SplashPage replaceUrl 废弃 API 迁移到 UIContext Router
- common/Index.ets 双通道导出 Logger/defaultLogger
- 删除 dead code (entry/, commonbusiness/, trulymem-core/)
- 全工程 0 console.*,BUILD SUCCESSFUL
2026-05-01 16:05:22 +08:00
5e4fb8222a refactor: 工程规范化,唯一入口为 products/phone
- entry 模块改为 har(静态共享包),移除 abilities 和入口能力
- entry/build-profile.json5 简化,删除 release 混淆配置
- 根 build-profile.json5 移除 entry 模块,phone 为唯一入口
- 保留 entry 的 requestPermissions 作为依赖参考
2026-05-01 09:22:54 +08:00
5ae2143822 refactor: 改用原生 Tabs 导航,清理旧 entry 目录代码
- MainPage 改用 ArkUI Tabs + BottomTabBarStyle 原生导航
- 移除 ImmersiveTabNavigation 自定义组件依赖
- 清理旧 entry/src/main/ets/ 下的已迁移文件
- 更新 common/Index.ets 移除 ImmersiveTabNavigation 导出
2026-05-01 09:21:39 +08:00
ab3d910387 refactor: 应用参考工程代码模式,优化启动流程和架构
- 新增 SplashPage:启动页,2秒后跳转到 Index
- 新增 MainPage:独立主页组件,含 Tab 导航 + 宽屏/窄屏自适应
- 简化 Index.ets:纯路由入口,初始化数据库,加载 MainPage
- EntryAbility:加载 SplashPage 而非直接加载 Index
- 新增 PageContext:NavPathStack 路由管理(参考工程模式)
- 新增 BreakpointSystem:响应式断点系统 xs/sm/md/lg/xl
- 新增 BaseViewModel:ViewModel 基类,含 attach/detach/dispose 生命周期
- 更新 common/Index.ets 导出新模块
- 更新 main_pages.json 注册 SplashPage 和 MainPage
2026-05-01 09:15:36 +08:00
5916d2749c refactor: 按 sample_in_harmonyos 多层模块化架构重构工程结构
- 新增 common/ 公共模块:模型、服务、组件、常量
- 新增 features/ 功能模块:graph(星图)、chat(聊天)、settings(设置)、commonbusiness
- 新增 products/phone 产品入口层:EntryAbility + Index + MainPage
- Index.ets 简化为纯路由入口,TabNavigation 移至 MainPage 统一管理
- 更新 build-profile.json5 注册所有新模块
- 迁移原始 entry/ 代码到分层架构,保持功能完整
2026-05-01 08:35:07 +08:00
67c6b38e50 fix: resolve ArkTS compilation errors
- GraphDatabase.ets:
  - Export TimeRangeParams interface
  - Add graph(), snapshot(), queryArchived() methods
  - Add SnapshotData interface
  - Add NameCacheEntry interface, remove duplicates
  - Fix Context import to use named import from @ohos.abilityAccessCtrl

- GraphMemoryService.ets:
  - Import TimeRangeParams from GraphDatabase
  - Import RecordResult from GraphDatabase
  - Add graph(), snapshot(), queryArchived() delegate methods
  - Add timeRange optional param to MemoryRecallParams

- AIAgentService.ets:
  - Fix Context import: named import from @ohos.abilityAccessCtrl
  - Import TimeRangeParams from GraphDatabase instead of GraphMemoryService
  - Add dryRun, keyword, attribute to ToolPropertiesDefinition

- Index.ets:
  - Fix displayCallback type to Callback<number>
  - Add display import
2026-04-30 17:41:02 +08:00
1a4a8dce98 feat: 移植6个缺失工具定义和handler到AIAgentService
- memory_introspect — 查看记忆状态统计
- memory_archive — 归档旧记忆
- memory_cleanup — 清理已删除数据
- memory_query_archived — 查询已归档记忆
- context_rewrite — 压缩工具调用上下文
- persona_remove — 删除单条人设属性

同时在GraphMemoryService添加:
- queryArchived() 方法
- personaRemove() 方法

更新系统提示词,加入工具调用规则和context_rewrite使用说明
2026-04-30 16:44:27 +08:00
c8571f9d5f perf: removeOrphanNodes O(N²) → O(N) 批量查询优化
- 改为先批量查询所有 active 关系的节点 ID 集合
- 再遍历所有节点找出孤儿节点
- 从 O(N×2) 查询降到 O(1) 批量 + O(N) 遍历
- 显著提升 cleanup / purge 性能
2026-04-30 15:16:19 +08:00
dd0ab4dcbe perf: recall BFS N+1 优化 + timeRange 过滤支持
- GraphDatabase.recall() 添加 timeRange.days 参数,计算 minDateBucket 过滤
- getRelationsForNodes() 批量预加载节点名称缓存,减少 N+1 查询
- 关系查询传入 minDateBucket,支持按时间范围过滤关系
- BFS 扩展节点时优先从缓存获取,避免重复查询数据库
2026-04-30 15:09:53 +08:00
ba44d50d7a fix: AIAgentService getContext(this) 改为外部传入,Index 添加 aboutToDisappear 释放 display 监听
- AIAgentService: 添加 appContext 字段,构造函数接收 Context 参数
- ChatPage: 创建 AIAgentService 时传入 getContext(this)
- Index: 添加 displayCallback 字段和 aboutToDisappear 释放监听
2026-04-30 15:02:00 +08:00
b9a2cba2a7 fix: 编译错误修复 - ArkTS语法兼容(去交点类型/展开/内联对象类型/duplicate code) + pinchGesture/alignContent移除 2026-04-30 10:35:54 +08:00
c060a59710 feat: 星图响应式布局适配 - ResizeObserver + 窄屏55/45上下分/宽屏左右分 (@ohos.display) 2026-04-30 10:29:51 +08:00
d594099f02 feat: harmonyos星图全面适配交互功能-搜索/过滤/连接高亮/拖拽/触摸/节点详情 2026-04-30 10:24:06 +08:00
45c098d10b chore: update harmonyos source files 2026-04-29 23:30:02 +08:00
ce7d3b532f chore: remove remaining __pycache__ files, add .gitignore 2026-04-28 17:09:37 +08:00
4bfa4673be chore: clean harmonyos branch - keep only DevEco source files (57 files) 2026-04-28 17:09:15 +08:00
e6dc56b985 chore: remove HarmonyOS build cache files from git tracking (69 files) 2026-04-28 17:06:09 +08:00
11ee329943 refactor: move HarmonyOS project files from harmony/ to branch root 2026-04-28 16:52:05 +08:00
4c32dbb949 chore: remove legacy .gitignore, only keep HarmonyOS project files 2026-04-28 16:46:09 +08:00
5c59cd2ceb refactor: clean harmonyos branch to only contain HarmonyOS project in harmony/ 2026-04-28 16:34:34 +08:00
e83151bd1e refactor: move harmonyos project to harmony/ directory 2026-04-28 16:32:04 +08:00
2a42183aaa feat: 合并星图和聊天页面为 MainPage,响应式 GridRow 布局
- 新建 MainPage.ets,用 GridRow 响应式布局组合星图+聊天
- Index.ets 改为 2 Tab(TrulyMEM + 设置)
- GraphPage/ChatPage 接收 @Prop db 从父组件传入
- 恢复 README.md / README_EN.md 的特别鸣谢部分
2026-04-28 13:53:06 +08:00
7c2441682c feat: 纯血鸿蒙 ArkTS 工程(harmonyos 分支)
- 新增 harmonyos/ 目录:完整 ArkTS 项目
  - GraphDatabase.ets:@ohos.data.relationalStore 图数据库
  - Index.ets:Tabs 导航(星图|聊天|设置)
  - GraphPage.ets:WebView 星图(Three.js 3D)
  - ChatPage.ets:聊天 + HTTP AI API 调用
  - SettingsPage.ets:@ohos.data.preferences 配置
  - graph.html:Three.js 力导向星图可视化
- 删除:ui/ TUI 代码、core/migrate.py 多用户迁移、trulymem_entry.py
- 配置:build-profile.json5, module.json5, permissions
2026-04-28 12:38:21 +08:00
14bbcfde3d chore: 清理误提交的构建产物,添加 .gitignore 规则 2026-04-28 12:34:33 +08:00
be6555cca1 chore: 删除 TUI/多用户/CLI 代码,准备鸿蒙工程 2026-04-28 12:34:26 +08:00
c4f7b5a645 feat: 入口添加 --web 参数,二进制可直接启动 Web headless 服务 2026-04-28 11:24:15 +08:00
1a971fee73 fix: 修复 PyInstaller 构建
- 修复 spec 文件中 project_root 路径计算(需向上两级)
- 修复 datas 目标路径:PyInstaller data tuple 的第二个元素必须是目录路径,而非文件路径
- 移除 PYZ(block_cipher) 参数避免 TypeError
2026-04-28 11:05:55 +08:00
4770b3b990 refactor: Web 服务内嵌主进程 + 文档移到 docs/ 二级目录
1. Web 服务改为 threading 模式:
   - 新增 run_web_server(port) / stop_web_server() 函数
   - TUI 通过 from web_api import run_web_server 直接调用
   - 使用 werkzeug make_server 实现线程内优雅启动/停止
2. 构建脚本精简为单二进制:
   - 移除 trulymem-web 独立打包步骤
   - 添加 werkzeug 到 hidden-imports
3. 详细启动文档移到 docs/zh/quick_start.md
4. README 精简为概述,指向 docs/ 目录
2026-04-28 10:50:24 +08:00
aefaea7b90 docs: 更新 README 适配多用户+Admin 角色系统
- 移除旧的 web_config.example.json 指引(已替换为首次访问自动设置)
- 新增 TUI 登录引导描述
- 新增多用户隔离目录结构说明
- 新增 Admin/User 角色权限说明
- 新增打包构建双入口说明
2026-04-28 10:42:53 +08:00
05fc252db0 fix: 已有用户自动迁移 admin 角色
当 role 列通过 ALTER TABLE 新增后,已有用户全部为 'user'。
新增迁移逻辑:若无 admin 用户,自动将首个注册用户升为 admin。
2026-04-28 10:38:42 +08:00
b4456a9c5b 多用户系统 + Admin 角色权限 + Web/TUI 同步 + 构建集成
本轮实现功能:
1. 多用户隔离:每个用户独立 config.json + graph.db
2. TUI 登录页 + 旧版自动迁移(core/migrate.py)
3. Admin/User 角色体系(core/embedded_db.py)
4. Web 后台管理 API(userinfo + admin CRUD)
5. Web 设置页用户管理区(仅 admin 可见)
6. TUI 侧栏配置区权限同步(非 admin 隐藏 Web 服务设置)
7. Web 服务打包为独立二进制(trulymem-web)
8. 双入口 PyInstaller 构建脚本(TUI + Web)
9. 活动记录器(core/activity_recorder.py)
10. 静态页面模板(登录/设置/首次引导)
2026-04-28 10:37:57 +08:00
46008c14c5 feat: web login system, auto-load history, config extraction
- Add Flask session-based authentication (username/password login)
- Auto-load chat history from backend on page load
- Extract SECRET_KEY and user credentials to web_config.json
- Create web_config.example.json as template
- Add web_config.json to .gitignore (sensitive info)
- Update docs: architecture, API reference, quick start guides
2026-04-28 09:25:47 +08:00
0ebd1d7ac6 docs: sync documentation with source code
- Fix branch badge: test -> main in README files
- Update tool_limits config: remove non-existent persona_query_max and task_query_max fields
- Complete memory tools list: add memory_archive, memory_cleanup, context_rewrite
- Remove 'experimental' labels from context_rewrite feature
2026-04-17 10:08:50 +08:00
de09eacabc fix: 修复 AppImage 构建脚本的多个问题
- 创建缺失的 usr/share/trulymem 目录
- 修复 desktop 文件分类,使用 X-AI 替代非标准的 AI
- 改进图标文件查找逻辑,支持多个可能的位置
- 添加完整的构建临时文件清理逻辑
- 成功时自动删除 AppDir,失败时保留以便调试

🤖 Generated with CodeArts Agent
2026-04-17 08:27:52 +08:00
14af13c050 update: 更新文件 README_EN.md
Signed-off-by: JianFeeeee <2198972886@qq.com>
2026-04-16 23:31:38 +08:00
47c5b99617 update: 更新文件 README.md
Signed-off-by: JianFeeeee <2198972886@qq.com>
2026-04-16 23:30:53 +08:00
e975fe409b !1 merge test into main
新增 context_rewrite 工具优化系统提示词

Created-by: JianFeeeee
Commit-by: JianFeeeee;root
Merged-by: JianFeeeee
Description: feat: 添加 context_rewrite 工具并清理工具限制器死配置
test: 修复测试套件结构问题
fix: 修复 context_rewrite 工具调用问题并优化系统提示词

See merge request: JianFeeeee/TrulyMEM-TrueHumanMEM!1
2026-04-16 23:28:54 +08:00
0270e17a76 fix: 修复 context_rewrite 工具调用问题并优化系统提示词
1. 修复 context_rewrite 导致的 API 错误

   - 删除错误的 tool 结果消息添加逻辑

   - 添加 context_compressed 标记让 AI 识别压缩结果

   - 将 context_rewrite 记录到 tool_calls 以便 TUI 显示

2. 优化系统提示词

   - 添加强制触发条件:每5次记忆工具调用必须调用 context_rewrite

   - 强化指代词处理规则:必须通过工作记忆链解析

   - 扩展时间指代词:添加刚刚

   - 更新执行检查清单

Generated with CodeArts Agent
2026-04-16 23:27:35 +08:00
fc5335a5c6 test: 修复测试套件结构问题
- 将 test_ui/__init__.py 中的测试代码移至 test_ui/test_ui.py
- 将 test_integration/__init__.py 中的测试代码移至 test_integration/test_integration.py
- 删除 test_packet.py 中重复的 TestToolLimiter 和 TestEmbeddedGraphDB
- 将 TestPacketTypeEnum 的 9 个重复测试合并为参数化测试
- 移除 conftest.py 中从未使用的 6 个 fixtures
- 修复 3 个预存测试 bug (update_config 不存在、limiter 断言、error 处理)
2026-04-16 14:53:38 +08:00
2aa6e9240f feat: 添加 context_rewrite 工具并清理工具限制器死配置
- 新增 context_rewrite 工具:允许 AI 在单轮内压缩工具调用上下文
- 清理 persona_query_max 和 task_query_max 死配置(commit 9be60ba 引入)
- 同步全栈:后端/前端/文档/测试 18 个文件
- 测试:70/70 通过
2026-04-16 14:33:21 +08:00
535fca933a fix: 修复工具调用限制器误判问题并优化记忆查询
1. 工具调用限制器修复 - 移除memory_recall关键词智能分类,统一归类为一般记忆查询

2. 工作记忆链限制调整 - 修改限制从2次/轮到5次/轮

3. 广度优先搜索实现 - 修复depth参数被忽略问题,添加深度标注

4. 提示词优化 - 新增强制执行顺序说明,明确task_link_info使用场景

Generated with CodeArts Agent
2026-04-16 08:35:54 +08:00
b7b2601180 feat: 将前端等待超时时间从30秒调整为5分钟
- 修改 core/server.py 中的响应超时时间

- 从 30 秒调整为 300 秒(5 分钟)

- 解决长对话超时中断问题
2026-04-15 23:01:06 +08:00
a1b60ed936 delete: 删除文件 TrulyMEM.spec
Signed-off-by: JianFeeeee <2198972886@qq.com>
2026-04-15 16:38:21 +08:00
f9b57bfa73 build: 添加 AppImage 打包脚本
- 新增 build_appimage.sh 脚本,支持先构建二进制再打包为 AppImage
- 二进制输出到 dist/ 目录
- AppDir 结构支持跨发行版兼容
2026-04-15 13:22:54 +08:00
09a45c52e7 docs: 修正 API 文档响应结构描述 + 添加缺失测试
- 修正 PROCESS_MESSAGE 响应数据访问路径 (result['content'] -> result['data']['content'])
- 添加 CLEAR_HISTORY 文档说明 (基于 SAVE_HISTORY 空消息实现)
- 添加 test_clear_history 和 test_send_message_is_alias 测试用例
- 优化 BackendClient 历史相关方法的返回值处理
2026-04-15 12:09:48 +08:00
a8dc24e7f3 fix: 修复UI层导入问题和历史加载逻辑 2026-04-15 11:15:51 +08:00
a282ec1a58 fix: 简化清空逻辑 - 空消息列表即清空 2026-04-15 11:10:29 +08:00
b86610d445 feat: 添加数据库迁移、清空聊天记录按钮 - 复用SAVE_HISTORY接口 2026-04-15 11:07:06 +08:00
adc7857344 test: 添加UI层历史加载测试,更新方法名称 2026-04-15 10:53:30 +08:00
b1db660d70 refactor: 合并配置相关Packet类型为GET_SETTINGS/SET_SETTINGS 2026-04-15 10:50:27 +08:00