3.4 KiB
3.4 KiB
Changelog
All notable changes made during this working session (March 1, 2026).
Token + performance optimizations
- Added
src/prompt.jsto centralize prompt construction (buildPrompt) and reduce repeated prompt-building logic. - Added a short-lived in-memory context cache in
src/bot.jsto reuse prepared context across the continuation loop and normal replies. - Reduced default memory/prompt sizes in
src/config.js:shortTermLimit: 10 -> 6summaryTriggerChars: 3000 -> 2200relevantMemoryCount: 5 -> 3- Added
longTermFetchLimit(default 120)
- Limited long-term memory retrieval to a recent window before similarity scoring in
src/memory.js(useslongTermFetchLimit). - Summarized live web-search intel before injecting it into the prompt (keeps the payload shorter) in
src/bot.js. - Debounced memory DB persistence in
src/memory.jsto batch multiple writes (instead of exporting/writing on every mutation).
Dashboard (local memory UI)
- Revamped the dashboard UI layout + styling in
src/public/index.html. - Added long-term memory create/edit support:
- API:
POST /api/users/:id/longinsrc/dashboard.js - Store:
upsertLongTerm()insrc/memory.js
- API:
- Added long-term memory pagination:
- API:
GET /api/users/:id/long?page=&per=returns{ rows, total, page, per, totalPages }viagetLongTermMemoriesPage()insrc/memory.js - UI: paging controls; long-term list shows 15 per page (
LONG_TERM_PER_PAGE = 15)
- API:
- Added "search preview" UX in the dashboard to quickly reuse a similar memory result as an edit/create starting point ("Use this memory").
- Added a simple recall timeline:
- API:
GET /api/users/:id/timeline?days=insrc/dashboard.js - Store:
getMemoryTimeline()insrc/memory.js - UI: lightweight bar chart in
src/public/index.html
- API:
Fixes
- Fixed dashboard long-term pagination wiring (
getLongTermMemoriesPageimport/usage) insrc/dashboard.js. - Fixed dashboard long-term "Edit" button behavior by wiring row handlers in
src/public/index.html. - Prevented button interactions from crashing the bot on late/invalid updates by deferring updates and editing the message in
src/bot.js.
Discord-side features
- Added a memory-aware reaction badge: bot reacts with
🧠when long-term memories were injected into the prompt (src/bot.js). - Added a lightweight blackjack mini-game:
- Start via text trigger
/blackjack(not a registered slash command). - Single-embed game UI with button components for actions (Hit / Stand; Split is present as a placeholder).
- Improved interaction handling to avoid "Unknown interaction" crashes by deferring updates and editing the message (
src/bot.js).
- Start via text trigger
Reliability / guardrails
- Relaxed the "empty response" guard in
src/openai.js:- Still throws when the provider returns no choices.
- If choices exist but content is blank, returns an empty string instead of forcing fallback (reduces noisy false-positive failures).
Configuration / examples
- Updated
.env.exampleto includeOPENAI_API_KEY.
Global memory toggle (2026-03-03)
- Added
useGlobalMemoriestobuildPrompt, allowing long-term retrieval across every storeduser_idwithout losing the current user's short-term history. - Long-term results now carry their
user_idso the prompt can label each snippet (e.g.,- [userId] ...) and the retrieval scoring still ranks by cosine similarity plus importance.