fix(desktop): sidebar tab animation + memory deduplication
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. Fix sidebar tab switching: replace containerVariants (staggerChildren
   without motion children) with simple fade variants. The previous
   staggerChildren:0.05 caused the container to stay at opacity:0 when
   switching to CloneManager because non-motion children couldn't
   participate in stagger animation.

2. Fix memory deduplication: add content+agentId based dedup check
   in fallbackMemory.store(). Previously same content was stored 4x
   with different IDs. Now updates importance/accessCount instead.
This commit is contained in:
iven
2026-04-05 22:02:55 +08:00
parent bcaab50c56
commit b5993d4f43
2 changed files with 30 additions and 2 deletions

View File

@@ -6,7 +6,14 @@ import {
import { ConversationList } from './ConversationList';
import { CloneManager } from './CloneManager';
import { useChatStore } from '../store/chatStore';
import { containerVariants, defaultTransition } from '../lib/animations';
import { defaultTransition } from '../lib/animations';
// Simple fade variants for sidebar tab content (no staggerChildren)
const sidebarTabVariants = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.15 } },
exit: { opacity: 0, transition: { duration: 0.1 } },
};
export type MainViewType = 'chat' | 'automation' | 'skills';
@@ -109,7 +116,7 @@ export function Sidebar({
<AnimatePresence mode="wait">
<motion.div
key={activeTab}
variants={containerVariants}
variants={sidebarTabVariants}
initial="hidden"
animate="visible"
exit="exit"

View File

@@ -46,6 +46,27 @@ export const fallbackMemory = {
async store(entry: MemoryEntryInput): Promise<string> {
const store = getFallbackStore();
// Content-based deduplication: update existing entry with same agentId + content
const normalizedContent = entry.content.trim().toLowerCase();
const existingIdx = store.memories.findIndex(
m => m.agentId === entry.agent_id && m.content.trim().toLowerCase() === normalizedContent
);
if (existingIdx >= 0) {
// Update existing entry instead of creating duplicate
const existing = store.memories[existingIdx];
store.memories[existingIdx] = {
...existing,
importance: Math.max(existing.importance, entry.importance ?? 5),
lastAccessedAt: new Date().toISOString(),
accessCount: existing.accessCount + 1,
tags: [...new Set([...existing.tags, ...(entry.tags ?? [])])],
};
saveFallbackStore(store);
return existing.id;
}
const id = `mem_${Date.now()}_${generateRandomString(6)}`;
const now = new Date().toISOString();