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;
|
font-size: 15px;
|
||||||
outline: none;
|
outline: none;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
|
caret-color: var(--accent, #3b82f6);
|
||||||
}
|
}
|
||||||
|
|
||||||
#messageInput:focus {
|
#messageInput:focus {
|
||||||
outline: none;
|
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 {
|
#messageInput::placeholder {
|
||||||
color: #888888;
|
color: #888888;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
id="voiceBtn"
|
id="voiceBtn"
|
||||||
title="Voice"
|
title="Voice"
|
||||||
data-i18n-title="chat-voice"
|
data-i18n-title="chat-voice"
|
||||||
|
style="display: none"
|
||||||
>
|
>
|
||||||
🎤
|
🎤
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -81,7 +82,7 @@
|
||||||
|
|
||||||
var WS_BASE_URL =
|
var WS_BASE_URL =
|
||||||
window.location.protocol === "https:" ? "wss://" : "ws://";
|
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 = {
|
var MessageType = {
|
||||||
EXTERNAL: 0,
|
EXTERNAL: 0,
|
||||||
|
|
@ -148,6 +149,7 @@
|
||||||
var currentSessionId = null;
|
var currentSessionId = null;
|
||||||
var currentUserId = null;
|
var currentUserId = null;
|
||||||
var currentBotId = "default";
|
var currentBotId = "default";
|
||||||
|
var currentBotName = "default";
|
||||||
var isStreaming = false;
|
var isStreaming = false;
|
||||||
var streamingMessageId = null;
|
var streamingMessageId = null;
|
||||||
var currentStreamingContent = "";
|
var currentStreamingContent = "";
|
||||||
|
|
@ -733,10 +735,12 @@
|
||||||
|
|
||||||
var url =
|
var url =
|
||||||
WS_URL +
|
WS_URL +
|
||||||
"/ws?session_id=" +
|
"?session_id=" +
|
||||||
currentSessionId +
|
currentSessionId +
|
||||||
"&user_id=" +
|
"&user_id=" +
|
||||||
currentUserId;
|
currentUserId +
|
||||||
|
"&bot_name=" +
|
||||||
|
currentBotName;
|
||||||
ws = new WebSocket(url);
|
ws = new WebSocket(url);
|
||||||
|
|
||||||
ws.onopen = function () {
|
ws.onopen = function () {
|
||||||
|
|
@ -747,9 +751,43 @@
|
||||||
ws.onmessage = function (event) {
|
ws.onmessage = function (event) {
|
||||||
try {
|
try {
|
||||||
var data = JSON.parse(event.data);
|
var data = JSON.parse(event.data);
|
||||||
|
console.log("Chat WebSocket received:", data);
|
||||||
|
|
||||||
|
// Ignore connection confirmation
|
||||||
if (data.type === "connected") return;
|
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) {
|
if (data.message_type === MessageType.BOT_RESPONSE) {
|
||||||
|
console.log("Processing bot response:", data);
|
||||||
processMessage(data);
|
processMessage(data);
|
||||||
|
} else {
|
||||||
|
console.log("Ignoring non-bot message:", data);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("WS message error:", e);
|
console.error("WS message error:", e);
|
||||||
|
|
@ -770,7 +808,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function initChat() {
|
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))
|
fetch("/api/auth?bot_name=" + encodeURIComponent(botName))
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
return response.json();
|
return response.json();
|
||||||
|
|
@ -779,17 +822,19 @@
|
||||||
currentUserId = auth.user_id;
|
currentUserId = auth.user_id;
|
||||||
currentSessionId = auth.session_id;
|
currentSessionId = auth.session_id;
|
||||||
currentBotId = auth.bot_id || "default";
|
currentBotId = auth.bot_id || "default";
|
||||||
|
currentBotName = botName;
|
||||||
console.log("Auth:", {
|
console.log("Auth:", {
|
||||||
currentUserId: currentUserId,
|
currentUserId: currentUserId,
|
||||||
currentSessionId: currentSessionId,
|
currentSessionId: currentSessionId,
|
||||||
currentBotId: currentBotId,
|
currentBotId: currentBotId,
|
||||||
|
currentBotName: currentBotName,
|
||||||
});
|
});
|
||||||
connectWebSocket();
|
connectWebSocket();
|
||||||
})
|
})
|
||||||
.catch(function (e) {
|
.catch(function (e) {
|
||||||
console.error("Auth failed:", e);
|
console.error("Auth failed:", e);
|
||||||
notify("Failed to connect to chat server", "error");
|
notify("Failed to connect to chat server", "error");
|
||||||
setTimeout(initChat, 3000);
|
setTimeout(proceedWithChatInit, 3000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-theme="sentient">
|
<body data-theme="light">
|
||||||
<!-- Loading overlay -->
|
<!-- Loading overlay -->
|
||||||
<div class="loading-overlay" id="loadingOverlay">
|
<div class="loading-overlay" id="loadingOverlay">
|
||||||
<div class="loading-spinner"></div>
|
<div class="loading-spinner"></div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue