System prompt: build from agent persona/instructions, store in chain, remove UI textarea

This commit is contained in:
Meleki committed 2026-02-26 21:42:32 +01:00
1 parent a90b9427a5
commit 002ef293f0
6 files changed
+17 -39

No files matched your search

+2 -2
View File
@@ -1,10 +1,10 @@
// ── API Calls ──
async function apiChat(messages, systemPrompt, sessionId) {
async function apiChat(messages, sessionId) {
return fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ messages, systemPrompt, sessionId })
body: JSON.stringify({ messages, sessionId })
});
}
+1 -2
View File
@@ -21,7 +21,6 @@ async function clearChat() {
async function sendMessage() {
const input = $('#input');
const btn = $('#send');
const systemPrompt = $('#systemPrompt').value.trim();
const text = input.value.trim();
if (!text) return;
@@ -38,7 +37,7 @@ async function sendMessage() {
let currentToolBox = null;
try {
const resp = await apiChat(messages, systemPrompt, getCurrentSessionId());
const resp = await apiChat(messages, getCurrentSessionId());
const reader = resp.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
-9
View File
@@ -27,15 +27,6 @@ registerPage('chat', {
backBtn.addEventListener('click', () => navigateTo('session', { id: sessionId }));
}
// System Prompt Toggle
const showSystem = document.getElementById('showSystem');
const systemPrompt = document.getElementById('systemPrompt');
if (showSystem && systemPrompt) {
showSystem.addEventListener('change', () => {
systemPrompt.classList.toggle('visible', showSystem.checked);
});
}
// Send
const sendBtn = document.getElementById('send');
if (sendBtn) sendBtn.addEventListener('click', sendMessage);