mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-10-15 12:15:32 +00:00
fix: 修复UI层导入问题和历史加载逻辑
This commit is contained in:
45
TrulyMEM.spec
Normal file
45
TrulyMEM.spec
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
from PyInstaller.utils.hooks import collect_all
|
||||||
|
|
||||||
|
datas = [('ui/styles', 'ui/styles'), ('core/prompts/templates', 'core/prompts/templates')]
|
||||||
|
binaries = []
|
||||||
|
hiddenimports = ['textual', 'textual.app', 'textual.widgets', 'textual.css', 'openai', 'openai._client', 'neo4j', 'sqlite3', 'core', 'core.embedded_db', 'core.graph_client', 'core.tool_executor', 'core.tool_limiter', 'core.tools', 'core.tools.memory_tools', 'core.prompts', 'core.prompts.prompt_manager', 'ui', 'ui.app', 'ui.models', 'ui.models.message', 'ui.models.config', 'ui.models.log_entry', 'ui.widgets', 'ui.handlers', 'ui.services', 'ui.services.config_manager', 'ui.services.config_service']
|
||||||
|
tmp_ret = collect_all('textual')
|
||||||
|
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['trulymem_entry.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=binaries,
|
||||||
|
datas=datas,
|
||||||
|
hiddenimports=hiddenimports,
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
optimize=0,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='TrulyMEM',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
||||||
11
ui/app.py
11
ui/app.py
@ -59,6 +59,7 @@ class GraphMemoryApp(App):
|
|||||||
|
|
||||||
def on_mount(self) -> None:
|
def on_mount(self) -> None:
|
||||||
from .widgets.status_bar import StatusBar
|
from .widgets.status_bar import StatusBar
|
||||||
|
from .widgets.message_history import MessageHistory
|
||||||
status_bar = self.query_one(StatusBar)
|
status_bar = self.query_one(StatusBar)
|
||||||
|
|
||||||
if not self._backend_server:
|
if not self._backend_server:
|
||||||
@ -74,17 +75,15 @@ class GraphMemoryApp(App):
|
|||||||
self._api_configured = data.get("config", {}).get("api_key", "") != ""
|
self._api_configured = data.get("config", {}).get("api_key", "") != ""
|
||||||
status_bar.set_api_status(self._api_configured)
|
status_bar.set_api_status(self._api_configured)
|
||||||
|
|
||||||
|
history = self.query_one(MessageHistory)
|
||||||
|
|
||||||
if self._api_configured:
|
if self._api_configured:
|
||||||
result = self._backend_client.get_history()
|
chat_history = self._backend_client.get_history()
|
||||||
if result.get("success"):
|
if chat_history:
|
||||||
history_data = result.get("data", {})
|
|
||||||
chat_history = history_data.get("history", [])
|
|
||||||
history = self.query_one(MessageHistory)
|
|
||||||
for msg in chat_history:
|
for msg in chat_history:
|
||||||
message = Message(role=msg["role"], content=msg["content"])
|
message = Message(role=msg["role"], content=msg["content"])
|
||||||
history.add_message(message)
|
history.add_message(message)
|
||||||
|
|
||||||
history = self.query_one(MessageHistory)
|
|
||||||
welcome = Message(
|
welcome = Message(
|
||||||
role="assistant",
|
role="assistant",
|
||||||
content=f"系统就绪\nAPI Key: {'已配置' if self._api_configured else '未配置'}\n\n输入消息开始对话"
|
content=f"系统就绪\nAPI Key: {'已配置' if self._api_configured else '未配置'}\n\n输入消息开始对话"
|
||||||
|
|||||||
Reference in New Issue
Block a user