feat: visible Saved indicator under the composer — chats are autosaved, now you can see it
This commit is contained in:
parent
e52fa86ad7
commit
ddc835b952
3 changed files with 12 additions and 0 deletions
|
|
@ -60,6 +60,7 @@
|
|||
<div id="assistant-context-warning" role="alert" hidden></div>
|
||||
<div id="assistant-attachments" class="assistant-attachments" aria-label="Attached images" hidden></div>
|
||||
<div class="assistant-composer-footer">
|
||||
<span id="assistant-autosave-state" class="assistant-autosave-state" aria-live="polite"></span>
|
||||
<label class="assistant-attach" for="assistant-attach-input" title="Attach up to 4 images (PNG, JPEG, WebP)"><i class="fas fa-paperclip"></i></label>
|
||||
<input type="file" id="assistant-attach-input" accept="image/png,image/jpeg,image/webp" multiple hidden>
|
||||
<button id="btn-assistant-voice" class="assistant-voice-btn" type="button" title="Voice conversation"><i class="fas fa-headset"></i></button>
|
||||
|
|
|
|||
|
|
@ -308,3 +308,8 @@ body.assistant-workspace .assistant-learning-view { min-height: 0; height: 100vh
|
|||
.assistant-model-pick { display:block; }
|
||||
/* Send button becomes a red stop while the assistant works */
|
||||
.btn-send.busy { background:var(--danger,#dc2626); }
|
||||
/* Autosave state: always visible so users see the chat is saved */
|
||||
.assistant-autosave-state { font-size:11px; color:var(--g400); }
|
||||
.assistant-autosave-state.saving { color:var(--g500); }
|
||||
.assistant-autosave-state.saved { color:var(--accent,#0f766e); font-weight:600; }
|
||||
.assistant-autosave-state.failed { color:var(--danger,#dc2626); }
|
||||
|
|
|
|||
|
|
@ -1642,15 +1642,21 @@ import {
|
|||
function performAutosave() {
|
||||
autosaveTimer = null;
|
||||
if (assistantBusy || !messages.length) return;
|
||||
var saveState = document.getElementById('assistant-autosave-state');
|
||||
if (saveState) { saveState.textContent = 'Saving…'; saveState.className = 'assistant-autosave-state saving'; }
|
||||
return saveAssistantChat(autosavePayload())
|
||||
.then(function(data) {
|
||||
if (!data.success) throw new Error(data.error || 'Autosave failed');
|
||||
if (data.id) currentChatId = data.id;
|
||||
autosaveErrorShown = false;
|
||||
var done = document.getElementById('assistant-autosave-state');
|
||||
if (done) { done.textContent = 'Saved'; done.className = 'assistant-autosave-state saved'; }
|
||||
loadSavedChats();
|
||||
})
|
||||
.catch(function(err) {
|
||||
// Surface once per change; never block or retry-loop the chat flow.
|
||||
var failed = document.getElementById('assistant-autosave-state');
|
||||
if (failed) { failed.textContent = 'Save failed'; failed.className = 'assistant-autosave-state failed'; }
|
||||
if (!autosaveErrorShown) {
|
||||
autosaveErrorShown = true;
|
||||
if (typeof showToast === 'function') showToast(err && err.message ? err.message : 'Autosave failed', 'error');
|
||||
|
|
|
|||
Loading…
Reference in a new issue