From 85473a833d238b6fdcbf991d01230a71f0f538d6 Mon Sep 17 00:00:00 2001 From: npmrun <1549469775@qq.com> Date: Sun, 9 Aug 2026 11:14:20 +0800 Subject: [PATCH] feat: make AgentSystemPromptModal editable with save/reset Co-authored-by: CodeFree --- app/components/agent/AgentSystemPromptModal.vue | 144 +++++++++++++++++++++++- 1 file changed, 139 insertions(+), 5 deletions(-) diff --git a/app/components/agent/AgentSystemPromptModal.vue b/app/components/agent/AgentSystemPromptModal.vue index 58dd6c1..f27f465 100644 --- a/app/components/agent/AgentSystemPromptModal.vue +++ b/app/components/agent/AgentSystemPromptModal.vue @@ -2,11 +2,40 @@ const props = defineProps<{ show: boolean; systemPrompt: string; + isCustom: boolean; }>(); const emit = defineEmits<{ close: []; + save: [systemPrompt: string | null]; }>(); + +const editingText = ref(""); +const saving = ref(false); + +watch( + () => props.show, + (val) => { + if (val) { + editingText.value = props.systemPrompt; + } + }, +); + +async function handleSave() { + saving.value = true; + try { + const trimmed = editingText.value.trim(); + emit("save", trimmed.length > 0 ? trimmed.slice(0, 5000) : null); + } finally { + saving.value = false; + } +} + +function handleReset() { + editingText.value = ""; + emit("save", null); +}