chore: update version and UI changes

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-03-19 09:54:34 -03:00
parent c99cf16752
commit d7336860f7
3 changed files with 23 additions and 12 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "botui" name = "botui"
version = "6.1.2" version = "6.3.0"
edition = "2021" edition = "2021"
description = "General Bots UI - Pure web interface" description = "General Bots UI - Pure web interface"
license = "AGPL-3.0" license = "AGPL-3.0"

View file

@ -796,21 +796,17 @@
return; return;
} }
// Get the footer element
var footer = suggestionsEl.closest("footer");
// Clear existing suggestions // Clear existing suggestions
suggestionsEl.innerHTML = ""; suggestionsEl.innerHTML = "";
console.log("Rendering " + suggestions.length + " suggestions"); console.log("Rendering " + suggestions.length + " suggestions");
// Add or remove CSS class based on whether suggestions are displayed // Add or remove CSS class based on whether suggestions are displayed
if (footer) { // Note: CSS uses .has-bot-suggestions on the suggestions-container
if (suggestions.length > 0) { if (suggestions.length > 0) {
footer.classList.add("has-suggestions"); suggestionsEl.classList.add("has-bot-suggestions");
} else { } else {
footer.classList.remove("has-suggestions"); suggestionsEl.classList.remove("has-bot-suggestions");
}
} }
suggestions.forEach(function (suggestion) { suggestions.forEach(function (suggestion) {
@ -1252,7 +1248,16 @@
function proceedWithChatInit() { function proceedWithChatInit() {
var botName = window.__INITIAL_BOT_NAME__ || "default"; var botName = window.__INITIAL_BOT_NAME__ || "default";
fetch("/api/auth?bot_name=" + encodeURIComponent(botName)) var sessionIdKey = "gb_session_" + botName;
// Try to restore session from localStorage
var storedSessionId = localStorage.getItem(sessionIdKey);
var authUrl = "/api/auth?bot_name=" + encodeURIComponent(botName);
if (storedSessionId) {
authUrl += "&session_id=" + encodeURIComponent(storedSessionId);
}
fetch(authUrl)
.then(function (response) { .then(function (response) {
return response.json(); return response.json();
}) })
@ -1261,6 +1266,10 @@
currentSessionId = auth.session_id; currentSessionId = auth.session_id;
currentBotId = auth.bot_id || "default"; currentBotId = auth.bot_id || "default";
currentBotName = botName; currentBotName = botName;
// Save session ID to localStorage for page refreshes
localStorage.setItem(sessionIdKey, currentSessionId);
console.log("Auth:", { console.log("Auth:", {
currentUserId: currentUserId, currentUserId: currentUserId,
currentSessionId: currentSessionId, currentSessionId: currentSessionId,
@ -1271,7 +1280,7 @@
}) })
.catch(function (e) { .catch(function (e) {
console.error("Auth failed:", e); console.error("Auth failed:", e);
// Proceed with anonymous connection - WebSocket handler supports it // Proceed with anonymous connection
currentUserId = crypto.randomUUID currentUserId = crypto.randomUUID
? crypto.randomUUID() ? crypto.randomUUID()
: Date.now().toString(); : Date.now().toString();

View file

@ -259,6 +259,7 @@
const suggestionsEl = document.getElementById("suggestions"); const suggestionsEl = document.getElementById("suggestions");
if (suggestionsEl) { if (suggestionsEl) {
suggestionsEl.innerHTML = ''; suggestionsEl.innerHTML = '';
suggestionsEl.classList.remove('has-bot-suggestions');
} }
} }
@ -276,6 +277,7 @@
chip.setAttribute("hx-swap", "beforeend"); chip.setAttribute("hx-swap", "beforeend");
suggestionsEl.appendChild(chip); suggestionsEl.appendChild(chip);
suggestionsEl.classList.add('has-bot-suggestions');
htmx.process(chip); htmx.process(chip);
} }