Skip to content

Agent Zero AI framework

fix: chat list fit-content/grow

Alessandro184fbd1538e6
diff --git a/webui/components/sidebar/chats/chats-list.html b/webui/components/sidebar/chats/chats-list.html
index 2cd7df68b..229cc03c3 100644
--- a/webui/components/sidebar/chats/chats-list.html
+++ b/webui/components/sidebar/chats/chats-list.html
@@ -28,67 +28,62 @@
</template>
</div>
+ <style>
+ .chats-list-container .section-header {
+ position: sticky;
+ top: 0;
+ flex-shrink: 0;
+ z-index: 10;
+ }
+ /* Chats list container and items */
+ .chats-list-container {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ min-height: 0;
+ margin-top: var(--spacing-md);
+ }
+
+ .chats-config-list {
+ flex: 1;
+ min-height: 0;
+ overflow: scroll;
+ scroll-behavior: smooth;
+ max-height: 100%;
+ scrollbar-width: none; /* Firefox */
+ -ms-overflow-style: none; /* IE/Edge */
+ }
+ /* Hide scrollbar for Chrome/Safari/Webkit */
+ .chats-config-list::-webkit-scrollbar {
+ display: none;
+ }
+
+ .chat-list-button { display: block; width: 100%; padding: 8px 5px; cursor: pointer; overflow: hidden; position: relative; border-radius: 4px; transition: background-color 0.2s ease-in-out; }
+ .chat-list-button.has-task-container { padding-top: 6px; padding-bottom: 6px; }
+ .chat-list-button:hover { background-color: rgba(255, 255, 255, 0.03); }
+ .light-mode .chat-list-button:hover { background-color: rgba(0, 0, 0, 0.02); }
+
+ .chat-name { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; padding: 3px 8px; border-radius: 4px; transition: background-color 0.2s; margin-right: 60px; font-size: var(--font-size-small); }
+ .chat-name:hover { background-color: rgba(255, 255, 255, 0.1); text-decoration: none; }
+ .light-mode .chat-name:hover { background-color: rgba(0, 0, 0, 0.05); }
+
+ .chat-container { display: flex; align-items: center; position: relative; width: 100%; min-height: 30px; gap: 0; }
+
+ .edit-button { background-color: transparent; border: 1px solid var(--color-border); border-radius: 0.1875rem; color: var(--color-primary); cursor: pointer; padding: 0.125rem 0.5rem; -webkit-transition: all var(--transition-speed) ease-in-out; transition: all var(--transition-speed) ease-in-out; width: 2rem; height: 2rem; }
+ .edit-button:hover { border-color: var(--color-primary); background-color: #32455690; }
+ .edit-button:active { background-color: #131a2090; color: rgba(253, 253, 253, 0.35); }
+ .light-mode .edit-button { border-color: var(--color-primary-light); color: var(--color-primary-light); }
+ .light-mode .edit-button:hover { background-color: #e4e7f0; }
+ .light-mode .edit-button:active { background-color: #979fb9; color: rgba(0,0,0,0.35); }
+
+ .empty-list-message { display: flex; justify-content: center; align-items: center; height: 100px; color: var(--color-secondary); text-align: center; opacity: 0.7; font-style: italic; }
+ .light-mode .empty-list-message { color: var(--color-secondary-light); }
+
+ /* Selected chat accent */
+ .chat-list-button.font-bold { position: relative; background-color: var(--color-border) 0.05; }
+ .chat-list-button.font-bold::before { content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 3px; background-color: var(--color-border); border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
+ .light-mode .chat-list-button.font-bold { background-color: var(--color-border) 0.05; }
+ .light-mode .chat-list-button.font-bold::before { background-color: var(--color-border); }
+ </style>
</body>
</html>
-
-<style>
- /* Chats list container and items */
- .chats-list-container {
- display: flex;
- flex-direction: column;
- flex: 1;
- min-height: 0;
- overflow: hidden;
- }
-
- /* Sticky header for chats list */
- .chats-list-container .section-header {
- flex-shrink: 0;
- z-index: 10;
- }
-
- /* Scrollable config list */
- .chats-config-list {
- flex: 1;
- min-height: 0;
- overflow-y: auto;
- scroll-behavior: smooth;
- max-height: 23vh;
- /* Hide scrollbar but keep functionality */
- scrollbar-width: none; /* Firefox */
- -ms-overflow-style: none; /* IE/Edge */
- }
- /* Hide scrollbar for Chrome/Safari/Webkit */
- .chats-config-list::-webkit-scrollbar {
- display: none;
- }
-
- .chat-list-button { display: block; width: 100%; padding: 8px 5px; cursor: pointer; overflow: hidden; position: relative; border-radius: 4px; transition: background-color 0.2s ease-in-out; }
- .chat-list-button.has-task-container { padding-top: 6px; padding-bottom: 6px; }
- .chat-list-button:hover { background-color: rgba(255, 255, 255, 0.03); }
- .light-mode .chat-list-button:hover { background-color: rgba(0, 0, 0, 0.02); }
-
- .chat-name { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; padding: 3px 8px; border-radius: 4px; transition: background-color 0.2s; margin-right: 60px; font-size: var(--font-size-small); }
- .chat-name:hover { background-color: rgba(255, 255, 255, 0.1); text-decoration: none; }
- .light-mode .chat-name:hover { background-color: rgba(0, 0, 0, 0.05); }
-
- .chat-container { display: flex; align-items: center; position: relative; width: 100%; min-height: 30px; gap: 0; }
-
- .edit-button { background-color: transparent; border: 1px solid var(--color-border); border-radius: 0.1875rem; color: var(--color-primary); cursor: pointer; padding: 0.125rem 0.5rem; -webkit-transition: all var(--transition-speed) ease-in-out; transition: all var(--transition-speed) ease-in-out; width: 2rem; height: 2rem; }
- .edit-button:hover { border-color: var(--color-primary); background-color: #32455690; }
- .edit-button:active { background-color: #131a2090; color: rgba(253, 253, 253, 0.35); }
- .light-mode .edit-button { border-color: var(--color-primary-light); color: var(--color-primary-light); }
- .light-mode .edit-button:hover { background-color: #e4e7f0; }
- .light-mode .edit-button:active { background-color: #979fb9; color: rgba(0,0,0,0.35); }
-
- .empty-list-message { display: flex; justify-content: center; align-items: center; height: 100px; color: var(--color-secondary); text-align: center; opacity: 0.7; font-style: italic; }
- .light-mode .empty-list-message { color: var(--color-secondary-light); }
-
- /* Selected chat accent */
- .chat-list-button.font-bold { position: relative; background-color: var(--color-border) 0.05; }
- .chat-list-button.font-bold::before { content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 3px; background-color: var(--color-border); border-top-left-radius: 3px; border-bottom-left-radius: 3px; }
- .light-mode .chat-list-button.font-bold { background-color: var(--color-border) 0.05; }
- .light-mode .chat-list-button.font-bold::before { background-color: var(--color-border); }
-</style>
-
-
diff --git a/webui/components/sidebar/chats/chats-store.js b/webui/components/sidebar/chats/chats-store.js
index 93e6c2e21..5e959b9f6 100644
--- a/webui/components/sidebar/chats/chats-store.js
+++ b/webui/components/sidebar/chats/chats-store.js
@@ -139,6 +139,8 @@ const model = {
if (globalThis.updateAfterScroll) {
globalThis.updateAfterScroll();
}
+ // UX: scroll-to-top
+ requestAnimationFrame(() => this._scrollChatsToTop());
} catch (e) {
if (globalThis.toastFetchError) {
globalThis.toastFetchError("Error creating new chat", e);
@@ -146,6 +148,13 @@ const model = {
}
},
+ // Smoothly scroll the chats list to top if present
+ _scrollChatsToTop() {
+ const listEl = document.querySelector('#chats-section .chats-config-list');
+ if (!listEl) return; // no-op if not in DOM
+ listEl.scrollTo({ top: 0, behavior: 'smooth' });
+ },
+
// Load chats from files
async loadChats() {
try {
diff --git a/webui/components/sidebar/left-sidebar.html b/webui/components/sidebar/left-sidebar.html
index ef07402a4..d97ea8a16 100644
--- a/webui/components/sidebar/left-sidebar.html
+++ b/webui/components/sidebar/left-sidebar.html
@@ -11,18 +11,14 @@
<div class="left-panel-top">
<!-- Top Section: Header Icons + Quick Actions -->
<x-component path="sidebar/top-section/sidebar-top.html"></x-component>
+ <!-- Chats List -->
+ <div class="config-section" id="chats-section">
+ <x-component path="sidebar/chats/chats-list.html"></x-component>
+ </div>
- <!-- Chats and Tasks Wrapper -->
- <div class="lists-wrapper">
- <!-- Chats List -->
- <div class="config-section" id="chats-section">
- <x-component path="sidebar/chats/chats-list.html"></x-component>
- </div>
-
- <!-- Tasks List -->
- <div class="config-section" id="tasks-section">
- <x-component path="sidebar/tasks/tasks-list.html"></x-component>
- </div>
+ <!-- Tasks List -->
+ <div class="config-section" id="tasks-section">
+ <x-component path="sidebar/tasks/tasks-list.html"></x-component>
</div>
</div>
<!--Sidebar lower elements-->
@@ -31,7 +27,6 @@
</div>
</div>
-
<style>
/* Left Panel styles from index.css */
#left-panel {
@@ -75,15 +70,6 @@
margin-top: 3.5rem;
padding: var(--spacing-md) var(--spacing-md) 0 var(--spacing-md);
}
-
- /* Wrapper for Chats and Tasks lists */
- .lists-wrapper {
- display: flex;
- flex-direction: column;
- flex: 1;
- min-height: 0;
- overflow: hidden;
- }
.left-panel-top::-webkit-scrollbar {
width: 0px;
}
@@ -105,10 +91,15 @@
display: flex;
flex-direction: column;
min-height: 0;
- flex: 0 auto;
+ flex: 1 1 auto; /* Allow to grow and fill available space */
margin-top: var(--spacing-md);
overflow: hidden;
}
+ /* Flatten wrapper elements to maintain flex chain for inner scroll containers */
+ #chats-section, #tasks-section > x-component,
+ #chats-section, #tasks-section > x-component > div[x-data] {
+ display: contents;
+ }
/* Tasks section container inside sidebar */
#tasks-section {
display: -webkit-flex;
@@ -173,5 +164,3 @@
</style>
</body>
</html>
-
-
diff --git a/webui/components/sidebar/tasks/tasks-list.html b/webui/components/sidebar/tasks/tasks-list.html
index 36dcee066..0b64ef13b 100644
--- a/webui/components/sidebar/tasks/tasks-list.html
+++ b/webui/components/sidebar/tasks/tasks-list.html
@@ -59,63 +59,58 @@
</template>
</div>
+ <style>
+ .tasks-list-container .section-header {
+ position: sticky;
+ top: 0;
+ flex-shrink: 0;
+ z-index: 10;
+ }
+
+ .tasks-list-container {
+ display: flex;
+ flex-direction: column;
+ max-height: 100%;
+ overflow: hidden;
+ position: relative;
+ }
+
+ /* Scrollable tasks config list */
+ .tasks-config-list {
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ scroll-behavior: smooth;
+ scrollbar-width: none; /* Firefox */
+ -ms-overflow-style: none; /* IE/Edge */
+ }
+ /* Hide scrollbar for Chrome/Safari/Webkit */
+ .tasks-config-list::-webkit-scrollbar {
+ display: none;
+ }
+
+ .task-name { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 0; margin-left: 10px; cursor: pointer; border-radius: 4px; transition: background-color 0.2s; font-size: var(--font-size-small); margin-bottom: 2px; }
+ .task-name:hover { background-color: rgba(255,255,255,0.1); text-decoration: none; }
+ .light-mode .task-name:hover { background-color: rgba(0,0,0,0.05); }
+
+ .task-info-line { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 2px; margin-left: 5px; }
+
+ .task-container-vertical { display: flex; flex-direction: column; width: 100%; gap: 6px; }
+
+ /* Scheduler badges (subset used in sidebar) */
+ .scheduler-status-badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; text-transform: capitalize; white-space: nowrap; }
+ .scheduler-status-badge-small { font-size: 10px; padding: 2px 6px; margin-right: 5px; min-width: 40px; text-align: center; }
+ .scheduler-status-idle { background-color: rgba(0, 100, 0, 0.2); color: #2a9d8f; border: 1px solid rgba(42, 157, 143, 0.3); }
+ .scheduler-status-running { background-color: rgba(0, 60, 120, 0.2); color: #4361ee; border: 1px solid rgba(67, 97, 238, 0.3); }
+ .scheduler-status-disabled { background-color: rgba(70, 70, 70, 0.2); color: #6c757d; border: 1px solid rgba(108, 117, 125, 0.3); }
+ .scheduler-status-error { background-color: rgba(120, 0, 0, 0.2); color: #e63946; border: 1px solid rgba(230, 57, 70, 0.3); }
+ .light-mode .scheduler-status-idle { background-color: rgba(42, 157, 143, 0.1); color: #1a6f65; }
+ .light-mode .scheduler-status-running { background-color: rgba(67, 97, 238, 0.1); color: #2540b3; }
+ .light-mode .scheduler-status-disabled { background-color: rgba(108, 117, 125, 0.1); color: #495057; }
+ .light-mode .scheduler-status-error { background-color: rgba(230, 57, 70, 0.1); color: #c5283d; }
+
+ .empty-list-message { display: flex; justify-content: center; align-items: center; height: 100px; color: var(--color-secondary); text-align: center; opacity: 0.7; font-style: italic; }
+ .light-mode .empty-list-message { color: var(--color-secondary-light); }
+ </style>
</body>
</html>
-
-<style>
- /* Tasks list styling (migrated) */
- .tasks-list-container {
- display: flex;
- flex-direction: column;
- max-height: 30vh;
- overflow: hidden;
- position: relative;
- }
-
- /* Scrollable tasks config list */
- .tasks-config-list {
- flex: 1;
- min-height: 0;
- overflow-y: auto;
- scroll-behavior: smooth;
- max-height: 23vh;
- /* Hide scrollbar but keep functionality */
- scrollbar-width: none; /* Firefox */
- -ms-overflow-style: none; /* IE/Edge */
- }
- /* Hide scrollbar for Chrome/Safari/Webkit */
- .tasks-config-list::-webkit-scrollbar {
- display: none;
- }
-
-
- .tasks-list-container .section-header {
- flex-shrink: 0;
- z-index: 10;
- }
-
- .task-name { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 0; margin-left: 10px; cursor: pointer; border-radius: 4px; transition: background-color 0.2s; font-size: var(--font-size-small); margin-bottom: 2px; }
- .task-name:hover { background-color: rgba(255,255,255,0.1); text-decoration: none; }
- .light-mode .task-name:hover { background-color: rgba(0,0,0,0.05); }
-
- .task-info-line { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 2px; margin-left: 5px; }
-
- .task-container-vertical { display: flex; flex-direction: column; width: 100%; gap: 6px; }
-
- /* Scheduler badges (subset used in sidebar) */
- .scheduler-status-badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; text-transform: capitalize; white-space: nowrap; }
- .scheduler-status-badge-small { font-size: 10px; padding: 2px 6px; margin-right: 5px; min-width: 40px; text-align: center; }
- .scheduler-status-idle { background-color: rgba(0, 100, 0, 0.2); color: #2a9d8f; border: 1px solid rgba(42, 157, 143, 0.3); }
- .scheduler-status-running { background-color: rgba(0, 60, 120, 0.2); color: #4361ee; border: 1px solid rgba(67, 97, 238, 0.3); }
- .scheduler-status-disabled { background-color: rgba(70, 70, 70, 0.2); color: #6c757d; border: 1px solid rgba(108, 117, 125, 0.3); }
- .scheduler-status-error { background-color: rgba(120, 0, 0, 0.2); color: #e63946; border: 1px solid rgba(230, 57, 70, 0.3); }
- .light-mode .scheduler-status-idle { background-color: rgba(42, 157, 143, 0.1); color: #1a6f65; }
- .light-mode .scheduler-status-running { background-color: rgba(67, 97, 238, 0.1); color: #2540b3; }
- .light-mode .scheduler-status-disabled { background-color: rgba(108, 117, 125, 0.1); color: #495057; }
- .light-mode .scheduler-status-error { background-color: rgba(230, 57, 70, 0.1); color: #c5283d; }
-
- .empty-list-message { display: flex; justify-content: center; align-items: center; height: 100px; color: var(--color-secondary); text-align: center; opacity: 0.7; font-style: italic; }
- .light-mode .empty-list-message { color: var(--color-secondary-light); }
-</style>
-
-