fix(quick-chat): auto-select default model, fix new-chat button contrast, autofocus input

- Pre-select the global default (or first available) model on first open so
  users can chat without manually picking from the dropdown.
- Bump specificity of the new-chat (+) button styles so the CTA bg/text
  applies instead of being overridden by the header's .btn-icon rule.
- Focus the message input on panel open via rAF.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-29 22:45:17 -07:00
parent c7ff1b68d4
commit 739e899b59
2 changed files with 25 additions and 12 deletions

View File

@@ -258,19 +258,23 @@
white-space: nowrap;
}
.quick-chat-new-chat-btn {
.quick-chat-panel-header-actions .btn-icon.quick-chat-new-chat-btn {
background: var(--cta-bg);
border: 1px solid var(--cta-border);
border-color: var(--cta-border);
color: var(--cta-text);
}
.quick-chat-new-chat-btn:hover {
.quick-chat-panel-header-actions .btn-icon.quick-chat-new-chat-btn:hover {
background: var(--cta-bg-hover);
border-color: var(--cta-border-hover);
color: var(--cta-text);
}
.quick-chat-new-chat-btn:disabled,
.quick-chat-new-chat-btn:disabled:hover {
.quick-chat-panel-header-actions .btn-icon.quick-chat-new-chat-btn:disabled,
.quick-chat-panel-header-actions .btn-icon.quick-chat-new-chat-btn:disabled:hover {
background: var(--cta-bg);
border-color: var(--cta-border);
color: var(--cta-text);
opacity: 0.6;
cursor: not-allowed;
}

View File

@@ -871,17 +871,18 @@ export function QuickChatFAB({
);
if (hasDefaultModel) {
setSelectedModel(defaultSelection);
setChatMode("model");
if (agents.length === 0) {
setChatMode("model");
}
return;
}
}
// Fallback: auto-select first model only when no agents exist.
if (agents.length === 0) {
const firstModel = loadedModels[0];
if (firstModel) {
setSelectedModel(`${firstModel.provider}/${firstModel.id}`);
}
// Always pre-select the first model so users can start chatting in model mode
// without having to manually pick from the dropdown.
const firstModel = loadedModels[0];
if (firstModel) {
setSelectedModel(`${firstModel.provider}/${firstModel.id}`);
}
})
.catch((error: unknown) => {
@@ -955,6 +956,14 @@ export function QuickChatFAB({
pendingAttachmentsRef.current = pendingAttachments;
}, [pendingAttachments]);
useEffect(() => {
if (!isOpen) return;
const frame = requestAnimationFrame(() => {
inputRef.current?.focus();
});
return () => cancelAnimationFrame(frame);
}, [isOpen]);
// Attachment object URLs must be revoked when the composer unmounts.
useEffect(() => {
return () => {