Skip to content

Commit ab5f4b4

Browse files
committed
fix(cli): /image command now adds images to pending banner
Previously /image would transform the command into a prompt with the path, expecting auto-detection. Now it properly adds to pendingImages in the chat store so the image shows in the banner before sending.
1 parent 9164c7b commit ab5f4b4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cli/src/commands/image.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { existsSync } from 'fs'
22
import path from 'path'
33

44
import { getProjectRoot } from '../project-files'
5+
import { useChatStore } from '../state/chat-store'
56
import { getSystemMessage } from '../utils/message-history'
67
import {
78
SUPPORTED_IMAGE_EXTENSIONS,
@@ -87,11 +88,14 @@ export function handleImageCommand(args: string): {
8788
return { postUserMessage }
8889
}
8990

90-
// Transform the command into a prompt with the image path
91-
// The image-handler will auto-detect paths like ./image.png or @image.png
92-
const transformedPrompt = message
93-
? `${message} ${imagePath}`
94-
: `Please analyze this image: ${imagePath}`
91+
// Add image to pending images for the banner
92+
useChatStore.getState().addPendingImage({
93+
path: resolvedPath,
94+
filename: path.basename(resolvedPath),
95+
})
96+
97+
// Use the optional message as the prompt, or empty to just attach the image
98+
const transformedPrompt = message || ''
9599

96100
const postUserMessage: PostUserMessageFn = (prev) => prev
97101

0 commit comments

Comments
 (0)