Let the assistant propose what to remember, and the operator decide what is kept
This commit is contained in:
@@ -207,6 +207,37 @@ if ($action === 'memory_set') {
|
||||
exit;
|
||||
}
|
||||
|
||||
// ── learned-memory proposals ──────────────────────────────────────────────────
|
||||
// The store the assistant files candidates into. Accepting is the only path by which model-written
|
||||
// text reaches a prompt, and it is a POST so the CSRF prepend covers it.
|
||||
if ($action === 'mem_proposals') {
|
||||
require_once __DIR__ . '/../include/ai_memory_learn.php';
|
||||
$m = vv_ai_memory_read('learned');
|
||||
echo json_encode([
|
||||
'ok' => true,
|
||||
'enabled' => vv_ai_mem_learn_enabled(),
|
||||
'auto' => vv_ai_mem_learn_auto(),
|
||||
// The list states the gate as well as the rows: an empty list means "nothing proposed"
|
||||
// when learning is on and "nothing is looking" when it is off, and those are different.
|
||||
'open' => vv_ai_mem_list('open'),
|
||||
'recent' => array_slice(vv_ai_mem_list(), 0, 25),
|
||||
'learned' => ['chars' => $m['chars'], 'max' => vv_ai_memory_learned_max()],
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action === 'mem_proposal_action') {
|
||||
if (!$isPost) { http_response_code(405); echo json_encode(['ok' => false, 'error' => 'POST only']); exit; }
|
||||
require_once __DIR__ . '/../include/ai_memory_learn.php';
|
||||
$id = trim($_POST['id'] ?? '');
|
||||
$act = trim($_POST['act'] ?? '');
|
||||
$r = vv_ai_mem_action($id, $act);
|
||||
vv_ai_log(sprintf('mem_proposal id=%s act=%s %s', $id, $act,
|
||||
$r['ok'] ? 'ok' : ('FAILED: ' . ($r['error'] ?? '?'))));
|
||||
echo json_encode($r);
|
||||
exit;
|
||||
}
|
||||
|
||||
// ── stop ──────────────────────────────────────────────────────────────────────
|
||||
// Cancels a generation in flight. Only ever signals ONE pid, verified to be the worker for this
|
||||
// exact job — never a process group. Signalling a group is what took the WebGUI down on
|
||||
|
||||
Reference in New Issue
Block a user