mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-15 03:55:09 +08:00
refactor(ui): redesign Memory view — follow mc-page-shell design system
This commit is contained in:
parent
8ecc6d10ca
commit
30b9912ded
@ -1782,7 +1782,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
memory: {
|
memory: {
|
||||||
|
kicker: 'Memory',
|
||||||
title: 'Memory',
|
title: 'Memory',
|
||||||
|
desc: 'What your Agent thinks about, remembers, and lets go.',
|
||||||
selectAgent: 'Select Agent',
|
selectAgent: 'Select Agent',
|
||||||
selectAgentHint: 'Select an agent to view its memory',
|
selectAgentHint: 'Select an agent to view its memory',
|
||||||
tabTimeline: 'Dream Timeline',
|
tabTimeline: 'Dream Timeline',
|
||||||
|
|||||||
@ -1792,7 +1792,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
memory: {
|
memory: {
|
||||||
title: '记忆管理',
|
kicker: 'Memory',
|
||||||
|
title: '记忆',
|
||||||
|
desc: '你的 Agent 在想什么、记住了什么、遗忘了什么。',
|
||||||
selectAgent: '选择 Agent',
|
selectAgent: '选择 Agent',
|
||||||
selectAgentHint: '请先选择一个 Agent 查看其记忆',
|
selectAgentHint: '请先选择一个 Agent 查看其记忆',
|
||||||
tabTimeline: 'Dream 时间线',
|
tabTimeline: 'Dream 时间线',
|
||||||
|
|||||||
@ -1,47 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dream-timeline">
|
<div class="dream-timeline">
|
||||||
<div v-if="store.loading" class="loading-state">
|
<div v-if="store.loading" class="loading-state">
|
||||||
<el-skeleton :rows="5" animated />
|
<div class="skeleton-card mc-surface-card" v-for="i in 3" :key="i">
|
||||||
|
<el-skeleton :rows="2" animated />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-empty v-else-if="store.reports.length === 0" :description="t('memory.noReports')" />
|
<div v-else-if="store.reports.length === 0" class="empty-state">
|
||||||
|
<div class="empty-icon">🌙</div>
|
||||||
|
<p>{{ t('memory.noReports') }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-else class="timeline-list">
|
<div v-else class="timeline-cards">
|
||||||
<div
|
<div
|
||||||
v-for="report in store.reports"
|
v-for="report in store.reports"
|
||||||
:key="report.id"
|
:key="report.id"
|
||||||
class="timeline-item"
|
class="dream-card mc-surface-card"
|
||||||
:class="{ active: selectedId === report.id }"
|
:class="{ selected: selectedId === report.id }"
|
||||||
@click="selectReport(report)"
|
@click="selectReport(report)"
|
||||||
>
|
>
|
||||||
<div class="timeline-dot" :class="report.status.toLowerCase()" />
|
<div class="card-top">
|
||||||
<div class="timeline-content">
|
<span class="status-dot" :class="report.status.toLowerCase()" />
|
||||||
<div class="timeline-header">
|
<span class="card-mode">{{ report.mode }}</span>
|
||||||
<el-tag :type="modeTagType(report.mode)" size="small">{{ report.mode }}</el-tag>
|
<span class="card-time">{{ formatRelativeTime(report.startedAt) }}</span>
|
||||||
<span class="timeline-time">{{ formatTime(report.startedAt) }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="timeline-meta">
|
|
||||||
<span v-if="report.topic" class="topic">{{ report.topic }}</span>
|
|
||||||
<span class="counts">
|
|
||||||
+{{ report.promotedCount }} / -{{ report.rejectedCount }} / {{ report.candidateCount }} candidates
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="report.llmReason" class="timeline-reason">{{ truncate(report.llmReason, 80) }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="report.topic" class="card-topic">{{ report.topic }}</div>
|
||||||
|
|
||||||
|
<div class="card-stats">
|
||||||
|
<span class="stat promoted">+{{ report.promotedCount }}</span>
|
||||||
|
<span class="stat rejected">-{{ report.rejectedCount }}</span>
|
||||||
|
<span class="stat total">{{ report.candidateCount }} candidates</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-if="report.llmReason" class="card-reason">{{ truncate(report.llmReason, 120) }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pagination-wrapper">
|
<div v-if="store.total > pageSize" class="pagination-wrap">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
v-model:current-page="currentPage"
|
v-model:current-page="currentPage"
|
||||||
:page-size="pageSize"
|
:page-size="pageSize"
|
||||||
:total="store.total"
|
:total="store.total"
|
||||||
layout="prev, pager, next"
|
layout="prev, pager, next"
|
||||||
|
small
|
||||||
@current-change="onPageChange"
|
@current-change="onPageChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Detail panel -->
|
<!-- Detail drawer -->
|
||||||
<DreamReportPanel v-if="selectedId" :report="store.currentReport" @close="selectedId = null" />
|
<DreamReportPanel v-if="selectedId" :report="store.currentReport" @close="selectedId = null" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -79,14 +86,17 @@ function selectReport(report: DreamReportItem) {
|
|||||||
store.fetchReport(props.agentId, report.id)
|
store.fetchReport(props.agentId, report.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function modeTagType(mode: string) {
|
function formatRelativeTime(isoStr: string) {
|
||||||
return mode === 'FOCUSED' ? 'warning' : 'info'
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatTime(isoStr: string) {
|
|
||||||
if (!isoStr) return ''
|
if (!isoStr) return ''
|
||||||
const d = new Date(isoStr)
|
const d = new Date(isoStr)
|
||||||
return d.toLocaleString()
|
const now = new Date()
|
||||||
|
const diffMs = now.getTime() - d.getTime()
|
||||||
|
const diffH = Math.floor(diffMs / 3600000)
|
||||||
|
if (diffH < 1) return 'just now'
|
||||||
|
if (diffH < 24) return `${diffH}h ago`
|
||||||
|
const diffD = Math.floor(diffH / 24)
|
||||||
|
if (diffD < 7) return `${diffD}d ago`
|
||||||
|
return d.toLocaleDateString()
|
||||||
}
|
}
|
||||||
|
|
||||||
function truncate(str: string, max: number) {
|
function truncate(str: string, max: number) {
|
||||||
@ -96,72 +106,91 @@ function truncate(str: string, max: number) {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.dream-timeline {
|
.dream-timeline {
|
||||||
position: relative;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
.timeline-list {
|
.timeline-cards {
|
||||||
padding-left: 20px;
|
display: flex;
|
||||||
border-left: 2px solid var(--el-border-color-lighter);
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
}
|
}
|
||||||
.timeline-item {
|
.dream-card {
|
||||||
position: relative;
|
padding: 16px 20px;
|
||||||
padding: 12px 16px;
|
border-radius: 12px;
|
||||||
margin-bottom: 8px;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background-color 0.2s;
|
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||||
}
|
}
|
||||||
.timeline-item:hover {
|
.dream-card:hover {
|
||||||
background-color: var(--el-fill-color-light);
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.06);
|
||||||
}
|
}
|
||||||
.timeline-item.active {
|
.dream-card.selected {
|
||||||
background-color: var(--el-color-primary-light-9);
|
border-color: var(--el-color-primary);
|
||||||
|
box-shadow: 0 0 0 2px var(--el-color-primary-light-8);
|
||||||
}
|
}
|
||||||
.timeline-dot {
|
.card-top {
|
||||||
position: absolute;
|
|
||||||
left: -27px;
|
|
||||||
top: 18px;
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: var(--el-color-info);
|
|
||||||
}
|
|
||||||
.timeline-dot.success { background: var(--el-color-success); }
|
|
||||||
.timeline-dot.failed { background: var(--el-color-danger); }
|
|
||||||
.timeline-dot.skipped { background: var(--el-color-warning); }
|
|
||||||
.timeline-header {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
|
||||||
.timeline-time {
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--el-text-color-secondary);
|
color: var(--el-text-color-secondary);
|
||||||
}
|
}
|
||||||
.timeline-meta {
|
.status-dot {
|
||||||
margin-top: 4px;
|
width: 8px;
|
||||||
font-size: 13px;
|
height: 8px;
|
||||||
color: var(--el-text-color-regular);
|
border-radius: 50%;
|
||||||
|
background: var(--el-color-info-light-3);
|
||||||
}
|
}
|
||||||
.timeline-meta .topic {
|
.status-dot.success { background: var(--el-color-success); }
|
||||||
|
.status-dot.failed { background: var(--el-color-danger); }
|
||||||
|
.status-dot.skipped { background: var(--el-color-warning); }
|
||||||
|
.card-mode {
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
.card-time { margin-left: auto; }
|
||||||
|
.card-topic {
|
||||||
|
margin-top: 8px;
|
||||||
|
font-size: 15px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-right: 8px;
|
color: var(--el-text-color-primary);
|
||||||
}
|
}
|
||||||
.timeline-meta .counts {
|
.card-stats {
|
||||||
color: var(--el-text-color-secondary);
|
margin-top: 8px;
|
||||||
font-size: 12px;
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
.timeline-reason {
|
.stat.promoted { color: var(--el-color-success); font-weight: 600; }
|
||||||
margin-top: 4px;
|
.stat.rejected { color: var(--el-color-danger-light-3); }
|
||||||
|
.stat.total { color: var(--el-text-color-secondary); }
|
||||||
|
.card-reason {
|
||||||
|
margin-top: 6px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--el-text-color-secondary);
|
color: var(--el-text-color-secondary);
|
||||||
font-style: italic;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
.pagination-wrapper {
|
.pagination-wrap {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.loading-state {
|
.loading-state {
|
||||||
padding: 20px;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
.skeleton-card {
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 48px 0;
|
||||||
|
color: var(--el-text-color-placeholder);
|
||||||
|
}
|
||||||
|
.empty-icon { font-size: 32px; margin-bottom: 12px; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,35 +1,61 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="memory-view">
|
<div class="mc-page-shell memory-shell">
|
||||||
<div class="memory-header">
|
<div class="mc-page-frame memory-frame">
|
||||||
<h2>{{ t('memory.title') }}</h2>
|
<div class="mc-page-inner memory-inner">
|
||||||
<el-select v-model="selectedAgentId" :placeholder="t('memory.selectAgent')" style="width: 200px" @change="onAgentChange">
|
<div class="mc-page-header">
|
||||||
<el-option v-for="agent in agents" :key="agent.id" :label="agent.name" :value="agent.id" />
|
<div>
|
||||||
</el-select>
|
<div class="mc-page-kicker">{{ t('memory.kicker') }}</div>
|
||||||
</div>
|
<h1 class="mc-page-title">{{ t('memory.title') }}</h1>
|
||||||
|
<p class="mc-page-desc">{{ t('memory.desc') }}</p>
|
||||||
|
</div>
|
||||||
|
<el-select
|
||||||
|
v-model="selectedAgentId"
|
||||||
|
:placeholder="t('memory.selectAgent')"
|
||||||
|
class="agent-selector"
|
||||||
|
@change="onAgentChange"
|
||||||
|
>
|
||||||
|
<el-option v-for="agent in agents" :key="agent.id" :label="agent.name" :value="agent.id" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<el-tabs v-model="activeTab" class="memory-tabs">
|
<!-- Morning Card -->
|
||||||
<el-tab-pane :label="t('memory.tabTimeline')" name="timeline">
|
<MorningCard v-if="selectedAgentId" :agent-id="selectedAgentId" />
|
||||||
<DreamTimeline v-if="selectedAgentId" :agent-id="selectedAgentId" />
|
|
||||||
<el-empty v-else :description="t('memory.selectAgentHint')" />
|
<!-- Tab navigation: minimal, no borders -->
|
||||||
</el-tab-pane>
|
<div class="memory-nav">
|
||||||
<el-tab-pane :label="t('memory.tabMemory')" name="memory" disabled>
|
<button
|
||||||
<el-empty description="Phase 2b" />
|
v-for="tab in tabs"
|
||||||
</el-tab-pane>
|
:key="tab.key"
|
||||||
<el-tab-pane :label="t('memory.tabProfile')" name="profile" disabled>
|
class="memory-nav-btn"
|
||||||
<el-empty description="Phase 2b" />
|
:class="{ active: activeTab === tab.key, disabled: tab.disabled }"
|
||||||
</el-tab-pane>
|
:disabled="tab.disabled"
|
||||||
<el-tab-pane :label="t('memory.tabFacts')" name="facts" disabled>
|
@click="activeTab = tab.key"
|
||||||
<el-empty description="Phase 3" />
|
>
|
||||||
</el-tab-pane>
|
{{ tab.label }}
|
||||||
</el-tabs>
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<div class="memory-content">
|
||||||
|
<DreamTimeline v-if="activeTab === 'timeline' && selectedAgentId" :agent-id="selectedAgentId" />
|
||||||
|
<div v-else-if="!selectedAgentId" class="empty-state">
|
||||||
|
<p>{{ t('memory.selectAgentHint') }}</p>
|
||||||
|
</div>
|
||||||
|
<div v-else class="empty-state">
|
||||||
|
<p>Coming soon</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useAgentStore } from '@/stores/useAgentStore'
|
import { useAgentStore } from '@/stores/useAgentStore'
|
||||||
import DreamTimeline from './components/DreamTimeline.vue'
|
import DreamTimeline from './components/DreamTimeline.vue'
|
||||||
|
import MorningCard from './components/MorningCard.vue'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const agentStore = useAgentStore()
|
const agentStore = useAgentStore()
|
||||||
@ -37,6 +63,13 @@ const agents = ref<any[]>([])
|
|||||||
const selectedAgentId = ref<number | null>(null)
|
const selectedAgentId = ref<number | null>(null)
|
||||||
const activeTab = ref('timeline')
|
const activeTab = ref('timeline')
|
||||||
|
|
||||||
|
const tabs = computed(() => [
|
||||||
|
{ key: 'timeline', label: t('memory.tabTimeline'), disabled: false },
|
||||||
|
{ key: 'memory', label: t('memory.tabMemory'), disabled: true },
|
||||||
|
{ key: 'profile', label: t('memory.tabProfile'), disabled: true },
|
||||||
|
{ key: 'facts', label: t('memory.tabFacts'), disabled: true },
|
||||||
|
])
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await agentStore.fetchAgents()
|
await agentStore.fetchAgents()
|
||||||
agents.value = agentStore.agents
|
agents.value = agentStore.agents
|
||||||
@ -46,27 +79,64 @@ onMounted(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function onAgentChange() {
|
function onAgentChange() {
|
||||||
// DreamTimeline watches agentId prop
|
activeTab.value = 'timeline'
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.memory-view {
|
.memory-shell {
|
||||||
padding: 20px;
|
--memory-max-width: 960px;
|
||||||
max-width: 1200px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
.memory-header {
|
.memory-frame {
|
||||||
|
max-width: var(--memory-max-width);
|
||||||
|
}
|
||||||
|
.agent-selector {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Minimal tab navigation — inspired by Apple's segment control */
|
||||||
|
.memory-nav {
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
|
margin: 24px 0 16px;
|
||||||
|
padding: 3px;
|
||||||
|
background: var(--el-fill-color-light);
|
||||||
|
border-radius: 8px;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
.memory-nav-btn {
|
||||||
|
padding: 6px 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: transparent;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--el-text-color-secondary);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.memory-nav-btn:hover:not(.disabled) {
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
}
|
||||||
|
.memory-nav-btn.active {
|
||||||
|
background: var(--el-bg-color);
|
||||||
|
color: var(--el-text-color-primary);
|
||||||
|
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
|
||||||
|
}
|
||||||
|
.memory-nav-btn.disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.memory-content {
|
||||||
|
min-height: 300px;
|
||||||
|
}
|
||||||
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
margin-bottom: 20px;
|
min-height: 200px;
|
||||||
}
|
color: var(--el-text-color-placeholder);
|
||||||
.memory-header h2 {
|
font-size: 14px;
|
||||||
margin: 0;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
.memory-tabs {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user