Skip to content

Commit 965cf19

Browse files
committed
fix: resolve duplicate type definitions and add textToCopy prop to
CopyIconButton
1 parent 916dabe commit 965cf19

File tree

3 files changed

+12
-25
lines changed

3 files changed

+12
-25
lines changed

cli/src/commands/router.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,7 @@ export async function routeUserPrompt(
142142
filename,
143143
})
144144

145-
setMessages((prev) => [
146-
...prev,
147-
getSystemMessage(`📎 Image attached: ${filename}`),
148-
])
145+
// Note: No system message added here - the PendingImagesBanner shows attached images
149146
saveToHistory(trimmed)
150147
setInputValue({ text: '', cursorPosition: 0, lastEditDueToNav: false })
151148
setInputMode('default')

cli/src/components/copy-icon-button.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type { ContentBlock } from '../types/chat'
1111
interface CopyIconButtonProps {
1212
blocks?: ContentBlock[]
1313
content?: string
14+
textToCopy?: string
1415
}
1516

1617
const BULLET_CHAR = '•'
@@ -63,18 +64,20 @@ const extractTextFromBlocks = (blocks?: ContentBlock[]): string => {
6364
export const CopyIconButton: React.FC<CopyIconButtonProps> = ({
6465
blocks,
6566
content,
67+
textToCopy: textToCopyProp,
6668
}) => {
6769
const theme = useTheme()
6870
const hover = useHoverToggle()
6971
const { setTimeout } = useTimeout()
7072
const [isCopied, setIsCopied] = useState(false)
7173

72-
// Compute text to copy from blocks or content
74+
// Compute text to copy from blocks or content (or use provided textToCopy)
7375
const textToCopy = useMemo(() => {
76+
if (textToCopyProp) return textToCopyProp
7477
return blocks && blocks.length > 0
7578
? extractTextFromBlocks(blocks) || content || ''
7679
: content || ''
77-
}, [blocks, content])
80+
}, [blocks, content, textToCopyProp])
7881

7982
const handleClick = async () => {
8083
try {

cli/src/types/chat.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,6 @@ export type PlanContentBlock = {
6565
content: string
6666
}
6767

68-
export type ImageContentBlock = {
69-
type: 'image'
70-
image: string // base64 encoded image data
71-
mediaType: string
72-
filename?: string
73-
size?: number
74-
width?: number
75-
height?: number
76-
isCollapsed?: boolean
77-
userOpened?: boolean
78-
}
79-
8068
export type AskUserContentBlock = {
8169
type: 'ask-user'
8270
toolCallId: string
@@ -110,11 +98,16 @@ export type ImageContentBlock = {
11098
mediaType: string
11199
filename?: string
112100
size?: number
101+
width?: number
102+
height?: number
103+
isCollapsed?: boolean
104+
userOpened?: boolean
113105
}
114106

115107
export type ImageAttachment = {
116-
path: string
117108
filename: string
109+
path: string
110+
size?: number
118111
}
119112

120113
export type ContentBlock =
@@ -136,12 +129,6 @@ export type AgentMessage = {
136129
subAgentCount?: number
137130
}
138131

139-
export type ImageAttachment = {
140-
filename: string
141-
path: string // Full path for opening the file
142-
size?: number
143-
}
144-
145132
export type ChatMessage = {
146133
id: string
147134
variant: ChatVariant

0 commit comments

Comments
 (0)