chore: update version and UI changes
This commit is contained in:
parent
c99cf16752
commit
d7336860f7
3 changed files with 23 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "botui"
|
||||
version = "6.1.2"
|
||||
version = "6.3.0"
|
||||
edition = "2021"
|
||||
description = "General Bots UI - Pure web interface"
|
||||
license = "AGPL-3.0"
|
||||
|
|
|
|||
|
|
@ -796,21 +796,17 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Get the footer element
|
||||
var footer = suggestionsEl.closest("footer");
|
||||
|
||||
// Clear existing suggestions
|
||||
suggestionsEl.innerHTML = "";
|
||||
|
||||
console.log("Rendering " + suggestions.length + " suggestions");
|
||||
|
||||
// Add or remove CSS class based on whether suggestions are displayed
|
||||
if (footer) {
|
||||
if (suggestions.length > 0) {
|
||||
footer.classList.add("has-suggestions");
|
||||
} else {
|
||||
footer.classList.remove("has-suggestions");
|
||||
}
|
||||
// Note: CSS uses .has-bot-suggestions on the suggestions-container
|
||||
if (suggestions.length > 0) {
|
||||
suggestionsEl.classList.add("has-bot-suggestions");
|
||||
} else {
|
||||
suggestionsEl.classList.remove("has-bot-suggestions");
|
||||
}
|
||||
|
||||
suggestions.forEach(function (suggestion) {
|
||||
|
|
@ -1252,7 +1248,16 @@
|
|||
|
||||
function proceedWithChatInit() {
|
||||
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) {
|
||||
return response.json();
|
||||
})
|
||||
|
|
@ -1261,6 +1266,10 @@
|
|||
currentSessionId = auth.session_id;
|
||||
currentBotId = auth.bot_id || "default";
|
||||
currentBotName = botName;
|
||||
|
||||
// Save session ID to localStorage for page refreshes
|
||||
localStorage.setItem(sessionIdKey, currentSessionId);
|
||||
|
||||
console.log("Auth:", {
|
||||
currentUserId: currentUserId,
|
||||
currentSessionId: currentSessionId,
|
||||
|
|
@ -1271,7 +1280,7 @@
|
|||
})
|
||||
.catch(function (e) {
|
||||
console.error("Auth failed:", e);
|
||||
// Proceed with anonymous connection - WebSocket handler supports it
|
||||
// Proceed with anonymous connection
|
||||
currentUserId = crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: Date.now().toString();
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@
|
|||
const suggestionsEl = document.getElementById("suggestions");
|
||||
if (suggestionsEl) {
|
||||
suggestionsEl.innerHTML = '';
|
||||
suggestionsEl.classList.remove('has-bot-suggestions');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -276,6 +277,7 @@
|
|||
chip.setAttribute("hx-swap", "beforeend");
|
||||
|
||||
suggestionsEl.appendChild(chip);
|
||||
suggestionsEl.classList.add('has-bot-suggestions');
|
||||
htmx.process(chip);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue