Files
automaker/apps/ui/src/components/views/agent-view/input-area/agent-input-area.tsx
Shirone 8c04e0028f feat: integrate thinking level support across agent and UI components
- Enhanced the agent service and request handling to include an optional thinking level parameter, improving the configurability of model interactions.
- Updated the UI components to manage and display the selected model along with its thinking level, ensuring a cohesive user experience.
- Refactored the model selector and input controls to accommodate the new model selection structure, enhancing usability and clarity.
- Adjusted the Electron API and HTTP client to support the new thinking level parameter in requests, ensuring consistent data handling across the application.

This update significantly improves the agent's ability to adapt its reasoning capabilities based on user-defined thinking levels, enhancing overall performance and user satisfaction.
2026-01-02 15:22:06 +01:00

134 lines
3.7 KiB
TypeScript

import { ImageDropZone } from '@/components/ui/image-drop-zone';
import type { ImageAttachment, TextFileAttachment } from '@/store/app-store';
import type { PhaseModelEntry } from '@automaker/types';
import { FilePreview } from './file-preview';
import { QueueDisplay } from './queue-display';
import { InputControls } from './input-controls';
interface QueueItem {
id: string;
message: string;
imagePaths?: string[];
}
interface AgentInputAreaProps {
input: string;
onInputChange: (value: string) => void;
onSend: () => void;
onStop: () => void;
/** Current model selection (model + optional thinking level) */
modelSelection: PhaseModelEntry;
/** Callback when model is selected */
onModelSelect: (entry: PhaseModelEntry) => void;
isProcessing: boolean;
isConnected: boolean;
// File attachments
selectedImages: ImageAttachment[];
selectedTextFiles: TextFileAttachment[];
showImageDropZone: boolean;
isDragOver: boolean;
onImagesSelected: (images: ImageAttachment[]) => void;
onToggleImageDropZone: () => void;
onRemoveImage: (imageId: string) => void;
onRemoveTextFile: (fileId: string) => void;
onClearAllFiles: () => void;
onDragEnter: (e: React.DragEvent) => void;
onDragLeave: (e: React.DragEvent) => void;
onDragOver: (e: React.DragEvent) => void;
onDrop: (e: React.DragEvent) => Promise<void>;
onPaste: (e: React.ClipboardEvent) => Promise<void>;
// Queue
serverQueue: QueueItem[];
onRemoveFromQueue: (id: string) => void;
onClearQueue: () => void;
// Refs
inputRef?: React.RefObject<HTMLTextAreaElement | null>;
}
export function AgentInputArea({
input,
onInputChange,
onSend,
onStop,
modelSelection,
onModelSelect,
isProcessing,
isConnected,
selectedImages,
selectedTextFiles,
showImageDropZone,
isDragOver,
onImagesSelected,
onToggleImageDropZone,
onRemoveImage,
onRemoveTextFile,
onClearAllFiles,
onDragEnter,
onDragLeave,
onDragOver,
onDrop,
onPaste,
serverQueue,
onRemoveFromQueue,
onClearQueue,
inputRef,
}: AgentInputAreaProps) {
const hasFiles = selectedImages.length > 0 || selectedTextFiles.length > 0;
return (
<div className="border-t border-border p-4 bg-card/50 backdrop-blur-sm">
{/* Image Drop Zone (when visible) */}
{showImageDropZone && (
<ImageDropZone
onImagesSelected={onImagesSelected}
images={selectedImages}
maxFiles={5}
className="mb-4"
disabled={!isConnected}
/>
)}
{/* Queued Prompts List */}
<QueueDisplay
serverQueue={serverQueue}
onRemoveFromQueue={onRemoveFromQueue}
onClearQueue={onClearQueue}
/>
{/* Selected Files Preview - only show when ImageDropZone is hidden */}
{!showImageDropZone && (
<FilePreview
selectedImages={selectedImages}
selectedTextFiles={selectedTextFiles}
isProcessing={isProcessing}
onRemoveImage={onRemoveImage}
onRemoveTextFile={onRemoveTextFile}
onClearAll={onClearAllFiles}
/>
)}
{/* Input Controls */}
<InputControls
input={input}
onInputChange={onInputChange}
onSend={onSend}
onStop={onStop}
onToggleImageDropZone={onToggleImageDropZone}
onPaste={onPaste}
modelSelection={modelSelection}
onModelSelect={onModelSelect}
isProcessing={isProcessing}
isConnected={isConnected}
hasFiles={hasFiles}
isDragOver={isDragOver}
showImageDropZone={showImageDropZone}
onDragEnter={onDragEnter}
onDragLeave={onDragLeave}
onDragOver={onDragOver}
onDrop={onDrop}
inputRef={inputRef}
/>
</div>
);
}