diff --git a/front/components/assistant/conversation/AgentMessage.tsx b/front/components/assistant/conversation/AgentMessage.tsx index 3a9ff22d3d05..0fd24c9b41fc 100644 --- a/front/components/assistant/conversation/AgentMessage.tsx +++ b/front/components/assistant/conversation/AgentMessage.tsx @@ -30,6 +30,7 @@ import type { RetrievalActionType, UserType, WebsearchActionType, + WithRank, WorkspaceType, } from "@dust-tt/types"; import { @@ -85,7 +86,7 @@ interface AgentMessageProps { conversationId: string; isInModal: boolean; isLastMessage: boolean; - message: AgentMessageType; + message: WithRank; messageFeedback: ConversationMessageFeedbackSelectorProps; owner: WorkspaceType; user: UserType; @@ -458,7 +459,10 @@ export function AgentMessage({ conversationId, message.sId ), - doc: getInteractiveDocumentPlugin(agentConfiguration.sId, message.sId), + doc: getInteractiveDocumentPlugin( + agentConfiguration.sId, + `${message.rank}.${message.version}` + ), sup: CiteBlock, mention: MentionBlock, }), diff --git a/front/components/assistant/conversation/ConversationViewer.tsx b/front/components/assistant/conversation/ConversationViewer.tsx index eef5c2ea09aa..6d5d1f4f14ab 100644 --- a/front/components/assistant/conversation/ConversationViewer.tsx +++ b/front/components/assistant/conversation/ConversationViewer.tsx @@ -9,6 +9,7 @@ import type { MessageWithContentFragmentsType, UserMessageNewEvent, UserType, + WithRank, WorkspaceType, } from "@dust-tt/types"; import { isContentFragmentType } from "@dust-tt/types"; @@ -377,8 +378,8 @@ export default ConversationViewer; */ const groupMessagesByType = ( messages: FetchConversationMessagesResponse[] -): MessageWithContentFragmentsType[][] => { - const groupedMessages: MessageWithContentFragmentsType[][] = []; +): WithRank[][] => { + const groupedMessages: WithRank[][] = []; let tempContentFragments: ContentFragmentType[] = []; messages @@ -387,7 +388,7 @@ const groupMessagesByType = ( if (isContentFragmentType(message)) { tempContentFragments.push(message); // Collect content fragments. } else { - let messageWithContentFragments: MessageWithContentFragmentsType; + let messageWithContentFragments: WithRank; if (isUserMessageType(message)) { // Attach collected content fragments to the user message. messageWithContentFragments = { diff --git a/front/components/assistant/conversation/MessageGroup.tsx b/front/components/assistant/conversation/MessageGroup.tsx index 0c0eade31096..a2df74e74dbe 100644 --- a/front/components/assistant/conversation/MessageGroup.tsx +++ b/front/components/assistant/conversation/MessageGroup.tsx @@ -2,6 +2,7 @@ import type { FetchConversationMessagesResponse, MessageWithContentFragmentsType, UserType, + WithRank, WorkspaceType, } from "@dust-tt/types"; import React, { useEffect, useRef } from "react"; @@ -10,7 +11,7 @@ import MessageItem from "@app/components/assistant/conversation/MessageItem"; import type { AgentMessageFeedbackType } from "@app/lib/api/assistant/feedback"; interface MessageGroupProps { - messages: MessageWithContentFragmentsType[]; + messages: WithRank[]; isLastMessageGroup: boolean; conversationId: string; feedbacks: AgentMessageFeedbackType[]; diff --git a/front/components/assistant/conversation/MessageItem.tsx b/front/components/assistant/conversation/MessageItem.tsx index 181255a09fce..2e9a7391529e 100644 --- a/front/components/assistant/conversation/MessageItem.tsx +++ b/front/components/assistant/conversation/MessageItem.tsx @@ -7,6 +7,7 @@ import { useSendNotification } from "@dust-tt/sparkle"; import type { MessageWithContentFragmentsType, UserType, + WithRank, WorkspaceType, } from "@dust-tt/types"; import { isSupportedImageContentType } from "@dust-tt/types"; @@ -23,7 +24,7 @@ interface MessageItemProps { messageFeedback: AgentMessageFeedbackType | undefined; isInModal: boolean; isLastMessage: boolean; - message: MessageWithContentFragmentsType; + message: WithRank; owner: WorkspaceType; user: UserType; } diff --git a/front/components/assistant/conversation/co-edition/CoEditionContext.tsx b/front/components/assistant/conversation/co-edition/CoEditionContext.tsx index bde57ace5e26..00bfb10d639e 100644 --- a/front/components/assistant/conversation/co-edition/CoEditionContext.tsx +++ b/front/components/assistant/conversation/co-edition/CoEditionContext.tsx @@ -39,10 +39,12 @@ export interface CoEditionContextType { agentConfigurationId, code, complete, + version, }: { agentConfigurationId: string; code: string; complete: boolean; + version: string; } ) => void; clear: () => void; diff --git a/front/components/markdown/VisualizationBlock.tsx b/front/components/markdown/VisualizationBlock.tsx index 39f406df9c42..a2b979553ffd 100644 --- a/front/components/markdown/VisualizationBlock.tsx +++ b/front/components/markdown/VisualizationBlock.tsx @@ -134,7 +134,10 @@ export function getVisualizationPlugin( return VisualizationPlugin; } -export function getInteractiveDocumentPlugin(agentConfigurationId: string) { +export function getInteractiveDocumentPlugin( + agentConfigurationId: string, + version: string +) { const makeCustomRenderer = (actions: CoEditionContextType["actions"]) => { return { doc: ( @@ -152,6 +155,7 @@ export function getInteractiveDocumentPlugin(agentConfigurationId: string) { agentConfigurationId, code, complete, + version, }); }} icon={EyeIcon}