diff --git a/frontend/src/components/Sidebar/index.jsx b/frontend/src/components/Sidebar/index.jsx
index b1287282..3b67abf3 100644
--- a/frontend/src/components/Sidebar/index.jsx
+++ b/frontend/src/components/Sidebar/index.jsx
@@ -129,7 +129,7 @@ export default function Sidebar() {
@MintplexLabs
@@ -295,7 +295,7 @@ export function SidebarMobileHeader() {
@MintplexLabs
diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx
new file mode 100644
index 00000000..9ffe9713
--- /dev/null
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/Citation/index.jsx
@@ -0,0 +1,99 @@
+import { memo, useState } from "react";
+import { Maximize2, Minimize2 } from "react-feather";
+import { v4 } from "uuid";
+import { decode as HTMLDecode } from "he";
+
+function combineLikeSources(sources) {
+ const combined = {};
+ sources.forEach((source) => {
+ const { id, title, text } = source;
+ if (combined.hasOwnProperty(title)) {
+ combined[title].text += `\n\n ---- Chunk ${id || ""} ---- \n\n${text}`;
+ combined[title].references += 1;
+ } else {
+ combined[title] = { title, text, references: 1 };
+ }
+ });
+ return Object.values(combined);
+}
+
+export default function Citations({ sources = [] }) {
+ if (sources.length === 0) return null;
+
+ return (
+
@@ -64,46 +63,4 @@ function HistoricalMessage({
);
}
-const Citations = ({ sources = [] }) => {
- const [show, setShow] = useState(false);
- if (sources.length === 0) return null;
-
- return (
-
-
- {show && (
- <>
-
- {sources.map((source) => {
- const { id = null, title, url } = source;
- const handleClick = () => {
- if (!url) return false;
- window.open(url, "_blank");
- };
- return (
-
- );
- })}
-
-
- *citation may not be relevant to end result.
-
- >
- )}
-
- );
-};
-
export default memo(HistoricalMessage);
diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/PromptReply/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/PromptReply/index.jsx
index a0bf02bc..a82c25a4 100644
--- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/PromptReply/index.jsx
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/PromptReply/index.jsx
@@ -1,9 +1,8 @@
-import { memo, useEffect, useRef, useState } from "react";
+import { memo, useEffect, useRef } from "react";
import { AlertTriangle } from "react-feather";
import Jazzicon from "../../../../UserIcon";
-import { v4 } from "uuid";
-import { decode as HTMLDecode } from "he";
import renderMarkdown from "../../../../../utils/chat/markdown";
+import Citations from "../Citation";
function PromptReply({
uuid,
@@ -69,46 +68,4 @@ function PromptReply({
);
}
-const Citations = ({ sources = [] }) => {
- const [show, setShow] = useState(false);
- if (sources.length === 0) return null;
-
- return (
-
-
- {show && (
- <>
-
- {sources.map((source) => {
- const { id = null, title, url } = source;
- const handleClick = () => {
- if (!url) return false;
- window.open(url, "_blank");
- };
- return (
-
- );
- })}
-
-
- *citation may not be relevant to end result.
-
- >
- )}
-
- );
-};
-
export default memo(PromptReply);
diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx
index 0ecf3238..b0e1e7a8 100644
--- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx
@@ -65,7 +65,7 @@ export default function PromptInput({
@@ -93,14 +93,14 @@ export default function PromptInput({
ref={formRef}
type="submit"
disabled={buttonDisabled}
- className="inline-flex justify-center p-0 md:p-2 rounded-full cursor-pointer text-black-900 dark:text-slate-200 hover:bg-gray-600 dark:hover:bg-stone-500"
+ className="inline-flex justify-center p-0 md:p-2 rounded-full cursor-pointer text-black-900 dark:text-slate-200 hover:bg-gray-200 dark:hover:bg-stone-500 group"
>
{buttonDisabled ? (
) : (