@@ -237,10 +237,13 @@ async function sendMessage() {
|
||||
|
||||
if (!message || State.isGenerating) return;
|
||||
|
||||
if (!State.settings.apiEndpoint || !State.settings.apiKey) {
|
||||
showToast('⚠️ Configure API settings first', 'warning');
|
||||
openSettings();
|
||||
return;
|
||||
// In managed mode, backend has the keys. In unmanaged, user must configure.
|
||||
if (!Backend.isManaged) {
|
||||
if (!State.settings.apiEndpoint || !State.settings.apiKey) {
|
||||
showToast('⚠️ Configure API settings first', 'warning');
|
||||
openSettings();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
input.value = '';
|
||||
@@ -270,8 +273,11 @@ async function sendMessage() {
|
||||
State.currentChatId = chat.id;
|
||||
} else {
|
||||
await updateChat(State.currentChatId, { messages });
|
||||
// Persist user message to backend
|
||||
await persistMessage(State.currentChatId, 'user', message);
|
||||
// In unmanaged mode, persist user message to backend (if connected)
|
||||
// In managed mode, the completion proxy persists both messages
|
||||
if (!Backend.isManaged) {
|
||||
await persistMessage(State.currentChatId, 'user', message);
|
||||
}
|
||||
}
|
||||
|
||||
renderMessages(messages);
|
||||
|
||||
Reference in New Issue
Block a user