This commit is contained in:
Glucksberg 2026-01-30 14:49:07 +00:00 committed by GitHub
commit 0549322361
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 50 additions and 8 deletions

View File

@ -25,11 +25,11 @@ type ParsedTtsCommand = {
}; };
function parseTtsCommand(normalized: string): ParsedTtsCommand | null { function parseTtsCommand(normalized: string): ParsedTtsCommand | null {
// Accept `/tts` and `/tts <action> [args]` as a single control surface. // Accept `/tts <action> [args]` - return null for `/tts` alone to trigger inline menu.
if (normalized === "/tts") return { action: "status", args: "" }; if (normalized === "/tts") return null;
if (!normalized.startsWith("/tts ")) return null; if (!normalized.startsWith("/tts ")) return null;
const rest = normalized.slice(5).trim(); const rest = normalized.slice(5).trim();
if (!rest) return { action: "status", args: "" }; if (!rest) return null;
const [action, ...tail] = rest.split(/\s+/); const [action, ...tail] = rest.split(/\s+/);
return { action: action.toLowerCase(), args: tail.join(" ").trim() }; return { action: action.toLowerCase(), args: tail.join(" ").trim() };
} }

View File

@ -34,6 +34,34 @@
justify-content: flex-end; justify-content: flex-end;
} }
/* System messages centered with muted styling */
.chat-group.system {
justify-content: center;
margin-left: 16px;
}
.chat-group.system .chat-group-messages {
align-items: center;
max-width: min(600px, calc(100% - 60px));
}
.chat-group.system .chat-bubble {
background: var(--secondary);
border: 1px solid var(--border);
font-size: 13px;
color: var(--muted);
padding: 8px 12px;
}
.chat-group.system .chat-group-footer {
justify-content: center;
}
.chat-group.system .chat-sender-name {
color: var(--muted);
opacity: 0.8;
}
/* Footer at bottom of message group (role + time) */ /* Footer at bottom of message group (role + time) */
.chat-group-footer { .chat-group-footer {
display: flex; display: flex;
@ -89,6 +117,12 @@
color: var(--muted); color: var(--muted);
} }
.chat-avatar.system {
background: var(--border);
color: var(--muted);
font-size: 16px;
}
/* Image avatar support */ /* Image avatar support */
img.chat-avatar { img.chat-avatar {
display: block; display: block;

View File

@ -120,13 +120,17 @@ export function renderMessageGroup(
? "You" ? "You"
: normalizedRole === "assistant" : normalizedRole === "assistant"
? assistantName ? assistantName
: normalizedRole; : normalizedRole === "system"
? "System"
: normalizedRole;
const roleClass = const roleClass =
normalizedRole === "user" normalizedRole === "user"
? "user" ? "user"
: normalizedRole === "assistant" : normalizedRole === "assistant"
? "assistant" ? "assistant"
: "other"; : normalizedRole === "system"
? "system"
: "other";
const timestamp = new Date(group.timestamp).toLocaleTimeString([], { const timestamp = new Date(group.timestamp).toLocaleTimeString([], {
hour: "numeric", hour: "numeric",
minute: "2-digit", minute: "2-digit",
@ -173,15 +177,19 @@ function renderAvatar(
? assistantName.charAt(0).toUpperCase() || "A" ? assistantName.charAt(0).toUpperCase() || "A"
: normalized === "tool" : normalized === "tool"
? "⚙" ? "⚙"
: "?"; : normalized === "system"
? ""
: "?";
const className = const className =
normalized === "user" normalized === "user"
? "user" ? "user"
: normalized === "assistant" : normalized === "assistant"
? "assistant" ? "assistant"
: normalized === "tool" : normalized === "tool"
? "tool" ? "tool"
: "other"; : normalized === "system"
? "system"
: "other";
if (assistantAvatar && normalized === "assistant") { if (assistantAvatar && normalized === "assistant") {
if (isAvatarUrl(assistantAvatar)) { if (isAvatarUrl(assistantAvatar)) {