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:
@@ -258,19 +258,23 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-chat-new-chat-btn {
|
.quick-chat-panel-header-actions .btn-icon.quick-chat-new-chat-btn {
|
||||||
background: var(--cta-bg);
|
background: var(--cta-bg);
|
||||||
border: 1px solid var(--cta-border);
|
border-color: var(--cta-border);
|
||||||
color: var(--cta-text);
|
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);
|
background: var(--cta-bg-hover);
|
||||||
|
border-color: var(--cta-border-hover);
|
||||||
|
color: var(--cta-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-chat-new-chat-btn:disabled,
|
.quick-chat-panel-header-actions .btn-icon.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:hover {
|
||||||
background: var(--cta-bg);
|
background: var(--cta-bg);
|
||||||
|
border-color: var(--cta-border);
|
||||||
|
color: var(--cta-text);
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -871,17 +871,18 @@ export function QuickChatFAB({
|
|||||||
);
|
);
|
||||||
if (hasDefaultModel) {
|
if (hasDefaultModel) {
|
||||||
setSelectedModel(defaultSelection);
|
setSelectedModel(defaultSelection);
|
||||||
setChatMode("model");
|
if (agents.length === 0) {
|
||||||
|
setChatMode("model");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: auto-select first model only when no agents exist.
|
// Always pre-select the first model so users can start chatting in model mode
|
||||||
if (agents.length === 0) {
|
// without having to manually pick from the dropdown.
|
||||||
const firstModel = loadedModels[0];
|
const firstModel = loadedModels[0];
|
||||||
if (firstModel) {
|
if (firstModel) {
|
||||||
setSelectedModel(`${firstModel.provider}/${firstModel.id}`);
|
setSelectedModel(`${firstModel.provider}/${firstModel.id}`);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error: unknown) => {
|
.catch((error: unknown) => {
|
||||||
@@ -955,6 +956,14 @@ export function QuickChatFAB({
|
|||||||
pendingAttachmentsRef.current = pendingAttachments;
|
pendingAttachmentsRef.current = pendingAttachments;
|
||||||
}, [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.
|
// Attachment object URLs must be revoked when the composer unmounts.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user