diff --git a/front/components/assistant/conversation/AgentMessage.tsx b/front/components/assistant/conversation/AgentMessage.tsx index 56066f9067ce..a238d0aaa7fb 100644 --- a/front/components/assistant/conversation/AgentMessage.tsx +++ b/front/components/assistant/conversation/AgentMessage.tsx @@ -35,6 +35,7 @@ import type { } from "@dust-tt/types"; import { assertNever, + GLOBAL_AGENTS_SID, isRetrievalActionType, isWebsearchActionType, removeNulls, @@ -94,19 +95,23 @@ export const FeedbackSelectorPopoverContent = ({ return ( agentLastAuthor && ( -
- {agentLastAuthor?.image && ( - {agentLastAuthor?.firstName} - )} +
- Your feedback will be sent to: -
- {agentLastAuthor?.firstName} {agentLastAuthor?.lastName} + Your feedback is available to editors of the assistant. The last + assistant editor is:
+
+ {agentLastAuthor.image && ( + {agentLastAuthor.firstName} + )} + + {agentLastAuthor.firstName} {agentLastAuthor.lastName} + +
) ); @@ -153,6 +158,12 @@ export function AgentMessage({ { index: number; document: MarkdownCitation }[] >([]); + const isGlobalAgent = useMemo(() => { + return Object.values(GLOBAL_AGENTS_SID).includes( + message.configuration.sId as GLOBAL_AGENTS_SID + ); + }, [message.configuration.sId]); + const shouldStream = (() => { if (message.status !== "created") { return false; @@ -428,14 +439,19 @@ export function AgentMessage({ className="text-muted-foreground" disabled={isRetryHandlerProcessing || shouldStream} />, -
-
-
, - , + // One cannot leave feedback on global agents. + ...(isGlobalAgent + ? [] + : [ +
+
+
, + , + ]), ]; // References logic. diff --git a/front/components/assistant/conversation/MessageItem.tsx b/front/components/assistant/conversation/MessageItem.tsx index c32f665226dd..65c36134af24 100644 --- a/front/components/assistant/conversation/MessageItem.tsx +++ b/front/components/assistant/conversation/MessageItem.tsx @@ -54,28 +54,31 @@ const MessageItem = React.forwardRef( useSubmitFunction( async ({ thumb, - isToRemove, + shouldRemoveExistingFeedback, feedbackContent, + isConversationShared, }: { thumb: string; - isToRemove: boolean; - feedbackContent?: string | null; + shouldRemoveExistingFeedback: boolean; + feedbackContent: string | null; + isConversationShared: boolean; }) => { const res = await fetch( `/api/w/${owner.sId}/assistant/conversations/${conversationId}/messages/${message.sId}/feedbacks`, { - method: isToRemove ? "DELETE" : "POST", + method: shouldRemoveExistingFeedback ? "DELETE" : "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ thumbDirection: thumb, feedbackContent, + isConversationShared, }), } ); if (res.ok) { - if (feedbackContent && !isToRemove) { + if (feedbackContent && !shouldRemoveExistingFeedback) { sendNotification({ title: "Feedback submitted", description: @@ -99,6 +102,7 @@ const MessageItem = React.forwardRef( ? { thumb: messageFeedback.thumbDirection, feedbackContent: messageFeedback.content, + isConversationShared: messageFeedback.isConversationShared, } : null, onSubmitThumb, diff --git a/front/package-lock.json b/front/package-lock.json index 3a3f703a6ab8..dfbcb43cdbb3 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -7,7 +7,7 @@ "dependencies": { "@auth0/nextjs-auth0": "^3.5.0", "@dust-tt/client": "file:../sdks/js", - "@dust-tt/sparkle": "^0.2.350", + "@dust-tt/sparkle": "^0.2.351", "@dust-tt/types": "file:../types", "@headlessui/react": "^1.7.7", "@heroicons/react": "^2.0.11", @@ -11453,9 +11453,10 @@ "link": true }, "node_modules/@dust-tt/sparkle": { - "version": "0.2.350", - "resolved": "https://registry.npmjs.org/@dust-tt/sparkle/-/sparkle-0.2.350.tgz", - "integrity": "sha512-yY9sz4r4L2W1YcOeuulsqujE7Lc5R+ZPGgcIvZzGY/z2X+XqfeouexKre+CD7JqY6ZbsQBKgeB+7PmoGEkA/8Q==", + "version": "0.2.351", + "resolved": "https://registry.npmjs.org/@dust-tt/sparkle/-/sparkle-0.2.351.tgz", + "integrity": "sha512-JavoOPirn+5aqnch06wUpyq8/PetbpdBtrgd86mn0SMoJy9Dqx8Vh7eqyvy/GIqPkJHXtiq2hgKxGbNejJCWfQ==", + "license": "ISC", "dependencies": { "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", diff --git a/front/package.json b/front/package.json index d990bdec8571..1c2cac968063 100644 --- a/front/package.json +++ b/front/package.json @@ -20,7 +20,7 @@ "dependencies": { "@auth0/nextjs-auth0": "^3.5.0", "@dust-tt/client": "file:../sdks/js", - "@dust-tt/sparkle": "^0.2.350", + "@dust-tt/sparkle": "^0.2.351", "@dust-tt/types": "file:../types", "@headlessui/react": "^1.7.7", "@heroicons/react": "^2.0.11", diff --git a/front/pages/api/w/[wId]/assistant/conversations/[cId]/messages/[mId]/feedbacks/index.ts b/front/pages/api/w/[wId]/assistant/conversations/[cId]/messages/[mId]/feedbacks/index.ts index 13c115061743..9408a1807ad9 100644 --- a/front/pages/api/w/[wId]/assistant/conversations/[cId]/messages/[mId]/feedbacks/index.ts +++ b/front/pages/api/w/[wId]/assistant/conversations/[cId]/messages/[mId]/feedbacks/index.ts @@ -18,6 +18,7 @@ import { apiError } from "@app/logger/withlogging"; export const MessageFeedbackRequestBodySchema = t.type({ thumbDirection: t.string, feedbackContent: t.union([t.string, t.undefined, t.null]), + isConversationShared: t.union([t.boolean, t.undefined]), }); async function handler( @@ -86,6 +87,7 @@ async function handler( thumbDirection: bodyValidation.right .thumbDirection as AgentMessageFeedbackDirection, content: bodyValidation.right.feedbackContent || "", + isConversationShared: bodyValidation.right.isConversationShared, }); if (created.isErr()) {