Compare commits

..

No commits in common. "4987a15858a09566913e1f81fa43b0bce901529e" and "a8bff4e1a7ff8512e1e2eb5368981d4c0904f41f" have entirely different histories.

7 changed files with 2912 additions and 2996 deletions

View file

@ -289,7 +289,7 @@ pub async fn serve_minimal() -> impl IntoResponse {
};
match html_res {
Ok(html) => (StatusCode::OK, [("content-type", "text/html; charset=utf-8")], Html(html)),
Ok(html) => (StatusCode::OK, [("content-type", "text/html")], Html(html)),
Err(e) => {
error!("Failed to load minimal UI: {e}");
(
@ -530,7 +530,7 @@ pub async fn serve_suite(bot_name: Option<String>) -> impl IntoResponse {
html = remove_section(&html, "settings");
}
(StatusCode::OK, [("content-type", "text/html; charset=utf-8")], Html(html))
(StatusCode::OK, [("content-type", "text/html")], Html(html))
}
Err(e) => {
error!("Failed to load suite UI: {e}");

View file

@ -1,14 +1,13 @@
<!doctype html>
<html lang="pt-br">
<head>
<head>
<meta charset="utf-8" />
<title>General Bots</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<script>
// BotServer URL - configurable via window.BOTSERVER_URL or defaults to same origin port 9000
const BOTSERVER_URL =
window.BOTSERVER_URL || "http://localhost:9000";
window.BOTSERVER_URL || "https://localhost:9000";
const BOTSERVER_WS_URL = BOTSERVER_URL.replace(
"https://",
"wss://",
@ -38,14 +37,17 @@
--glass: rgba(0, 0, 0, 0.02);
--shadow: rgba(0, 0, 0, 0.05);
--logo-url: url("https://pragmatismo.com.br/icons/general-bots.svg");
--gradient-1: linear-gradient(135deg,
--gradient-1: linear-gradient(
135deg,
rgba(0, 102, 255, 0.05) 0%,
rgba(0, 102, 255, 0) 100%);
--gradient-2: linear-gradient(45deg,
rgba(0, 102, 255, 0) 100%
);
--gradient-2: linear-gradient(
45deg,
rgba(0, 0, 0, 0.02) 0%,
rgba(0, 0, 0, 0) 100%);
rgba(0, 0, 0, 0) 100%
);
}
[data-theme="dark"] {
--bg: #1a1a1a;
--fg: #ffffff;
@ -53,20 +55,22 @@
--accent: #ffffff;
--glass: rgba(255, 255, 255, 0.05);
--shadow: rgba(0, 0, 0, 0.5);
--gradient-1: linear-gradient(135deg,
--gradient-1: linear-gradient(
135deg,
rgba(255, 255, 255, 0.08) 0%,
rgba(255, 255, 255, 0) 100%);
--gradient-2: linear-gradient(45deg,
rgba(255, 255, 255, 0) 100%
);
--gradient-2: linear-gradient(
45deg,
rgba(255, 255, 255, 0.03) 0%,
rgba(255, 255, 255, 0) 100%);
rgba(255, 255, 255, 0) 100%
);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Inter", sans-serif;
background: var(--bg);
@ -80,7 +84,6 @@
height: 100vh;
position: relative;
}
body::before {
content: "";
position: fixed;
@ -89,7 +92,6 @@
pointer-events: none;
z-index: 0;
}
.float-menu {
position: fixed;
left: 20px;
@ -99,7 +101,6 @@
gap: 8px;
z-index: 1000;
}
.float-logo {
width: 40px;
height: 40px;
@ -111,13 +112,11 @@
border: 1px solid var(--border);
backdrop-filter: blur(10px);
}
[data-theme="dark"] .float-logo {}
[data-theme="dark"] .float-logo {
}
.float-logo:hover {
transform: scale(1.1) rotate(5deg);
}
.menu-button {
width: 40px;
height: 40px;
@ -133,13 +132,11 @@
color: var(--fg);
backdrop-filter: blur(10px);
}
.menu-button:hover {
transform: scale(1.1) rotate(-5deg);
background: var(--fg);
color: var(--bg);
}
.sidebar {
position: fixed;
left: -320px;
@ -155,11 +152,9 @@
backdrop-filter: blur(20px);
box-shadow: 4px 0 20px var(--shadow);
}
.sidebar.open {
left: 0;
}
.sidebar-header {
display: flex;
align-items: center;
@ -167,21 +162,18 @@
margin-bottom: 30px;
padding-top: 10px;
}
.sidebar-logo {
width: 32px;
height: 32px;
background: var(--logo-url) center/contain no-repeat;
filter: var(--logo-filter, none);
}
[data-theme="dark"] .sidebar-logo {}
[data-theme="dark"] .sidebar-logo {
}
.sidebar-title {
font-size: 16px;
font-weight: 500;
}
.sidebar-button {
width: 100%;
padding: 12px 16px;
@ -196,17 +188,14 @@
color: var(--fg);
text-align: left;
}
.sidebar-button:hover {
background: var(--fg);
color: var(--bg);
transform: translateX(4px) scale(1.02);
}
.history-section {
margin-top: 20px;
}
.history-title {
font-size: 12px;
opacity: 0.5;
@ -214,7 +203,6 @@
text-transform: uppercase;
letter-spacing: 0.5px;
}
.history-item {
padding: 10px 14px;
margin-bottom: 6px;
@ -224,13 +212,11 @@
font-size: 13px;
border: 1px solid transparent;
}
.history-item:hover {
background: var(--fg);
color: var(--bg);
transform: translateX(4px) scale(1.02);
}
#messages {
flex: 1;
overflow-y: auto;
@ -241,19 +227,16 @@
position: relative;
z-index: 1;
}
.message-container {
margin-bottom: 24px;
opacity: 0;
transform: translateY(10px);
}
.user-message {
display: flex;
justify-content: flex-end;
margin-bottom: 8px;
}
.user-message-content {
background: var(--fg);
color: var(--bg);
@ -266,7 +249,6 @@
position: relative;
overflow: hidden;
}
.user-message-content::before {
content: "";
position: absolute;
@ -275,13 +257,11 @@
opacity: 0.3;
pointer-events: none;
}
.assistant-message {
display: flex;
gap: 8px;
align-items: flex-start;
}
.assistant-avatar {
width: 24px;
height: 24px;
@ -291,9 +271,8 @@
margin-top: 2px;
filter: var(--logo-filter, none);
}
[data-theme="dark"] .assistant-avatar {}
[data-theme="dark"] .assistant-avatar {
}
.assistant-message-content {
flex: 1;
font-size: 14px;
@ -306,7 +285,6 @@
position: relative;
overflow: hidden;
}
.assistant-message-content::before {
content: "";
position: absolute;
@ -315,7 +293,6 @@
opacity: 0.5;
pointer-events: none;
}
.thinking-indicator {
display: flex;
gap: 8px;
@ -323,12 +300,10 @@
font-size: 13px;
opacity: 0.4;
}
.typing-dots {
display: flex;
gap: 4px;
}
.typing-dot {
width: 4px;
height: 4px;
@ -336,30 +311,24 @@
border-radius: 50%;
animation: bounce 1.4s infinite;
}
.typing-dot:nth-child(1) {
animation-delay: -0.32s;
}
.typing-dot:nth-child(2) {
animation-delay: -0.16s;
}
@keyframes bounce {
0%,
80%,
100% {
transform: scale(0);
opacity: 0.3;
}
40% {
transform: scale(1);
opacity: 1;
}
}
footer {
position: fixed;
bottom: 0;
@ -372,7 +341,6 @@
transition: all 0.3s;
backdrop-filter: blur(20px);
}
.suggestions-container {
display: flex;
flex-wrap: wrap;
@ -382,7 +350,6 @@
max-width: 680px;
margin: 0 auto 8px;
}
.suggestion-button {
padding: 6px 12px;
border-radius: 12px;
@ -394,13 +361,11 @@
border: 1px solid var(--border);
color: var(--fg);
}
.suggestion-button:hover {
background: var(--fg);
color: var(--bg);
transform: scale(1.05);
}
.input-container {
display: flex;
gap: 6px;
@ -408,7 +373,6 @@
margin: 0 auto;
align-items: center;
}
#messageInput {
flex: 1;
border-radius: 20px;
@ -422,16 +386,13 @@
color: var(--fg);
backdrop-filter: blur(10px);
}
#messageInput:focus {
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}
#messageInput::placeholder {
opacity: 0.3;
}
#sendBtn,
#voiceBtn {
width: 36px;
@ -448,35 +409,28 @@
font-size: 16px;
flex-shrink: 0;
}
#sendBtn:hover,
#voiceBtn:hover {
transform: scale(1.08) rotate(5deg);
}
#sendBtn:active,
#voiceBtn:active {
transform: scale(0.95);
}
#voiceBtn.recording {
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0%,
100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(1.1);
}
}
.flash-overlay {
position: fixed;
inset: 0;
@ -485,7 +439,6 @@
pointer-events: none;
z-index: 9999;
}
.scroll-to-bottom {
position: fixed;
bottom: 80px;
@ -504,15 +457,12 @@
transition: all 0.3s;
z-index: 90;
}
.scroll-to-bottom.visible {
display: flex;
}
.scroll-to-bottom:hover {
transform: scale(1.1) rotate(180deg);
}
.warning-message {
border-radius: 12px;
padding: 12px 16px;
@ -522,7 +472,6 @@
border: 1px solid var(--border);
font-size: 13px;
}
.continue-button {
display: inline-block;
border-radius: 10px;
@ -535,13 +484,11 @@
background: var(--glass);
border: 1px solid var(--border);
}
.continue-button:hover {
background: var(--fg);
color: var(--bg);
transform: translateY(-2px);
}
.context-indicator {
position: fixed;
bottom: 130px;
@ -557,11 +504,9 @@
display: none;
backdrop-filter: blur(10px);
}
.context-indicator.visible {
display: block;
}
.context-progress {
height: 3px;
background: var(--glass);
@ -569,14 +514,12 @@
margin-top: 6px;
overflow: hidden;
}
.context-progress-bar {
height: 100%;
background: var(--accent);
border-radius: 2px;
transition: width 0.3s;
}
.connection-status {
position: fixed;
top: 20px;
@ -587,52 +530,42 @@
z-index: 1000;
transition: all 0.3s;
}
.connection-status.connecting {
background: var(--fg);
opacity: 0.3;
animation: ping 1.5s infinite;
}
.connection-status.connected {
background: var(--accent);
opacity: 0.8;
}
.connection-status.disconnected {
background: var(--fg);
opacity: 0.2;
}
@keyframes ping {
0%,
100% {
opacity: 0.3;
transform: scale(0.8);
}
50% {
opacity: 0.8;
transform: scale(1.2);
}
}
.markdown-content p {
margin-bottom: 12px;
line-height: 1.7;
}
.markdown-content ul,
.markdown-content ol {
margin-bottom: 12px;
padding-left: 20px;
}
.markdown-content li {
margin-bottom: 4px;
}
.markdown-content code {
background: var(--glass);
padding: 2px 6px;
@ -640,7 +573,6 @@
font-family: monospace;
font-size: 13px;
}
.markdown-content pre {
border-radius: 8px;
padding: 12px;
@ -649,12 +581,10 @@
background: var(--glass);
border: 1px solid var(--border);
}
.markdown-content pre code {
background: none;
padding: 0;
}
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
@ -662,37 +592,30 @@
margin-bottom: 8px;
font-weight: 600;
}
.markdown-content h1 {
font-size: 20px;
}
.markdown-content h2 {
font-size: 18px;
}
.markdown-content h3 {
font-size: 16px;
}
.markdown-content table {
width: 100%;
border-collapse: collapse;
margin-bottom: 14px;
}
.markdown-content table th,
.markdown-content table td {
padding: 8px;
text-align: left;
border: 1px solid var(--border);
}
.markdown-content table th {
font-weight: 600;
background: var(--glass);
}
.markdown-content blockquote {
border-left: 2px solid var(--accent);
padding-left: 14px;
@ -700,65 +623,53 @@
opacity: 0.7;
font-style: italic;
}
.markdown-content a {
color: var(--accent);
text-decoration: none;
transition: all 0.3s;
}
.markdown-content a:hover {
opacity: 0.7;
text-decoration: underline;
}
::-webkit-scrollbar {
width: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--fg);
opacity: 0.3;
}
@media (max-width: 768px) {
.sidebar {
width: 100%;
left: -100%;
}
#messages {
padding: 20px 16px 140px;
}
.float-menu {
left: 12px;
top: 12px;
}
.float-logo,
.menu-button {
width: 36px;
height: 36px;
font-size: 14px;
}
.scroll-to-bottom {
width: 36px;
height: 36px;
bottom: 70px;
right: 12px;
}
.context-indicator {
bottom: 120px;
right: 12px;
@ -766,18 +677,24 @@
}
}
</style>
</head>
<body>
</head>
<body>
<div class="connection-status connecting" id="connectionStatus"></div>
<div class="flash-overlay" id="flashOverlay"></div>
<div class="float-menu">
<div class="float-logo" id="floatLogo" title="Menu"></div>
<div class="menu-button" id="themeBtn" title="Theme"></div>
</div>
<div class="sidebar" id="sidebar">
<div class="sidebar-header">
<div class="sidebar-logo"></div>
<div class="sidebar-title" id="sidebarTitle">General Bots</div>
</div>
<button class="sidebar-button" id="voiceToggle" onclick="toggleVoiceMode()">
<button
class="sidebar-button"
id="voiceToggle"
onclick="toggleVoiceMode()"
>
🎤 Voice Mode
</button>
<div class="history-section">
@ -789,7 +706,12 @@
<footer>
<div class="suggestions-container" id="suggestions"></div>
<div class="input-container">
<input id="messageInput" type="text" placeholder="Message..." autofocus />
<input
id="messageInput"
type="text"
placeholder="Message..."
autofocus
/>
<button id="voiceBtn" title="Voice">🎤</button>
<button id="sendBtn" title="Send"></button>
</div>
@ -799,7 +721,11 @@
<div>Context</div>
<div id="contextPercentage">0%</div>
<div class="context-progress">
<div class="context-progress-bar" id="contextProgressBar" style="width: 0%"></div>
<div
class="context-progress-bar"
id="contextProgressBar"
style="width: 0%"
></div>
</div>
</div>
<script>
@ -844,8 +770,9 @@
document.getElementById("connectionStatus"),
flashOverlay = document.getElementById("flashOverlay"),
suggestionsContainer = document.getElementById("suggestions"),
floatLogo = document.getElementById("floatLogo"),
sidebar = document.getElementById("sidebar"),
themeBtn = document.getElementById("themeBtn"),
scrollToBottomBtn = document.getElementById("scrollToBottom"),
contextIndicator = document.getElementById("contextIndicator"),
contextPercentage =
@ -855,7 +782,7 @@
sidebarTitle = document.getElementById("sidebarTitle");
marked.setOptions({ breaks: true, gfm: true });
floatLogo.addEventListener("click", toggleSidebar);
function toggleSidebar() {
sidebar.classList.toggle("open");
@ -873,7 +800,8 @@
}
function updateThemeButton() {
// Theme button removed for non-logged users
const icons = { auto: "⚙", dark: "🌙", light: "☀️" };
themeBtn.textContent = icons[currentTheme] || "⚙";
}
function applyTheme() {
@ -919,12 +847,13 @@
input.focus();
});
themeBtn.addEventListener("click", toggleTheme);
document.addEventListener("click", function (e) {
if (
sidebar.classList.contains("open") &&
!sidebar.contains(e.target)
!sidebar.contains(e.target) &&
!floatLogo.contains(e.target)
) {
sidebar.classList.remove("open");
}
@ -1198,10 +1127,8 @@
streamingMessageId = null;
currentStreamingContent = "";
} else {
if (r.content && r.content.trim() !== "") {
addMessage("assistant", r.content, false);
}
}
} else {
if (!isStreaming) {
isStreaming = true;
@ -1787,6 +1714,5 @@
}
});
</script>
</body>
</body>
</html>

View file

@ -73,7 +73,6 @@
opacity: 0;
transform: translateX(20px);
}
to {
opacity: 1;
transform: translateX(0);
@ -98,13 +97,11 @@
/* Connection Status - use shared styles from app.css */
@keyframes pulse {
0%,
100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.5;
transform: scale(1.2);
@ -219,7 +216,6 @@
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
@ -555,9 +551,9 @@ footer {
.suggestion-button {
padding: 6px 12px;
border-radius: 20px;
border: 2px solid var(--chat-color2, #002147);
background: var(--chat-color2, #002147);
color: #ffffff;
border: 2px solid var(--chat-color1, var(--suggestion-color, #4a9eff));
background: var(--chat-color2, rgba(255, 255, 255, 0.15));
color: var(--chat-color1, #ffffff);
font-size: 12px;
font-weight: 600;
cursor: pointer;
@ -619,8 +615,8 @@ form.input-container {
}
.input-container:focus-within {
border-color: var(--chat-color1, var(--accent, #3b82f6));
box-shadow: 0 0 0 3px color-mix(in srgb, var(--chat-color1, var(--accent, #3b82f6)) 20%, transparent);
border-color: var(--accent, var(--accent-color, #3b82f6));
box-shadow: 0 0 0 3px var(--accent-glow, rgba(59, 130, 246, 0.1));
}
#messageInput {
@ -641,14 +637,10 @@ form.input-container {
}
@keyframes cursor-blink {
0%,
50% {
0%, 50% {
caret-color: var(--accent, #3b82f6);
}
51%,
100% {
51%, 100% {
caret-color: transparent;
}
}
@ -681,7 +673,7 @@ form.input-container {
}
#sendBtn {
background: var(--chat-color1, var(--accent, #3b82f6));
background: var(--accent, var(--accent-color, #3b82f6));
}
#voiceBtn {
@ -697,7 +689,7 @@ form.input-container {
}
#sendBtn:hover {
background: var(--chat-color1, var(--accent-hover, #2563eb));
background: var(--accent-hover, var(--accent, #2563eb));
}
#voiceBtn:active,
@ -708,8 +700,8 @@ form.input-container {
/* Dark/Sentient theme overrides */
[data-theme="dark"] #sendBtn,
[data-theme="sentient"] #sendBtn {
background: var(--chat-color1, #d4f505);
color: #ffffff;
background: var(--accent, #d4f505);
color: #000000;
}
[data-theme="dark"] #voiceBtn,
@ -792,7 +784,6 @@ form.input-container {
from {
opacity: 0;
}
to {
opacity: 1;
}
@ -1280,14 +1271,10 @@ form.input-container {
}
@keyframes thinkingBounce {
0%,
80%,
100% {
0%, 80%, 100% {
transform: scale(0.8);
opacity: 0.5;
}
40% {
transform: scale(1);
opacity: 1;
@ -1344,7 +1331,6 @@ form.input-container {
opacity: 0;
transform: translateY(20px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
@ -1410,12 +1396,9 @@ form.input-container {
}
@keyframes bounce {
0%,
100% {
0%, 100% {
transform: translateX(-50%) translateY(0);
}
50% {
transform: translateX(-50%) translateY(-5px);
}
@ -1449,13 +1432,9 @@ form.input-container {
}
@keyframes typing {
0%,
60%,
100% {
0%, 60%, 100% {
transform: translateY(0);
}
30% {
transform: translateY(-8px);
}

View file

@ -14,21 +14,34 @@
<div class="suggestions-container" id="suggestions"></div>
<div class="mention-dropdown" id="mentionDropdown">
<div class="mention-header">
<span class="mention-title" data-i18n="chat-mention-title">Reference Entity</span>
<span class="mention-title" data-i18n="chat-mention-title"
>Reference Entity</span
>
</div>
<div class="mention-results" id="mentionResults"></div>
</div>
<form class="input-container" id="chatForm">
<input name="content" id="messageInput" type="text" placeholder="Message... (type @ to mention)"
data-i18n-placeholder="chat-placeholder" autofocus autocomplete="off" />
<button type="submit" id="sendBtn" title="Send" data-i18n-title="chat-send">
<input
name="content"
id="messageInput"
type="text"
placeholder="Message... (type @ to mention)"
data-i18n-placeholder="chat-placeholder"
autofocus
autocomplete="off"
/>
<button
type="submit"
id="sendBtn"
title="Send"
data-i18n-title="chat-send"
>
</button>
</form>
</footer>
<button class="scroll-to-bottom" id="scrollToBottom" title="Scroll to bottom">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</button>
@ -42,7 +55,11 @@
<div class="entity-card-title"></div>
<div class="entity-card-details"></div>
<div class="entity-card-actions">
<button class="entity-card-btn" data-action="view" data-i18n="action-view">
<button
class="entity-card-btn"
data-action="view"
data-i18n="action-view"
>
View
</button>
</div>
@ -720,10 +737,8 @@
if (isStreaming) {
finalizeStreaming();
} else {
if (data.content && data.content.trim() !== "") {
addMessage("bot", data.content);
}
}
isStreaming = false;
// Render suggestions when message is complete
@ -766,8 +781,8 @@
chip.textContent = suggestion.text || "Suggestion";
// Use window.sendMessage which is already exposed
chip.onclick = (function (sugg) {
return function () {
chip.onclick = (function(sugg) {
return function() {
console.log("Suggestion clicked:", sugg);
// Check if there's an action to parse
if (sugg.action) {
@ -846,7 +861,7 @@
window.sendMessage = sendMessage;
// Expose session info for suggestion clicks
window.getChatSessionInfo = function () {
window.getChatSessionInfo = function() {
return {
ws: ws,
currentBotId: currentBotId,
@ -971,22 +986,21 @@
var botName = window.__INITIAL_BOT_NAME__ || "default";
fetch("/api/bot/config?bot_name=" + encodeURIComponent(botName))
.then(function (response) {
.then(function(response) {
return response.json();
})
.then(function (config) {
.then(function(config) {
if (!config) return;
// Get the theme manager's theme for this bot to check if user selected a different theme
var botId = botName.toLowerCase();
var botThemeKey = "gb-theme-" + botId;
var botTheme = window.ThemeManager ? (
// Get bot-specific theme from theme manager's mapping
(window.ThemeManager.getAvailableThemes &&
window.ThemeManager.getAvailableThemes().find(t => t.id === botId)) ||
// Fallback to localStorage
localStorage.getItem(botThemeKey)
) : localStorage.getItem(botThemeKey);
localStorage.getItem("gb-theme")
) : localStorage.getItem("gb-theme");
// Check if bot config has a theme-base setting
var configThemeBase = config.theme_base || config["theme-base"] || "light";
@ -994,7 +1008,7 @@
// Only use bot config colors if:
// 1. No theme has been explicitly selected by user (localStorage empty or default)
// 2. AND the bot config's theme-base matches the current theme
var localStorageTheme = localStorage.getItem(botThemeKey);
var localStorageTheme = localStorage.getItem("gb-theme");
var useBotConfigColors = !localStorageTheme ||
localStorageTheme === "default" ||
localStorageTheme === configThemeBase;
@ -1007,7 +1021,6 @@
// Only set bot config colors if user hasn't selected a different theme
if (useBotConfigColors) {
document.documentElement.setAttribute("data-has-bot-colors", "true");
document.documentElement.style.setProperty("--chat-color1", color1);
document.documentElement.style.setProperty("--chat-color2", color2);
document.documentElement.style.setProperty("--suggestion-color", color1);
@ -1016,7 +1029,7 @@
document.documentElement.style.setProperty("--color2", color2);
document.documentElement.style.setProperty("--primary", color1);
document.documentElement.style.setProperty("--accent", color1);
console.log("Bot config colors applied:", { color1: color1, color2: color2 });
console.log("Bot config colors applied:", {color1: color1, color2: color2});
} else {
console.log("Bot config colors skipped - user selected custom theme:", localStorageTheme);
}
@ -1038,7 +1051,7 @@
console.log("Bot config loaded:", { color1: color1, color2: color2, title: title, logo: logo });
})
.catch(function (e) {
.catch(function(e) {
console.log("Could not load bot config:", e);
});
}

File diff suppressed because it is too large Load diff

View file

@ -51,7 +51,10 @@
<!-- Right: Theme selector, Apps menu and user avatar -->
<div class="header-right">
<!-- Theme dropdown selector -->
<div
id="themeSelectorContainer"
aria-label="Theme selector"
></div>
<!-- Apps menu button -->
<button

View file

@ -67,8 +67,7 @@ const ThemeManager = (() => {
if (!theme.file) {
currentThemeId = "default";
const botId = getCurrentBotId();
localStorage.setItem(`gb-theme-${botId}`, "default");
localStorage.setItem("gb-theme", "default");
// Re-enable sentient theme for default
document.documentElement.setAttribute("data-theme", "sentient");
updateDropdown();
@ -82,8 +81,7 @@ const ThemeManager = (() => {
link.onload = () => {
console.log("✓ Theme loaded:", theme.name);
currentThemeId = id;
const botId = getCurrentBotId();
localStorage.setItem(`gb-theme-${botId}`, id);
localStorage.setItem("gb-theme", id);
// Keep data-theme="sentient" on html so CSS selectors work
// The inline styles will override the colors
@ -152,16 +150,14 @@ const ThemeManager = (() => {
document.documentElement.style.setProperty("--border", borderHex);
}
// Check if config.csv already set the primary color, we shouldn't wipe it
// Only update color and suggestion variables if they aren't marked as bot-config
if (document.documentElement.getAttribute("data-has-bot-colors") !== "true") {
// Update ALL color-related CSS variables to match the theme
// This overrides any bot config colors
document.documentElement.style.setProperty("--chat-color1", `hsl(${primary})`);
document.documentElement.style.setProperty("--chat-color2", `hsl(${card})`);
document.documentElement.style.setProperty("--suggestion-color", `hsl(${primary})`);
document.documentElement.style.setProperty("--suggestion-bg", `hsl(${card})`);
document.documentElement.style.setProperty("--color1", `hsl(${primary})`);
document.documentElement.style.setProperty("--color2", `hsl(${card})`);
}
console.log("✓ Theme colors applied:", { bg: background, primary: primary });
updateDropdown();
@ -173,7 +169,8 @@ const ThemeManager = (() => {
}
function updateDropdown() {
// Dropdown removed
const dd = document.getElementById("themeDropdown");
if (dd) dd.value = currentThemeId;
}
function createDropdown() {
@ -202,29 +199,27 @@ const ThemeManager = (() => {
// Then load the UI theme (CSS theme)
// Priority: 1) localStorage user preference, 2) bot-specific theme, 3) default
const botId = getCurrentBotId();
let saved = localStorage.getItem(`gb-theme-${botId}`);
let saved = localStorage.getItem("gb-theme");
if (!saved || !themes.find((t) => t.id === saved)) {
// No user preference, try bot-specific theme
const botId = getCurrentBotId();
saved = botThemeMap[botId] || "light";
// Save to localStorage so it persists
localStorage.setItem(`gb-theme-${botId}`, saved);
localStorage.setItem("gb-theme", saved);
}
if (!themes.find((t) => t.id === saved)) saved = "default";
currentThemeId = saved;
loadTheme(saved);
// Dropdown injection removed
// const container = document.getElementById("themeSelectorContainer");
// if (container) container.appendChild(createDropdown());
const container = document.getElementById("themeSelectorContainer");
if (container) container.appendChild(createDropdown());
console.log("✓ Theme Manager initialized");
}
function setThemeFromServer(data) {
// Save theme to localStorage for persistence across page loads
const botId = getCurrentBotId();
localStorage.setItem(`gb-theme-data-${botId}`, JSON.stringify(data));
localStorage.setItem("gb-theme-data", JSON.stringify(data));
// Load base theme if specified
if (data.theme_base) {
@ -268,13 +263,12 @@ const ThemeManager = (() => {
// Load saved theme from localStorage on page load
function loadSavedTheme() {
const botId = getCurrentBotId();
const savedTheme = localStorage.getItem(`gb-theme-data-${botId}`);
const savedTheme = localStorage.getItem("gb-theme-data");
if (savedTheme) {
try {
const data = JSON.parse(savedTheme);
setThemeFromServer(data);
console.log(`✓ Theme loaded from localStorage for ${botId}`);
console.log("✓ Theme loaded from localStorage");
} catch (e) {
console.warn("Failed to load saved theme:", e);
}