feat(dashboard): live-editable bot prompt via popup (view/edit/save)

Adds a persisted, runtime-editable system prompt. The brain reads the persona
on every turn (prompt_store.get_persona), so a dashboard edit applies to the
next reply with no restart; blank clears the override back to the built-in
PERSONA. New endpoints GET/POST /api/prompt, and a reusable modal popup
(뒤로가기 + 수정/저장) that later white/blacklist features will share.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-08-22 11:20:57 +09:00
parent 1cb7658290
commit df07224feb
3 changed files with 181 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ import os
import time
from ..interfaces import Frame, Reply, ScreenObservation
from ..prompt_store import get_persona
# Claude Code OAuth tokens only answer when the first system block is exactly
# this identity string; the real persona/instructions go in later blocks.
@@ -148,10 +149,12 @@ class ClaudeBrain:
screen_note = f"[지금 화면] {screen.text}\n\n" if screen else "[지금 화면] (아직 못 읽음)\n\n"
msgs.append({"role": "user", "content": screen_note + user_text})
client = self._auth.client()
# Read the persona live each turn so a dashboard edit applies immediately
# (falls back to the built-in PERSONA when no override is saved).
resp = await client.messages.create(
model=self.model,
max_tokens=400,
system=self._auth.system(self.PERSONA),
system=self._auth.system(get_persona(self.PERSONA)),
messages=msgs,
)
text = "".join(b.text for b in resp.content if b.type == "text")