fix: improve chat scroll behavior and dark mode readability
- Smart auto-scroll: only follow SSE stream when user is near bottom (200px threshold), scroll once on send/switch session - Brighten dark mode text colors (primary #e0→#f0, secondary #a0→#c0, muted #66→#88) - Fix tool-call panel height to match thinking video (120px→213px) - Fix tool-call item background invisible in dark mode - Fix gateway start button using hardcoded dark color Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ packages/server/data/
|
|||||||
packages/server/node_modules/
|
packages/server/node_modules/
|
||||||
.hermes-web-ui/
|
.hermes-web-ui/
|
||||||
hermes_data/
|
hermes_data/
|
||||||
|
hermes-dependencies.md
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch, nextTick } from "vue";
|
import { ref, computed, watch, nextTick, onMounted } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import MessageItem from "./MessageItem.vue";
|
import MessageItem from "./MessageItem.vue";
|
||||||
import { useChatStore } from "@/stores/hermes/chat";
|
import { useChatStore } from "@/stores/hermes/chat";
|
||||||
@@ -31,6 +31,12 @@ const currentToolCalls = computed(() => {
|
|||||||
return [...tools].reverse();
|
return [...tools].reverse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function isNearBottom(threshold = 200): boolean {
|
||||||
|
const el = listRef.value;
|
||||||
|
if (!el) return true;
|
||||||
|
return el.scrollHeight - el.scrollTop - el.clientHeight < threshold;
|
||||||
|
}
|
||||||
|
|
||||||
function scrollToBottom() {
|
function scrollToBottom() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (listRef.value) {
|
if (listRef.value) {
|
||||||
@@ -39,18 +45,37 @@ function scrollToBottom() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => chatStore.messages.length, scrollToBottom);
|
// Scroll to bottom once when messages are first loaded
|
||||||
watch(
|
watch(
|
||||||
() => chatStore.messages[chatStore.messages.length - 1]?.content,
|
() => chatStore.activeSessionId,
|
||||||
scrollToBottom,
|
(id) => {
|
||||||
|
if (id) scrollToBottom();
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// When a run starts (user just sent a message), always scroll to bottom once
|
||||||
watch(
|
watch(
|
||||||
() => chatStore.isRunActive,
|
() => chatStore.isRunActive,
|
||||||
(v) => {
|
(v) => {
|
||||||
if (v) scrollToBottom();
|
if (v) scrollToBottom();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
watch(currentToolCalls, scrollToBottom);
|
|
||||||
|
// During streaming, only auto-scroll if the user is already near the bottom
|
||||||
|
watch(
|
||||||
|
() => chatStore.messages[chatStore.messages.length - 1]?.content,
|
||||||
|
() => {
|
||||||
|
if (!chatStore.isStreaming) { scrollToBottom(); return; }
|
||||||
|
if (!isNearBottom()) return;
|
||||||
|
scrollToBottom();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
watch(currentToolCalls, () => {
|
||||||
|
if (!chatStore.isStreaming) { scrollToBottom(); return; }
|
||||||
|
if (!isNearBottom()) return;
|
||||||
|
scrollToBottom();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -171,7 +196,7 @@ watch(currentToolCalls, scrollToBottom);
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
max-height: 120px;
|
max-height: 213px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
@@ -191,6 +216,10 @@ watch(currentToolCalls, scrollToBottom);
|
|||||||
background: rgba(0, 0, 0, 0.03);
|
background: rgba(0, 0, 0, 0.03);
|
||||||
border-radius: $radius-sm;
|
border-radius: $radius-sm;
|
||||||
|
|
||||||
|
.dark & {
|
||||||
|
background: rgba(255, 255, 255, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
.tool-call-icon {
|
.tool-call-icon {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
color: $text-muted;
|
color: $text-muted;
|
||||||
|
|||||||
@@ -75,9 +75,9 @@
|
|||||||
--accent-muted: #888888;
|
--accent-muted: #888888;
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
--text-primary: #e0e0e0;
|
--text-primary: #f0f0f0;
|
||||||
--text-secondary: #a0a0a0;
|
--text-secondary: #c0c0c0;
|
||||||
--text-muted: #666666;
|
--text-muted: #888888;
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
--success: #66bb6a;
|
--success: #66bb6a;
|
||||||
@@ -98,10 +98,10 @@
|
|||||||
--accent-info: #6ba3d6;
|
--accent-info: #6ba3d6;
|
||||||
|
|
||||||
// RGB components
|
// RGB components
|
||||||
--accent-primary-rgb: 224, 224, 224;
|
--accent-primary-rgb: 240, 240, 240;
|
||||||
--accent-hover-rgb: 245, 245, 245;
|
--accent-hover-rgb: 245, 245, 245;
|
||||||
--text-primary-rgb: 224, 224, 224;
|
--text-primary-rgb: 240, 240, 240;
|
||||||
--text-muted-rgb: 102, 102, 102;
|
--text-muted-rgb: 136, 136, 136;
|
||||||
--success-rgb: 102, 187, 106;
|
--success-rgb: 102, 187, 106;
|
||||||
--error-rgb: 239, 83, 80;
|
--error-rgb: 239, 83, 80;
|
||||||
--warning-rgb: 255, 183, 77;
|
--warning-rgb: 255, 183, 77;
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ async function handleToggle(name: string, running: boolean) {
|
|||||||
</NTag>
|
</NTag>
|
||||||
<NButton
|
<NButton
|
||||||
size="small"
|
size="small"
|
||||||
:type="gw.running ? 'warning' : 'default'"
|
:type="gw.running ? 'warning' : 'primary'"
|
||||||
:color="gw.running ? undefined : '#18181b'"
|
|
||||||
round
|
round
|
||||||
@click="handleToggle(gw.profile, gw.running)"
|
@click="handleToggle(gw.profile, gw.running)"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user