MCPcopy Create free account
hub / github.com/diillson/chatcli / setMemoryProfile

Method setMemoryProfile

cli/memory_command.go:321–336  ·  view source on GitHub ↗

setMemoryProfile applies a "key=value" (or "key: value") profile update via /memory profile set.

(rest string)

Source from the content-addressed store, hash-verified

319// setMemoryProfile applies a "key=value" (or "key: value") profile update
320// via /memory profile set.
321func (cli *ChatCLI) setMemoryProfile(rest string) {
322 key, value, ok := splitProfileKV(rest)
323 if !ok {
324 fmt.Println(colorize(" "+i18n.T("mem.cmd.profile.set.usage"), ColorGray))
325 return
326 }
327 changed := cli.memoryStore.UpdateProfile(map[string]string{key: value})
328 if cli.contextBuilder != nil {
329 cli.contextBuilder.InvalidateCache()
330 }
331 if changed {
332 fmt.Printf(" %s %s\n", colorize("OK", ColorGreen), i18n.T("mem.cmd.profile.set.ok", key))
333 } else {
334 fmt.Printf(" %s %s\n", colorize("!", ColorYellow), i18n.T("mem.cmd.profile.set.nochange"))
335 }
336}
337
338// splitProfileKV splits "key=value" or "key: value" into its parts.
339func splitProfileKV(s string) (key, value string, ok bool) {

Callers 1

handleMemoryCommandMethod · 0.95

Calls 5

TFunction · 0.92
splitProfileKVFunction · 0.85
colorizeFunction · 0.85
UpdateProfileMethod · 0.65
InvalidateCacheMethod · 0.45

Tested by

no test coverage detected