diff --git a/site/src/pages/AgentsPage/AgentChatInput.tsx b/site/src/pages/AgentsPage/AgentChatInput.tsx index 8e7e6588b8..c21db17eb4 100644 --- a/site/src/pages/AgentsPage/AgentChatInput.tsx +++ b/site/src/pages/AgentsPage/AgentChatInput.tsx @@ -1,4 +1,4 @@ -import type { ChatQueuedMessage } from "api/typesGenerated"; +import type { ChatMessagePart, ChatQueuedMessage } from "api/typesGenerated"; import { ModelSelector, type ModelSelectorOption, @@ -94,11 +94,7 @@ interface AgentChatInputProps { onStartQueueEdit?: ( id: number, text: string, - fileBlocks: readonly { - mediaType: string; - data?: string; - fileId?: string; - }[], + fileBlocks: readonly ChatMessagePart[], ) => void; onCancelQueueEdit?: () => void; // History editing state, owned by the parent. diff --git a/site/src/pages/AgentsPage/AgentDetail.tsx b/site/src/pages/AgentsPage/AgentDetail.tsx index bb2badf4a6..be0201bb3f 100644 --- a/site/src/pages/AgentsPage/AgentDetail.tsx +++ b/site/src/pages/AgentsPage/AgentDetail.tsx @@ -15,6 +15,7 @@ import { import { deploymentSSHConfig } from "api/queries/deployment"; import { workspaceById, workspaceByIdKey } from "api/queries/workspaces"; import type * as TypesGen from "api/typesGenerated"; +import type { ChatMessagePart } from "api/typesGenerated"; import { useProxy } from "contexts/ProxyContext"; import { getTerminalHref, @@ -102,18 +103,14 @@ export function useConversationEditingState(deps: { string | null >(null); const [editingFileBlocks, setEditingFileBlocks] = useState< - readonly { mediaType: string; data?: string; fileId?: string }[] + readonly ChatMessagePart[] >([]); const handleEditUserMessage = useCallback( ( messageId: number, text: string, - fileBlocks?: readonly { - mediaType: string; - data?: string; - fileId?: string; - }[], + fileBlocks?: readonly ChatMessagePart[], ) => { setDraftBeforeHistoryEdit((prev) => editingMessageId !== null ? prev : inputValueRef.current, @@ -143,15 +140,7 @@ export function useConversationEditingState(deps: { >(null); const handleStartQueueEdit = useCallback( - ( - id: number, - text: string, - fileBlocks: readonly { - mediaType: string; - data?: string; - fileId?: string; - }[], - ) => { + (id: number, text: string, fileBlocks: readonly ChatMessagePart[]) => { setDraftBeforeQueueEdit((prev) => editingQueuedMessageID === null ? inputValueRef.current : prev, ); diff --git a/site/src/pages/AgentsPage/AgentDetail/ConversationTimeline.tsx b/site/src/pages/AgentsPage/AgentDetail/ConversationTimeline.tsx index bb879f5e55..1d5449299d 100644 --- a/site/src/pages/AgentsPage/AgentDetail/ConversationTimeline.tsx +++ b/site/src/pages/AgentsPage/AgentDetail/ConversationTimeline.tsx @@ -246,10 +246,10 @@ function renderBlockList({ ); } case "file": - if (block.mediaType.startsWith("image/")) { - const src = block.fileId - ? `/api/experimental/chats/files/${block.fileId}` - : `data:${block.mediaType};base64,${block.data}`; + if (block.media_type.startsWith("image/")) { + const src = block.file_id + ? `/api/experimental/chats/files/${block.file_id}` + : `data:${block.media_type};base64,${block.data}`; return (