Skip to content

Commit 9afe6ee

Browse files
committed
feat(models): refine fallback UI styling
- Display fallback chain as colored chips in a dedicated row when collapsed - Add background colors to active chain and candidate pool for visual distinction - Remove redundant Cancel/Save buttons since autoSave is enforced
1 parent f61cb65 commit 9afe6ee

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/pages/models.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,20 @@ function renderDefaultBar(page, state) {
126126
<div style="display:flex; align-items:center; gap:8px">
127127
<span style="display:inline-block;width:16px;font-size:12px;color:var(--text-tertiary)">${chevron}</span>
128128
<span>${t('models.systemModelTitle')}</span>
129-
<div style="display:flex; gap:8px; margin-left: 12px; align-items: baseline;">
130-
<span style="color:var(--success); font-family:var(--font-mono); font-size: 0.9em; font-weight: 500;">${primary || t('models.notConfigured')}</span>
131-
<span style="font-size: 11px; color: var(--text-tertiary); font-weight: normal;">${t('models.nFallbacks', { count: fallbacks.length })}</span>
129+
<div style="display:flex; gap:8px; margin-left: 12px; align-items: baseline; flex: 1; min-width: 0; overflow: hidden;">
130+
<span style="color:var(--success); font-family:var(--font-mono); font-size: 0.9em; font-weight: 500; white-space: nowrap;">${primary || t('models.notConfigured')}</span>
131+
<span style="font-size: 11px; color: var(--text-tertiary); font-weight: normal; white-space: nowrap;">${t('models.nFallbacks', { count: fallbacks.length })}</span>
132132
</div>
133133
</div>
134134
</div>
135135
136-
<div id="fallback-waterfall-container" style="display:${state.showFallbackEditor ? 'block' : 'none'}; margin-top: 16px; border-top: 1px dashed var(--border-color); padding-top: 16px;">
136+
${collapsed && fallbacks.length > 0 ? `
137+
<div style="margin-top: 12px; display: flex; flex-wrap: nowrap; overflow: hidden; gap: 6px; align-items: center; padding-left: 24px;">
138+
${fallbacks.map(f => `<span style="background: var(--bg-tertiary); border: 1px solid var(--border-color); padding: 2px 8px; border-radius: 12px; font-size: 11px; font-family: var(--font-mono); color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;" title="${f}">${f}</span>`).join('<span style="color: var(--text-tertiary); font-size: 10px; flex-shrink: 0;">→</span>')}
139+
</div>
140+
` : ''}
141+
142+
<div id="fallback-waterfall-container" style="display:${state.showFallbackEditor ? 'block' : 'none'}; margin-top: 8px;">
137143
${renderFallbackWaterfall(state)}
138144
</div>
139145
@@ -181,7 +187,7 @@ function renderFallbackWaterfall(state) {
181187
</div>
182188
183189
<div style="display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px;">
184-
<div>
190+
<div style="background: var(--bg-tertiary); padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--border-color);">
185191
<div style="font-size: var(--font-size-xs); font-weight: bold; margin-bottom: 8px; color: var(--text-tertiary);">${t('models.activeChainTitle')}</div>
186192
<div id="active-fallback-list" style="display: flex; flex-direction: column; gap: 4px; min-height: 50px;">
187193
${currentFallbacks.map((f, i) => `
@@ -200,7 +206,7 @@ function renderFallbackWaterfall(state) {
200206
</div>
201207
</div>
202208
203-
<div>
209+
<div style="background: var(--bg-tertiary); padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--border-color);">
204210
<div style="font-size: var(--font-size-xs); font-weight: bold; margin-bottom: 8px; color: var(--text-tertiary);">${t('models.candidatePoolTitle')}</div>
205211
<div id="candidate-model-pool" style="display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; padding-right: 4px;">
206212
${Object.keys(candidatesByProvider).length === 0 ? `<div style="font-size: 12px; color: var(--text-tertiary); text-align: center; padding: 20px;">${t('models.noCandidateModel')}</div>` :
@@ -230,10 +236,7 @@ function renderFallbackWaterfall(state) {
230236
</div>
231237
</div>
232238
233-
<div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
234-
<button class="btn btn-sm btn-secondary" id="btn-cancel-fallback">${t('models.cancel')}</button>
235-
<button class="btn btn-sm btn-primary" id="btn-save-fallback">${t('models.saveAndApply')}</button>
236-
</div>
239+
237240
</div>
238241
`
239242
}

0 commit comments

Comments
 (0)