feat(agent): show avatar and lock model select in auto mode
This commit is contained in:
parent
d68512b71a
commit
3f3088beb7
@ -164,6 +164,7 @@ function PureMultimodalInput({
|
||||
console.log('[MultimodalInput] Render - isImageModel:', isImageModel);
|
||||
console.log('[MultimodalInput] Render - imageParams:', imageParams);
|
||||
console.log('[MultimodalInput] Render - onImageParamsChange:', !!onImageParamsChange);
|
||||
const isAgentMode = selectedModelId === "auto";
|
||||
|
||||
const router = useRouter();
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
||||
@ -1144,11 +1145,13 @@ function PureMultimodalInput({
|
||||
selectedModelId={selectedModelId}
|
||||
status={status}
|
||||
/>
|
||||
<ModelSelectorCompact
|
||||
onModelChange={onModelChange}
|
||||
selectedModelId={selectedModelId}
|
||||
attachments={attachments}
|
||||
/>
|
||||
{!isAgentMode ? (
|
||||
<ModelSelectorCompact
|
||||
onModelChange={onModelChange}
|
||||
selectedModelId={selectedModelId}
|
||||
attachments={attachments}
|
||||
/>
|
||||
) : null}
|
||||
{isImageModel && onImageParamsChange && (
|
||||
<ImageParamsBar
|
||||
key={`image-params-${selectedModelId}-${isImageModel}`}
|
||||
@ -1164,6 +1167,15 @@ function PureMultimodalInput({
|
||||
)}
|
||||
</PromptInputTools>
|
||||
|
||||
{isAgentMode ? (
|
||||
<ModelSelectorCompact
|
||||
selectedModelId={selectedModelId}
|
||||
attachments={attachments}
|
||||
avatarOnly={true}
|
||||
readOnly={true}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{status === "submitted" || status === "streaming" ? (
|
||||
<StopButton setMessages={setMessages} stop={stop} />
|
||||
) : (
|
||||
@ -1285,11 +1297,13 @@ function PureModelSelectorCompact({
|
||||
onModelChange,
|
||||
attachments,
|
||||
avatarOnly = false,
|
||||
readOnly = false,
|
||||
}: {
|
||||
selectedModelId: string;
|
||||
onModelChange?: (modelId: string) => void;
|
||||
attachments: Attachment[];
|
||||
avatarOnly?: boolean;
|
||||
readOnly?: boolean;
|
||||
}) {
|
||||
const [optimisticModelId, setOptimisticModelId] = useState(selectedModelId);
|
||||
|
||||
@ -1463,6 +1477,36 @@ function PureModelSelectorCompact({
|
||||
);
|
||||
}
|
||||
|
||||
if (readOnly) {
|
||||
if (avatarOnly) {
|
||||
return (
|
||||
<Button
|
||||
className="h-8 w-8 rounded-full border border-border p-0 hover:bg-transparent"
|
||||
variant="ghost"
|
||||
disabled
|
||||
aria-label={selectedModel?.name || "Agent模式"}
|
||||
>
|
||||
{selectedModel?.avatarUrl ? (
|
||||
<img
|
||||
src={selectedModel.avatarUrl}
|
||||
alt={selectedModel.name}
|
||||
className="h-7 w-7 rounded-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<Bot className="h-4 w-4" />
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Button className="h-8 px-2" variant="ghost" disabled>
|
||||
<CpuIcon size={16} />
|
||||
<span className="hidden font-medium text-xs sm:block">{selectedModel?.name}</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<PromptInputModelSelect
|
||||
onValueChange={(modelId) => {
|
||||
@ -1586,6 +1630,9 @@ const ModelSelectorCompact = memo(
|
||||
if (prevProps.avatarOnly !== nextProps.avatarOnly) {
|
||||
return false;
|
||||
}
|
||||
if (prevProps.readOnly !== nextProps.readOnly) {
|
||||
return false;
|
||||
}
|
||||
if (!equal(prevProps.attachments, nextProps.attachments)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user