mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 03:30:23 +00:00
Add model config presets and ignore agent artifacts
- Add model switcher component for chat input with progress display - Enhance model config store with active preset/model retrieval - Show agent progress as ghost text in chat input placeholder - Add agent artifact patterns to .gitignore
This commit is contained in:
parent
4cbb320587
commit
a2547f12a1
7 changed files with 148 additions and 24 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -47,5 +47,13 @@ usr/**/*
|
|||
# for browser-use
|
||||
agent_history.gif
|
||||
|
||||
.agent/**
|
||||
.agents/**
|
||||
.claude/**
|
||||
|
||||
meta.json
|
||||
.lock
|
||||
**/*storage.sqlite
|
||||
|
||||
hashes_codebase.json
|
||||
|
||||
**/*plans
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<!-- Model Switcher - Floating Preset Selector -->
|
||||
<!-- Model Switcher - Floating Preset Selector (left-aligned with inline model display) -->
|
||||
<script type="module">
|
||||
import { store } from "/plugins/_model_config/webui/model-config-store.js";
|
||||
</script>
|
||||
|
|
@ -17,12 +17,31 @@
|
|||
:class="{ 'has-override': !!$store.modelConfig.switcherOverride }"
|
||||
@click="showDropdown = !showDropdown"
|
||||
@click.outside="showDropdown = false">
|
||||
<span class="material-symbols-outlined">neurology</span>
|
||||
<span class="material-symbols-outlined" style="font-size: 16px;">neurology</span>
|
||||
<span class="model-switcher-label" x-text="$store.modelConfig.getSwitcherLabel()"></span>
|
||||
<span class="material-symbols-outlined" style="font-size: 0.75rem;"
|
||||
<span class="material-symbols-outlined" style="font-size: 0.7rem;"
|
||||
x-text="showDropdown ? 'expand_less' : 'expand_more'"></span>
|
||||
</button>
|
||||
|
||||
<!-- Inline active model pills (shown when a preset is active) -->
|
||||
<template x-if="$store.modelConfig.switcherOverride">
|
||||
<div class="model-switcher-active-pills">
|
||||
<template x-if="$store.modelConfig.getActiveModels().main">
|
||||
<div class="model-pill">
|
||||
<span class="model-pill-role">Main</span>
|
||||
<span class="model-pill-name" x-text="$store.modelConfig.getActiveModels().main.name"></span>
|
||||
</div>
|
||||
</template>
|
||||
<template x-if="$store.modelConfig.getActiveModels().utility">
|
||||
<div class="model-pill">
|
||||
<span class="model-pill-role">Util</span>
|
||||
<span class="model-pill-name" x-text="$store.modelConfig.getActiveModels().utility.name"></span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Dropdown (opens upward) -->
|
||||
<div class="model-switcher-dropdown" x-show="showDropdown" x-transition.opacity>
|
||||
<!-- Use Default -->
|
||||
<template x-if="$store.modelConfig.switcherOverride">
|
||||
|
|
@ -99,6 +118,9 @@
|
|||
}
|
||||
.model-switcher-anchor {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.model-switcher-btn {
|
||||
width: auto;
|
||||
|
|
@ -108,6 +130,7 @@
|
|||
border: none;
|
||||
font-size: 0.75rem;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.model-switcher-btn:hover {
|
||||
border: none;
|
||||
|
|
@ -116,15 +139,53 @@
|
|||
/* color: var(--color-text); */
|
||||
}
|
||||
.model-switcher-label {
|
||||
max-width: 160px;
|
||||
max-width: 120px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* Inline active model pills */
|
||||
.model-switcher-active-pills {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.model-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
background: color-mix(in srgb, var(--color-highlight) 8%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--color-highlight) 15%, transparent);
|
||||
font-size: 0.68rem;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.model-pill-role {
|
||||
font-weight: 600;
|
||||
opacity: 0.55;
|
||||
font-size: 0.62rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.model-pill-name {
|
||||
opacity: 0.85;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Dropdown - opens upward, aligned to left */
|
||||
.model-switcher-dropdown {
|
||||
position: absolute;
|
||||
bottom: calc(100% + 6px);
|
||||
right: 0;
|
||||
min-width: 250px;
|
||||
left: 0;
|
||||
min-width: 280px;
|
||||
max-height: 550px;
|
||||
overflow-y: auto;
|
||||
background-color: var(--color-panel);
|
||||
|
|
@ -202,4 +263,11 @@
|
|||
opacity: 0.6;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
/* Responsive: hide pills on narrow screens */
|
||||
@media (max-width: 600px) {
|
||||
.model-switcher-active-pills {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -557,6 +557,21 @@ export const store = createStore("modelConfig", {
|
|||
return o.preset_name || o.name || o.provider || 'Custom';
|
||||
},
|
||||
|
||||
getActivePreset() {
|
||||
const o = this.switcherOverride;
|
||||
if (!o || !o.preset_name) return null;
|
||||
return this.switcherPresets.find(p => p.name === o.preset_name) || null;
|
||||
},
|
||||
|
||||
getActiveModels() {
|
||||
const preset = this.getActivePreset();
|
||||
if (!preset) return { main: null, utility: null };
|
||||
return {
|
||||
main: preset.chat?.name ? { provider: preset.chat.provider, name: preset.chat.name } : null,
|
||||
utility: preset.utility?.name ? { provider: preset.utility.provider, name: preset.utility.name } : null,
|
||||
};
|
||||
},
|
||||
|
||||
// Text conversion utilities (accessible from templates via $store.modelConfig)
|
||||
textToKwargs,
|
||||
textToHeaders,
|
||||
|
|
|
|||
|
|
@ -156,7 +156,20 @@
|
|||
#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; }
|
||||
#chat-input::-webkit-scrollbar-thumb:hover { background-color: rgba(155,155,155,0.7); }
|
||||
#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); }
|
||||
#chat-input::placeholder { color: var(--color-text-muted); opacity: 0.7; }
|
||||
#chat-input::placeholder { color: var(--color-text-muted); opacity: 0.7; transition: color 0.3s ease; }
|
||||
|
||||
/* Progress ghost text animation — gentle pulse on placeholder */
|
||||
#chat-input.progress-active::placeholder {
|
||||
animation: placeholder-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
@keyframes placeholder-pulse {
|
||||
0%, 100% { opacity: 0.45; }
|
||||
50% { opacity: 0.85; }
|
||||
}
|
||||
#chat-input.progress-active {
|
||||
border-color: color-mix(in srgb, var(--color-highlight) 20%, transparent);
|
||||
outline-color: color-mix(in srgb, var(--color-highlight) 15%, transparent);
|
||||
}
|
||||
|
||||
#expand-button {
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ const model = {
|
|||
message: "",
|
||||
/** Composer + menu (bottom actions moved into dropdown) */
|
||||
chatMoreMenuOpen: false,
|
||||
progressText: "",
|
||||
progressActive: false,
|
||||
|
||||
toggleChatMoreMenu() {
|
||||
this.chatMoreMenuOpen = !this.chatMoreMenuOpen;
|
||||
|
|
@ -32,6 +34,10 @@ const model = {
|
|||
get inputPlaceholder() {
|
||||
const state = this._getSendState();
|
||||
if (state === "all") return "Press Enter to send queued messages";
|
||||
// Show progress as ghost text when agent is working and input is empty
|
||||
if (this.progressText && !this.message) {
|
||||
return "|> " + this.progressText;
|
||||
}
|
||||
return "Type your message here...";
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
<body>
|
||||
<div id="progress-bar-box" x-data>
|
||||
<x-extension id="chat-input-progress-start"></x-extension>
|
||||
<h4 id="progress-bar-h">
|
||||
<span id="progress-bar-i">|></span><span id="progress-bar"></span>
|
||||
</h4>
|
||||
|
||||
<!-- Hidden legacy progress-bar element (keeps JS updater happy, not displayed) -->
|
||||
<span id="progress-bar" style="display:none;"></span>
|
||||
|
||||
<div id="progress-bar-right">
|
||||
<h4 id="progress-bar-stop-speech" x-data x-cloak x-show="$store.speech.isSpeaking">
|
||||
<span id="stop-speech" @click="$store.speech.stop()" style="cursor: pointer" title="Stop Speech" aria-label="Stop Speech">
|
||||
|
|
@ -38,12 +39,10 @@
|
|||
|
||||
|
||||
<style>
|
||||
#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); }
|
||||
#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; }
|
||||
#progress-bar-box > x-extension { display: contents; }
|
||||
#progress-bar-box h4 { margin: 0 1.2em 0 0; }
|
||||
#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; }
|
||||
#progress-bar-i { font-weight: bold; padding-right: 0.5em; color: var(--color-secondary); }
|
||||
#progress-bar-right { display: flex; align-items: center; gap: var(--spacing-sm); flex-shrink: 0; }
|
||||
#progress-bar-box h4 { margin: 0; }
|
||||
#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)); }
|
||||
#progress-bar-right > x-extension { display: contents; }
|
||||
#chat-nav-buttons { display: flex; align-items: center; gap: 2px; opacity: 0.85; }
|
||||
#chat-nav-buttons .btn-icon-action { padding: var(--spacing-xs); }
|
||||
|
|
@ -52,8 +51,6 @@
|
|||
}
|
||||
.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; }
|
||||
@keyframes shine { to { background-position: -200% center; } }
|
||||
.light-mode #progress-bar-i { color: var(--color-border-dark); opacity: 0.5; }
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -481,16 +481,33 @@ function speakMessages(logs) {
|
|||
}
|
||||
|
||||
function updateProgress(progress, active) {
|
||||
const progressBarEl = document.getElementById("progress-bar");
|
||||
if (!progressBarEl) return;
|
||||
if (!progress) progress = "";
|
||||
|
||||
setProgressBarShine(progressBarEl, active);
|
||||
// Strip HTML tags for plain-text placeholder use
|
||||
const plainText = progress.replace(/<[^>]*>/g, "").trim();
|
||||
|
||||
progress = msgs.convertIcons(progress);
|
||||
// Update the input store so the placeholder reflects progress
|
||||
inputStore.progressText = plainText;
|
||||
inputStore.progressActive = !!active;
|
||||
|
||||
if (progressBarEl.innerHTML != progress) {
|
||||
progressBarEl.innerHTML = progress;
|
||||
// Apply shimmer class to the textarea when active
|
||||
const chatInputEl = document.getElementById("chat-input");
|
||||
if (chatInputEl) {
|
||||
if (active && plainText) {
|
||||
addClassToElement(chatInputEl, "progress-active");
|
||||
} else {
|
||||
removeClassFromElement(chatInputEl, "progress-active");
|
||||
}
|
||||
}
|
||||
|
||||
// Also update legacy progress bar element if it still exists
|
||||
const progressBarEl = document.getElementById("progress-bar");
|
||||
if (progressBarEl) {
|
||||
setProgressBarShine(progressBarEl, active);
|
||||
const html = msgs.convertIcons(progress);
|
||||
if (progressBarEl.innerHTML != html) {
|
||||
progressBarEl.innerHTML = html;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue