Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/browser/components/ChatInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,13 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
// Handle standard message sending based on variant
if (variant === "creation") {
setIsSending(true);
const ok = await creationState.handleSend(messageText);
const ok = await creationState.handleSend(
messageText,
imageParts.length > 0 ? imageParts : undefined
);
if (ok) {
setInput("");
setImageAttachments([]);
if (inputRef.current) {
inputRef.current.style.height = "36px";
}
Expand Down Expand Up @@ -882,9 +886,9 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
mode={mode}
onChange={setInput}
onKeyDown={handleKeyDown}
onPaste={variant === "workspace" ? handlePaste : undefined}
onDragOver={variant === "workspace" ? handleDragOver : undefined}
onDrop={variant === "workspace" ? handleDrop : undefined}
onPaste={handlePaste}
onDragOver={handleDragOver}
onDrop={handleDrop}
suppressKeys={showCommandSuggestions ? COMMAND_SUGGESTION_KEYS : undefined}
placeholder={placeholder}
disabled={!editingMessage && (disabled || isSending)}
Expand All @@ -897,10 +901,8 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
/>
</div>

{/* Image attachments - workspace only */}
{variant === "workspace" && (
<ImageAttachments images={imageAttachments} onRemove={handleRemoveImage} />
)}
{/* Image attachments */}
<ImageAttachments images={imageAttachments} onRemove={handleRemoveImage} />

<div className="flex flex-col gap-1" data-component="ChatModeToggles">
{/* Editing indicator - workspace only */}
Expand Down
6 changes: 4 additions & 2 deletions src/browser/components/ChatInput/useCreationWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "@/common/constants/storage";
import type { Toast } from "@/browser/components/ChatInputToast";
import { createErrorToast } from "@/browser/components/ChatInputToasts";
import type { ImagePart } from "@/common/types/ipc";

interface UseCreationWorkspaceOptions {
projectPath: string;
Expand Down Expand Up @@ -49,7 +50,7 @@ interface UseCreationWorkspaceReturn {
toast: Toast | null;
setToast: (toast: Toast | null) => void;
isSending: boolean;
handleSend: (message: string) => Promise<boolean>;
handleSend: (message: string, imageParts?: ImagePart[]) => Promise<boolean>;
}

/**
Expand Down Expand Up @@ -95,7 +96,7 @@ export function useCreationWorkspace({
}, [projectPath]);

const handleSend = useCallback(
async (message: string): Promise<boolean> => {
async (message: string, imageParts?: ImagePart[]): Promise<boolean> => {
if (!message.trim() || isSending) return false;

setIsSending(true);
Expand All @@ -114,6 +115,7 @@ export function useCreationWorkspace({
runtimeConfig,
projectPath, // Pass projectPath when workspaceId is null
trunkBranch: settings.trunkBranch, // Pass selected trunk branch from settings
imageParts: imageParts && imageParts.length > 0 ? imageParts : undefined,
});

if (!result.success) {
Expand Down