feat: show session label in dropdown
- Include label in session options alongside displayName - Format dropdown as 'displayName — label' when label exists - Makes labels visible without switching to each session
This commit is contained in:
parent
1dc6964008
commit
58760b53a0
@ -86,10 +86,11 @@ export function renderChatControls(state: AppViewState) {
|
|||||||
${repeat(
|
${repeat(
|
||||||
sessionOptions,
|
sessionOptions,
|
||||||
(entry) => entry.key,
|
(entry) => entry.key,
|
||||||
(entry) =>
|
(entry) => {
|
||||||
html`<option value=${entry.key}>
|
const base = entry.displayName ?? entry.key;
|
||||||
${entry.displayName ?? entry.key}
|
const text = entry.label ? `${base} — ${entry.label}` : base;
|
||||||
</option>`,
|
return html`<option value=${entry.key}>${text}</option>`;
|
||||||
|
},
|
||||||
)}
|
)}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
@ -183,7 +184,7 @@ function resolveSessionOptions(
|
|||||||
mainSessionKey?: string | null,
|
mainSessionKey?: string | null,
|
||||||
) {
|
) {
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
const options: Array<{ key: string; displayName?: string }> = [];
|
const options: Array<{ key: string; displayName?: string; label?: string }> = [];
|
||||||
|
|
||||||
const resolvedMain =
|
const resolvedMain =
|
||||||
mainSessionKey && sessions?.sessions?.find((s) => s.key === mainSessionKey);
|
mainSessionKey && sessions?.sessions?.find((s) => s.key === mainSessionKey);
|
||||||
@ -192,13 +193,13 @@ function resolveSessionOptions(
|
|||||||
// Add main session key first
|
// Add main session key first
|
||||||
if (mainSessionKey) {
|
if (mainSessionKey) {
|
||||||
seen.add(mainSessionKey);
|
seen.add(mainSessionKey);
|
||||||
options.push({ key: mainSessionKey, displayName: resolvedMain?.displayName });
|
options.push({ key: mainSessionKey, displayName: resolvedMain?.displayName, label: resolvedMain?.label });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add current session key next
|
// Add current session key next
|
||||||
if (!seen.has(sessionKey)) {
|
if (!seen.has(sessionKey)) {
|
||||||
seen.add(sessionKey);
|
seen.add(sessionKey);
|
||||||
options.push({ key: sessionKey, displayName: resolvedCurrent?.displayName });
|
options.push({ key: sessionKey, displayName: resolvedCurrent?.displayName, label: resolvedCurrent?.label });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add sessions from the result
|
// Add sessions from the result
|
||||||
@ -206,7 +207,7 @@ function resolveSessionOptions(
|
|||||||
for (const s of sessions.sessions) {
|
for (const s of sessions.sessions) {
|
||||||
if (!seen.has(s.key)) {
|
if (!seen.has(s.key)) {
|
||||||
seen.add(s.key);
|
seen.add(s.key);
|
||||||
options.push({ key: s.key, displayName: s.displayName });
|
options.push({ key: s.key, displayName: s.displayName, label: s.label });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user