Files
TrulyMEM-TrueHumanMEM-local/harmonyos/entry/src/main/ets/pages/GraphPage.ets
root 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

37 lines
1.1 KiB
Plaintext

import web_webview from '@ohos.web.webview';
import { GraphDatabase } from '../model/GraphDatabase';
@Component
export struct GraphPage {
private controller: web_webview.WebviewController = new web_webview.WebviewController();
private db: GraphDatabase;
build() {
Column() {
Web({ src: $rawfile('graph.html'), controller: this.controller })
.javaScriptAccess(true)
.onMessageReceive((msg) => {
if (msg.data === 'request_graph_data') {
this.sendGraphData();
}
})
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
async sendGraphData() {
const result = await this.db.introspect();
if (result.success) {
const jsonStr = JSON.stringify(result.data);
this.controller.runJavaScriptExt('loadGraphData(' + jsonStr + ')', (error, data) => {
if (error) {
console.error('runJavaScriptExt error: ' + JSON.stringify(error));
}
});
}
}
}