fix(desktop): session persistence — refresh/login/context/empty-content 4-bug fix
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

1. App.tsx: add restoreSession() call on startup to prevent redirect
   to login page after refresh (isRestoring guard + BootstrapScreen)
2. CloneManager: call syncAgents() after loadClones() to restore
   currentAgent and conversation history on app load
3. zclaw-memory: add get_or_create_session() so frontend session UUID
   is persisted directly — kernel no longer creates mismatched IDs
4. openai.rs: assistant message content must be non-empty for
   Kimi/Qwen APIs — replace empty content with meaningful placeholders

Also includes admin-v2 ModelServices unified page (merge providers +
models + API keys into expandable row layout)
This commit is contained in:
iven
2026-03-31 13:38:59 +08:00
parent 3e5d64484e
commit 6cae768401
29 changed files with 1982 additions and 933 deletions

View File

@@ -645,15 +645,11 @@ impl Kernel {
// Reuse existing session or create new one
let session_id = match session_id_override {
Some(id) => {
// Verify the session exists; if not, create a new one
let existing = self.memory.get_messages(&id).await;
match existing {
Ok(msgs) if !msgs.is_empty() => id,
_ => {
tracing::debug!("Session {} not found or empty, creating new session", id);
self.memory.create_session(agent_id).await?
}
}
// Use get_or_create to ensure the frontend's session ID is persisted.
// This is the critical bridge: without it, the kernel generates a
// different UUID each turn, so conversation history is never found.
tracing::debug!("Reusing frontend session ID: {}", id);
self.memory.get_or_create_session(&id, agent_id).await?
}
None => self.memory.create_session(agent_id).await?,
};