Files
links/static_src/jbot/components/MemoryPanel.jsx
T
junvandCopilot a87b4643fd feat: port JBOT AI robot face into links as Django app
- Add jbot Django app (jbot/__init__.py, apps.py, urls.py, api_urls.py)
- Python backend (jbot/views.py): TTS 2.0, ASR 1.0 BigASR, LLM/memory via OpenRouter
- React SPA frontend at /jbot/ (static_src/jbot/): RobotFace, ChatPanel, expressions,
  voices, push-to-talk, history, memory, settings pages
- Vite entry jbot: static_src/jbot/main.jsx → dist/jbot.js + dist/jbot.css
- react-router-dom added; BrowserRouter basename=/jbot for SPA routing
- core/settings.py: added jbot to INSTALLED_APPS
- core/urls.py: /jbot/ + /api/jbot/ URL includes
- pyproject.toml: websocket-client>=1.9.0 for BigASR binary WS protocol
- Dockerfile: ffmpeg added to production apt-get for WebM→PCM audio conversion
- k8s/manifest.yaml: VOLC_APP_ID, VOLC_ACCESS_TOKEN, OPENROUTER_API_KEY env vars
  via jbot-credentials Secret; LLM_MODEL, VOLC_TTS_VOICE, VOLC_ASR_RESOURCE defaults

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-17 14:13:37 +10:00

48 lines
1.5 KiB
React
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 { useState } from 'react';
import { deleteMemory, clearMemories } from '../store/memoryStore';
export default function MemoryPanel({ memories, onMemoriesChange }) {
const [open, setOpen] = useState(false);
const handleDelete = (id) => {
deleteMemory(id);
onMemoriesChange();
};
const handleClear = () => {
if (!window.confirm('清空所有记忆?')) return;
clearMemories();
onMemoriesChange();
};
return (
<div className="memory-panel">
<button className="memory-toggle" onClick={() => setOpen(o => !o)}>
<span>🧠 长期记忆</span>
<span className="memory-badge">{memories.length}</span>
<span className="memory-arrow">{open ? '▲' : '▼'}</span>
</button>
{open && (
<div className="memory-body">
{memories.length === 0 ? (
<p className="memory-empty">对话后会自动记住关于你的信息</p>
) : (
<>
<ul className="memory-list">
{memories.map(m => (
<li key={m.id} className="memory-item">
<span className="memory-text">{m.text}</span>
<button className="memory-del" onClick={() => handleDelete(m.id)} title="删除">×</button>
</li>
))}
</ul>
<button className="memory-clear" onClick={handleClear}>清空全部</button>
</>
)}
</div>
)}
</div>
);
}