Skip to content

Commit eef6d6d

Browse files
authored
Merge pull request #1362 from TerminallyLazy/update-model-config-ui
Add model config presets and ignore agent artifacts
2 parents 7e7933e + b3bdb6e commit eef6d6d

6 files changed

Lines changed: 139 additions & 23 deletions

File tree

plugins/_model_config/extensions/webui/chat-nav-after/model-switcher.html renamed to plugins/_model_config/extensions/webui/chat-input-progress-start/model-switcher.html

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Model Switcher - Floating Preset Selector -->
1+
<!-- Model Switcher - Floating Preset Selector (left-aligned with inline model display) -->
22
<script type="module">
33
import { store } from "/plugins/_model_config/webui/model-config-store.js";
44
</script>
@@ -17,12 +17,31 @@
1717
:class="{ 'has-override': !!$store.modelConfig.switcherOverride }"
1818
@click="showDropdown = !showDropdown"
1919
@click.outside="showDropdown = false">
20-
<span class="material-symbols-outlined">neurology</span>
20+
<span class="material-symbols-outlined" style="font-size: 16px;">neurology</span>
2121
<span class="model-switcher-label" x-text="$store.modelConfig.getSwitcherLabel()"></span>
22-
<span class="material-symbols-outlined" style="font-size: 0.75rem;"
22+
<span class="material-symbols-outlined" style="font-size: 0.7rem;"
2323
x-text="showDropdown ? 'expand_less' : 'expand_more'"></span>
2424
</button>
2525

26+
<!-- Inline active model pills (shown when a preset is active) -->
27+
<template x-if="$store.modelConfig.switcherOverride">
28+
<div class="model-switcher-active-pills">
29+
<template x-if="$store.modelConfig.getActiveModels().main">
30+
<div class="model-pill">
31+
<span class="model-pill-role">Main</span>
32+
<span class="model-pill-name" x-text="$store.modelConfig.getActiveModels().main.name"></span>
33+
</div>
34+
</template>
35+
<template x-if="$store.modelConfig.getActiveModels().utility">
36+
<div class="model-pill">
37+
<span class="model-pill-role">Util</span>
38+
<span class="model-pill-name" x-text="$store.modelConfig.getActiveModels().utility.name"></span>
39+
</div>
40+
</template>
41+
</div>
42+
</template>
43+
44+
<!-- Dropdown (opens upward) -->
2645
<div class="model-switcher-dropdown" x-show="showDropdown" x-transition.opacity>
2746
<!-- Use Default -->
2847
<template x-if="$store.modelConfig.switcherOverride">
@@ -99,6 +118,9 @@
99118
}
100119
.model-switcher-anchor {
101120
position: relative;
121+
display: flex;
122+
align-items: center;
123+
gap: 6px;
102124
}
103125
.model-switcher-btn {
104126
width: auto;
@@ -108,6 +130,7 @@
108130
border: none;
109131
font-size: 0.75rem;
110132
white-space: nowrap;
133+
flex-shrink: 0;
111134
}
112135
.model-switcher-btn:hover {
113136
border: none;
@@ -116,15 +139,53 @@
116139
/* color: var(--color-text); */
117140
}
118141
.model-switcher-label {
119-
max-width: 160px;
142+
max-width: 120px;
143+
overflow: hidden;
144+
text-overflow: ellipsis;
145+
}
146+
147+
/* Inline active model pills */
148+
.model-switcher-active-pills {
149+
display: flex;
150+
align-items: center;
151+
gap: 6px;
152+
flex-shrink: 1;
153+
min-width: 0;
154+
}
155+
.model-pill {
156+
display: flex;
157+
align-items: center;
158+
gap: 4px;
159+
padding: 2px 8px;
160+
border-radius: 12px;
161+
background: color-mix(in srgb, var(--color-highlight) 8%, transparent);
162+
border: 1px solid color-mix(in srgb, var(--color-highlight) 15%, transparent);
163+
font-size: 0.68rem;
164+
white-space: nowrap;
165+
min-width: 0;
166+
overflow: hidden;
167+
}
168+
.model-pill-role {
169+
font-weight: 600;
170+
opacity: 0.55;
171+
font-size: 0.62rem;
172+
text-transform: uppercase;
173+
letter-spacing: 0.03em;
174+
flex-shrink: 0;
175+
}
176+
.model-pill-name {
177+
opacity: 0.85;
120178
overflow: hidden;
121179
text-overflow: ellipsis;
180+
min-width: 0;
122181
}
182+
183+
/* Dropdown - opens upward, aligned to left */
123184
.model-switcher-dropdown {
124185
position: absolute;
125186
bottom: calc(100% + 6px);
126-
right: 0;
127-
min-width: 250px;
187+
left: 0;
188+
min-width: 280px;
128189
max-height: 550px;
129190
overflow-y: auto;
130191
background-color: var(--color-panel);
@@ -202,4 +263,11 @@
202263
opacity: 0.6;
203264
font-size: 0.75rem;
204265
}
266+
267+
/* Responsive: hide pills on narrow screens */
268+
@media (max-width: 600px) {
269+
.model-switcher-active-pills {
270+
display: none;
271+
}
272+
}
205273
</style>

plugins/_model_config/webui/model-config-store.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,21 @@ export const store = createStore("modelConfig", {
557557
return o.preset_name || o.name || o.provider || 'Custom';
558558
},
559559

560+
getActivePreset() {
561+
const o = this.switcherOverride;
562+
if (!o || !o.preset_name) return null;
563+
return this.switcherPresets.find(p => p.name === o.preset_name) || null;
564+
},
565+
566+
getActiveModels() {
567+
const preset = this.getActivePreset();
568+
if (!preset) return { main: null, utility: null };
569+
return {
570+
main: preset.chat?.name ? { provider: preset.chat.provider, name: preset.chat.name } : null,
571+
utility: preset.utility?.name ? { provider: preset.utility.provider, name: preset.utility.name } : null,
572+
};
573+
},
574+
560575
// Text conversion utilities (accessible from templates via $store.modelConfig)
561576
textToKwargs,
562577
textToHeaders,

webui/components/chat/input/chat-bar-input.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,20 @@
156156
#chat-input::-webkit-scrollbar-thumb { background-color: rgba(155,155,155,0.5); border-radius: 6px; -webkit-transition: background-color 0.2s ease; transition: background-color 0.2s ease; }
157157
#chat-input::-webkit-scrollbar-thumb:hover { background-color: rgba(155,155,155,0.7); }
158158
#chat-input:focus { outline: 0.05rem solid rgba(155,155,155,0.5); font-size: 0.955rem; padding-top: 0.45rem; background-color: var(--color-input-focus); }
159-
#chat-input::placeholder { color: var(--color-text-muted); opacity: 0.7; }
159+
#chat-input::placeholder { color: var(--color-text-muted); opacity: 0.7; transition: color 0.3s ease; }
160+
161+
/* Progress ghost text animation — gentle pulse on placeholder */
162+
#chat-input.progress-active::placeholder {
163+
animation: placeholder-pulse 2s ease-in-out infinite;
164+
}
165+
@keyframes placeholder-pulse {
166+
0%, 100% { opacity: 0.45; }
167+
50% { opacity: 0.85; }
168+
}
169+
#chat-input.progress-active {
170+
border-color: color-mix(in srgb, var(--color-highlight) 20%, transparent);
171+
outline-color: color-mix(in srgb, var(--color-highlight) 15%, transparent);
172+
}
160173

161174
#expand-button {
162175
position: absolute;

webui/components/chat/input/input-store.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const model = {
1010
message: "",
1111
/** Composer + menu (bottom actions moved into dropdown) */
1212
chatMoreMenuOpen: false,
13+
progressText: "",
14+
progressActive: false,
1315

1416
toggleChatMoreMenu() {
1517
this.chatMoreMenuOpen = !this.chatMoreMenuOpen;
@@ -32,6 +34,10 @@ const model = {
3234
get inputPlaceholder() {
3335
const state = this._getSendState();
3436
if (state === "all") return "Press Enter to send queued messages";
37+
// Show progress as ghost text when agent is working and input is empty
38+
if (this.progressText && !this.message) {
39+
return "|> " + this.progressText;
40+
}
3541
return "Type your message here...";
3642
},
3743

webui/components/chat/input/progress.html

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
<body>
99
<div id="progress-bar-box" x-data>
1010
<x-extension id="chat-input-progress-start"></x-extension>
11-
<h4 id="progress-bar-h">
12-
<span id="progress-bar-i">|></span><span id="progress-bar"></span>
13-
</h4>
11+
12+
<!-- Hidden legacy progress-bar element (keeps JS updater happy, not displayed) -->
13+
<span id="progress-bar" style="display:none;"></span>
14+
1415
<div id="progress-bar-right">
1516
<h4 id="progress-bar-stop-speech" x-data x-cloak x-show="$store.speech.isSpeaking">
1617
<span id="stop-speech" @click="$store.speech.stop()" style="cursor: pointer" title="Stop Speech" aria-label="Stop Speech">
@@ -38,12 +39,10 @@ <h4 id="progress-bar-stop-speech" x-data x-cloak x-show="$store.speech.isSpeakin
3839

3940

4041
<style>
41-
#progress-bar-box { background-color: var(--color-panel); padding: var(--spacing-sm) var(--spacing-md) var(--spacing-xs) var(--spacing-md); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; z-index: 1001; gap: var(--spacing-sm); }
42+
#progress-bar-box { background-color: var(--color-panel); padding: var(--spacing-xs) var(--spacing-md) 0 var(--spacing-md); display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: center; z-index: 1001; gap: var(--spacing-sm); min-height: 0; }
4243
#progress-bar-box > x-extension { display: contents; }
43-
#progress-bar-box h4 { margin: 0 1.2em 0 0; }
44-
#progress-bar-h { color: var(--color-primary); display: flex; align-items: left; justify-content: flex-start; height: 1.2em; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; font-weight: normal; }
45-
#progress-bar-i { font-weight: bold; padding-right: 0.5em; color: var(--color-secondary); }
46-
#progress-bar-right { display: flex; align-items: center; gap: var(--spacing-sm); flex-shrink: 0; }
44+
#progress-bar-box h4 { margin: 0; }
45+
#progress-bar-right { display: flex; align-items: center; gap: var(--spacing-sm); flex-shrink: 0; margin-left: auto; margin-right: calc(5.5rem + var(--spacing-xs)); }
4746
#progress-bar-right > x-extension { display: contents; }
4847
#chat-nav-buttons { display: flex; align-items: center; gap: 2px; opacity: 0.85; }
4948
#chat-nav-buttons .btn-icon-action { padding: var(--spacing-xs); }
@@ -52,8 +51,6 @@ <h4 id="progress-bar-stop-speech" x-data x-cloak x-show="$store.speech.isSpeakin
5251
}
5352
.shiny-text { background: linear-gradient(to right, var(--color-primary-dark) 20%, var(--color-text) 40%, var(--color-text) 60%, var(--color-primary-dark) 60%); background-size: 200% auto; color: transparent; -webkit-background-clip: text; background-clip: text; animation: shine 1s linear infinite; }
5453
@keyframes shine { to { background-position: -200% center; } }
55-
.light-mode #progress-bar-i { color: var(--color-border-dark); opacity: 0.5; }
5654
</style>
5755
</body>
5856
</html>
59-

webui/index.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,16 +481,33 @@ function speakMessages(logs) {
481481
}
482482

483483
function updateProgress(progress, active) {
484-
const progressBarEl = document.getElementById("progress-bar");
485-
if (!progressBarEl) return;
486484
if (!progress) progress = "";
487485

488-
setProgressBarShine(progressBarEl, active);
486+
// Strip HTML tags for plain-text placeholder use
487+
const plainText = progress.replace(/<[^>]*>/g, "").trim();
488+
489+
// Update the input store so the placeholder reflects progress
490+
inputStore.progressText = plainText;
491+
inputStore.progressActive = !!active;
489492

490-
progress = msgs.convertIcons(progress);
493+
// Apply shimmer class to the textarea when active
494+
const chatInputEl = document.getElementById("chat-input");
495+
if (chatInputEl) {
496+
if (active && plainText) {
497+
addClassToElement(chatInputEl, "progress-active");
498+
} else {
499+
removeClassFromElement(chatInputEl, "progress-active");
500+
}
501+
}
491502

492-
if (progressBarEl.innerHTML != progress) {
493-
progressBarEl.innerHTML = progress;
503+
// Also update legacy progress bar element if it still exists
504+
const progressBarEl = document.getElementById("progress-bar");
505+
if (progressBarEl) {
506+
setProgressBarShine(progressBarEl, active);
507+
const html = msgs.convertIcons(progress);
508+
if (progressBarEl.innerHTML != html) {
509+
progressBarEl.innerHTML = html;
510+
}
494511
}
495512
}
496513

0 commit comments

Comments
 (0)