Hide voice icon, use light theme, add cursor blink
- Hide voice input button in chat interface - Change default theme from 'sentient' to 'light' - Add blinking cursor animation to chat input field
This commit is contained in:
parent
b69ea06ad3
commit
e135ebf2e6
3 changed files with 65 additions and 6 deletions
|
|
@ -650,12 +650,26 @@ form.input-container {
|
|||
font-size: 15px;
|
||||
outline: none;
|
||||
transition: all 0.2s;
|
||||
caret-color: var(--accent, #3b82f6);
|
||||
}
|
||||
|
||||
#messageInput:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@keyframes cursor-blink {
|
||||
0%, 50% {
|
||||
caret-color: var(--accent, #3b82f6);
|
||||
}
|
||||
51%, 100% {
|
||||
caret-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
#messageInput:focus {
|
||||
animation: cursor-blink 1s step-end infinite;
|
||||
}
|
||||
|
||||
#messageInput::placeholder {
|
||||
color: #888888;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
id="voiceBtn"
|
||||
title="Voice"
|
||||
data-i18n-title="chat-voice"
|
||||
style="display: none"
|
||||
>
|
||||
🎤
|
||||
</button>
|
||||
|
|
@ -81,7 +82,7 @@
|
|||
|
||||
var WS_BASE_URL =
|
||||
window.location.protocol === "https:" ? "wss://" : "ws://";
|
||||
var WS_URL = WS_BASE_URL + window.location.host;
|
||||
var WS_URL = WS_BASE_URL + window.location.host + "/ws/chat";
|
||||
|
||||
var MessageType = {
|
||||
EXTERNAL: 0,
|
||||
|
|
@ -148,6 +149,7 @@
|
|||
var currentSessionId = null;
|
||||
var currentUserId = null;
|
||||
var currentBotId = "default";
|
||||
var currentBotName = "default";
|
||||
var isStreaming = false;
|
||||
var streamingMessageId = null;
|
||||
var currentStreamingContent = "";
|
||||
|
|
@ -733,10 +735,12 @@
|
|||
|
||||
var url =
|
||||
WS_URL +
|
||||
"/ws?session_id=" +
|
||||
"?session_id=" +
|
||||
currentSessionId +
|
||||
"&user_id=" +
|
||||
currentUserId;
|
||||
currentUserId +
|
||||
"&bot_name=" +
|
||||
currentBotName;
|
||||
ws = new WebSocket(url);
|
||||
|
||||
ws.onopen = function () {
|
||||
|
|
@ -747,9 +751,43 @@
|
|||
ws.onmessage = function (event) {
|
||||
try {
|
||||
var data = JSON.parse(event.data);
|
||||
console.log("Chat WebSocket received:", data);
|
||||
|
||||
// Ignore connection confirmation
|
||||
if (data.type === "connected") return;
|
||||
|
||||
// Ignore system events (theme changes, etc)
|
||||
if (data.event) {
|
||||
console.log(
|
||||
"System event received, ignoring:",
|
||||
data.event,
|
||||
data,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if content contains theme change events (JSON strings)
|
||||
if (data.content && typeof data.content === "string") {
|
||||
try {
|
||||
var contentObj = JSON.parse(data.content);
|
||||
if (contentObj.event === "change_theme") {
|
||||
console.log(
|
||||
"Theme change event in content, ignoring:",
|
||||
contentObj,
|
||||
);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
// Content is not JSON, continue processing
|
||||
}
|
||||
}
|
||||
|
||||
// Only process bot responses
|
||||
if (data.message_type === MessageType.BOT_RESPONSE) {
|
||||
console.log("Processing bot response:", data);
|
||||
processMessage(data);
|
||||
} else {
|
||||
console.log("Ignoring non-bot message:", data);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("WS message error:", e);
|
||||
|
|
@ -770,7 +808,12 @@
|
|||
}
|
||||
|
||||
function initChat() {
|
||||
var botName = "default";
|
||||
// Just proceed with chat initialization - no auth check
|
||||
proceedWithChatInit();
|
||||
}
|
||||
|
||||
function proceedWithChatInit() {
|
||||
var botName = window.__INITIAL_BOT_NAME__ || "default";
|
||||
fetch("/api/auth?bot_name=" + encodeURIComponent(botName))
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
|
|
@ -779,17 +822,19 @@
|
|||
currentUserId = auth.user_id;
|
||||
currentSessionId = auth.session_id;
|
||||
currentBotId = auth.bot_id || "default";
|
||||
currentBotName = botName;
|
||||
console.log("Auth:", {
|
||||
currentUserId: currentUserId,
|
||||
currentSessionId: currentSessionId,
|
||||
currentBotId: currentBotId,
|
||||
currentBotName: currentBotName,
|
||||
});
|
||||
connectWebSocket();
|
||||
})
|
||||
.catch(function (e) {
|
||||
console.error("Auth failed:", e);
|
||||
notify("Failed to connect to chat server", "error");
|
||||
setTimeout(initChat, 3000);
|
||||
setTimeout(proceedWithChatInit, 3000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
</script>
|
||||
</head>
|
||||
|
||||
<body data-theme="sentient">
|
||||
<body data-theme="light">
|
||||
<!-- Loading overlay -->
|
||||
<div class="loading-overlay" id="loadingOverlay">
|
||||
<div class="loading-spinner"></div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue