Files
memind/ops/src/pages/admin/SummaryPage.tsx
T
john 6f3e53a56a feat(memory-v2): close Phase A with auto-review, product events, and H5 recall UI.
Add candidate auto-review pipeline, shadow audit tooling, admin metrics page,
and user-visible memory recall hints in chat with phase-a readiness checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 17:14:06 +08:00

87 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { fetchAdminSummary, type AdminSummary } from '../../api/admin';
function yuan(cents: number) {
return `¥${(cents / 100).toFixed(2)}`;
}
export function SummaryPage() {
const [summary, setSummary] = useState<AdminSummary | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
void fetchAdminSummary()
.then((r) => setSummary(r.summary))
.catch((err) => setError(err instanceof Error ? err.message : '加载失败'));
}, []);
if (error) return <p className="alert">{error}</p>;
if (!summary) return <p></p>;
return (
<div className="grid">
<div
className="card"
style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(160px, 1fr))', gap: 12 }}
>
<div>
<p style={{ color: '#68716c', marginBottom: 4 }}></p>
<strong style={{ fontSize: 28 }}>{summary.totalUsers}</strong>
</div>
<div>
<p style={{ color: '#68716c', marginBottom: 4 }}></p>
<strong style={{ fontSize: 28 }}>{summary.activeUsers}</strong>
</div>
<div>
<p style={{ color: '#68716c', marginBottom: 4 }}></p>
<strong style={{ fontSize: 28 }}>{yuan(summary.totalBalanceCents)}</strong>
</div>
</div>
{summary.llm ? (
<div className="card">
<h3 style={{ marginTop: 0 }}>LLM </h3>
<p>{summary.llm.keyCount} </p>
<p>{summary.llm.selectedKeyName ?? '(无)'}</p>
<p>{summary.llm.globalModel ?? '(未设置)'}</p>
</div>
) : (
<div className="card">
<p style={{ color: '#68716c' }}>LLM </p>
</div>
)}
<div
className="card"
style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(220px, 1fr))', gap: 12 }}
>
<div>
<h3 style={{ marginTop: 0, marginBottom: 8 }}></h3>
<p style={{ color: '#68716c', marginTop: 0 }}>
</p>
</div>
<Link className="btn" to="/admin/wechat" style={{ textAlign: 'center', textDecoration: 'none' }}>
</Link>
<Link className="btn secondary" to="/admin/agent-code-run" style={{ textAlign: 'center', textDecoration: 'none' }}>
Code Run
</Link>
<Link className="btn secondary" to="/admin/llm" style={{ textAlign: 'center', textDecoration: 'none' }}>
/ H5
</Link>
<Link className="btn secondary" to="/admin/memory-v2" style={{ textAlign: 'center', textDecoration: 'none' }}>
Memory V2
</Link>
<Link className="btn secondary" to="/admin/goal-runs" style={{ textAlign: 'center', textDecoration: 'none' }}>
Goal Run
</Link>
<Link className="btn secondary" to="/admin/users" style={{ textAlign: 'center', textDecoration: 'none' }}>
</Link>
</div>
</div>
);
}