返回 DeepSeek-Reasonix
memory.go
根目录 / internal / cli / memory.go
1 package cli
2
3 import (
4 "fmt"
5 "strings"
6
7 "reasonix/internal/control"
8 "reasonix/internal/i18n"
9 )
10
11 // showMemory reports what memory is loaded and where it lives — the TUI analog
12 // of Claude Code's /memory. It surfaces the doc files and the auto-memory store
13 // path so the user can open and edit them directly, since the in-terminal UI
14 // doesn't shell out to an editor.
15 func (m *chatTUI) showMemory(input string) {
16 args := strings.TrimSpace(strings.TrimPrefix(input, "/memory"))
17 if args == "" {
18 m.commitLine(renderMemory(m.width, m.ctrl.Memory()))
19 return
20 }
21 m.commitLine(viewProtectLines(control.MemoryCommandText(m.ctrl, args), m.width))
22 }
23
24 // forgetMemory deletes a saved auto-memory by name (the slug shown in /memory).
25 // It is the manual counterpart to the model's `forget` tool.
26 func (m *chatTUI) forgetMemory(name string) {
27 if name == "" {
28 m.notice(i18n.M.ForgetUsage)
29 return
30 }
31 if err := m.ctrl.ForgetMemory(name); err != nil {
32 m.notice(fmt.Sprintf("forget: %v", err))
33 return
34 }
35 m.notice(fmt.Sprintf(i18n.M.ForgetDoneFmt, name))
36 }
37
37 lines GO