canonicalMemoryCmd folds aliases into the four canonical names.
(s string)
| 338 | |
| 339 | // canonicalMemoryCmd folds aliases into the four canonical names. |
| 340 | func canonicalMemoryCmd(s string) string { |
| 341 | switch strings.ToLower(strings.TrimSpace(s)) { |
| 342 | case "remember", "add", "store", "note": |
| 343 | return "remember" |
| 344 | case "profile", "profile_set", "user": |
| 345 | return "profile" |
| 346 | case "forget", "remove", "delete": |
| 347 | return "forget" |
| 348 | case "recall", "read", "get", "search": |
| 349 | return "recall" |
| 350 | case "neighbors", "related", "links", "backlinks", "connected": |
| 351 | return "neighbors" |
| 352 | case "map", "graph", "moc", "overview": |
| 353 | return "map" |
| 354 | } |
| 355 | return "" |
| 356 | } |
| 357 | |
| 358 | // parseProfileFields extracts the key/value map from a profile invocation. |
| 359 | // It accepts {"fields":{...}} as well as a bare object {key:value,...} so |
no outgoing calls