MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / ChatRowContent

Function ChatRowContent

webview-ui/src/components/chat/ChatRow.tsx:172–1719  ·  view source on GitHub ↗
({
	message,
	lastModifiedMessage,
	isExpanded,
	isLast,
	isStreaming,
	onToggleExpand,
	onSuggestionClick,
	onFollowUpUnmount,
	onBatchFileResponse,
	isFollowUpAnswered,
	isFollowUpAutoApprovalPaused,
	completionCheckpoint,
	onJumpToPreviousCheckpoint,
}: ChatRowContentProps)

Source from the content-addressed store, hash-verified

170export default ChatRow
171
172export const ChatRowContent = ({
173 message,
174 lastModifiedMessage,
175 isExpanded,
176 isLast,
177 isStreaming,
178 onToggleExpand,
179 onSuggestionClick,
180 onFollowUpUnmount,
181 onBatchFileResponse,
182 isFollowUpAnswered,
183 isFollowUpAutoApprovalPaused,
184 completionCheckpoint,
185 onJumpToPreviousCheckpoint,
186}: ChatRowContentProps) => {
187 const { t, i18n } = useTranslation()
188
189 const {
190 mcpServers,
191 alwaysAllowMcp,
192 currentCheckpoint,
193 mode,
194 apiConfiguration,
195 clineMessages,
196 currentTaskItem,
197 enableCheckpoints,
198 } = useExtensionState()
199 const { info: model } = useSelectedModel(apiConfiguration)
200 const [isEditing, setIsEditing] = useState(false)
201 const [editedContent, setEditedContent] = useState("")
202 const [editMode, setEditMode] = useState<Mode>(mode || "code")
203 const [editImages, setEditImages] = useState<string[]>([])
204
205 // Handle message events for image selection during edit mode
206 useEffect(() => {
207 const handleMessage = (event: MessageEvent) => {
208 const msg = event.data
209 if (msg.type === "selectedImages" && msg.context === "edit" && msg.messageTs === message.ts && isEditing) {
210 setEditImages((prevImages) => appendImages(prevImages, msg.images, MAX_IMAGES_PER_MESSAGE))
211 }
212 }
213
214 window.addEventListener("message", handleMessage)
215 return () => window.removeEventListener("message", handleMessage)
216 }, [isEditing, message.ts])
217
218 // Memoized callback to prevent re-renders caused by inline arrow functions.
219 const handleToggleExpand = useCallback(() => {
220 onToggleExpand(message.ts)
221 }, [onToggleExpand, message.ts])
222
223 // Handle edit button click
224 const handleEditClick = useCallback(() => {
225 setIsEditing(true)
226 setEditedContent(message.text || "")
227 setEditImages(message.images || [])
228 setEditMode(mode || "code")
229 // Edit mode is now handled entirely in the frontend

Callers

nothing calls this directly

Calls 15

useExtensionStateFunction · 0.90
useSelectedModelFunction · 0.90
safeJsonParseFunction · 0.90
formatPathTooltipFunction · 0.90
cnFunction · 0.90
tFunction · 0.85
getIconSpanFunction · 0.85
toolIconFunction · 0.85
getPreviousTodosFunction · 0.85
parseMethod · 0.80
formatBytesFunction · 0.70

Tested by

no test coverage detected