diff --git a/src/interface/web/app/factchecker/factChecker.module.css b/src/interface/web/app/factchecker/factChecker.module.css
index c504d4d6..9882b2a3 100644
--- a/src/interface/web/app/factchecker/factChecker.module.css
+++ b/src/interface/web/app/factchecker/factChecker.module.css
@@ -13,6 +13,11 @@ input.factVerification {
font-size: large;
}
+div.factCheckerContainer {
+ width: 75vw;
+ margin: auto;
+}
+
input.factVerification:focus {
outline: none;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
@@ -123,6 +128,12 @@ div.dot2 {
animation-delay: -1.0s;
}
+@media screen and (max-width: 768px) {
+ div.factCheckerContainer {
+ width: 95vw;
+ }
+}
+
@-webkit-keyframes sk-rotate {
100% {
-webkit-transform: rotate(360deg)
diff --git a/src/interface/web/app/factchecker/factCheckerLayout.module.css b/src/interface/web/app/factchecker/factCheckerLayout.module.css
deleted file mode 100644
index 1664029d..00000000
--- a/src/interface/web/app/factchecker/factCheckerLayout.module.css
+++ /dev/null
@@ -1,10 +0,0 @@
-.factCheckerLayout {
- max-width: 70vw;
- margin: auto;
-}
-
-@media screen and (max-width: 700px) {
- .factCheckerLayout {
- max-width: 90vw;
- }
-}
diff --git a/src/interface/web/app/factchecker/layout.tsx b/src/interface/web/app/factchecker/layout.tsx
index 8726b59b..5c4e136e 100644
--- a/src/interface/web/app/factchecker/layout.tsx
+++ b/src/interface/web/app/factchecker/layout.tsx
@@ -1,7 +1,4 @@
-
import type { Metadata } from "next";
-import NavMenu from '../components/navMenu/navMenu';
-import styles from './factCheckerLayout.module.css';
export const metadata: Metadata = {
title: "Khoj AI - Fact Checker",
@@ -17,8 +14,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
-
-
+
{children}
);
diff --git a/src/interface/web/app/factchecker/page.tsx b/src/interface/web/app/factchecker/page.tsx
index bb6e5af2..3d6e4882 100644
--- a/src/interface/web/app/factchecker/page.tsx
+++ b/src/interface/web/app/factchecker/page.tsx
@@ -19,6 +19,7 @@ import {
CardTitle,
} from "@/components/ui/card"
import Link from 'next/link';
+import SidePanel from '../components/sidePanel/chatHistorySidePanel';
@@ -76,41 +77,41 @@ async function verifyStatement(
setIsLoading: (loading: boolean) => void,
setInitialResponse: (response: string) => void,
setInitialReferences: (references: ResponseWithReferences) => void) {
- setIsLoading(true);
- // Send a message to the chat server to verify the fact
- let verificationMessage = `${verificationPrecursor} ${message}`;
- const apiURL = `${chatURL}?q=${encodeURIComponent(verificationMessage)}&client=web&stream=true&conversation_id=${conversationId}`;
- try {
- const response = await fetch(apiURL);
- if (!response.body) throw new Error("No response body found");
+ setIsLoading(true);
+ // Send a message to the chat server to verify the fact
+ let verificationMessage = `${verificationPrecursor} ${message}`;
+ const apiURL = `${chatURL}?q=${encodeURIComponent(verificationMessage)}&client=web&stream=true&conversation_id=${conversationId}`;
+ try {
+ const response = await fetch(apiURL);
+ if (!response.body) throw new Error("No response body found");
- const reader = response.body?.getReader();
- let decoder = new TextDecoder();
- let result = "";
+ const reader = response.body?.getReader();
+ let decoder = new TextDecoder();
+ let result = "";
- while (true) {
- const { done, value } = await reader.read();
- if (done) break;
+ while (true) {
+ const { done, value } = await reader.read();
+ if (done) break;
- let chunk = decoder.decode(value, { stream: true });
+ let chunk = decoder.decode(value, { stream: true });
- if (chunk.includes("### compiled references:")) {
- const references = handleCompiledReferences(chunk, result);
- if (references.response) {
- result = references.response;
- setInitialResponse(references.response);
- setInitialReferences(references);
- }
- } else {
- result += chunk;
- setInitialResponse(result);
+ if (chunk.includes("### compiled references:")) {
+ const references = handleCompiledReferences(chunk, result);
+ if (references.response) {
+ result = references.response;
+ setInitialResponse(references.response);
+ setInitialReferences(references);
}
+ } else {
+ result += chunk;
+ setInitialResponse(result);
}
- } catch (error) {
- console.error("Error verifying statement: ", error);
- } finally {
- setIsLoading(false);
}
+ } catch (error) {
+ console.error("Error verifying statement: ", error);
+ } finally {
+ setIsLoading(false);
+ }
}
@@ -145,7 +146,7 @@ function ReferenceVerification(props: ReferenceVerificationProps) {
setInitialResponse(props.prefilledResponse);
setIsLoading(false);
} else {
- verifyStatement(verificationStatement, props.conversationId, setIsLoading, setInitialResponse, () => {});
+ verifyStatement(verificationStatement, props.conversationId, setIsLoading, setInitialResponse, () => { });
}
setIsMobileWidth(window.innerWidth < 768);
@@ -454,7 +455,7 @@ export default function FactChecker() {
additionalLink={additionalLink}
setChildReferencesCallback={setChildReferencesCallback} />
);
- }).filter(Boolean);
+ }).filter(Boolean);
};
const renderSupplementalReferences = (references: SupplementReferences[]) => {
@@ -489,102 +490,111 @@ export default function FactChecker() {
}
return (
-
-
- AI Fact Checker
-
-
- {
- initialResponse && initialReferences && childReferences
- ?
-
-
- {} : storeData} />
-
- :
-
- setFactToVerify(e.target.value)}
- value={factToVerify}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- onClickVerify();
- }
- }}
- onFocus={(e) => e.target.placeholder = ""}
- onBlur={(e) => e.target.placeholder = "Enter a falsifiable statement to verify"} />
-
-
-
- Try with a particular model. You must be subscribed to configure the model.
-
-
- }
-
- {isLoading &&
+ <>
+
+
+
+
+
+ AI Fact Checker
+
+
+ {
+ initialResponse && initialReferences && childReferences
+ ?
+
+
+ { } : storeData} />
+
+ :
+
+ setFactToVerify(e.target.value)}
+ value={factToVerify}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ onClickVerify();
+ }
+ }}
+ onFocus={(e) => e.target.placeholder = ""}
+ onBlur={(e) => e.target.placeholder = "Enter a falsifiable statement to verify"} />
+
+
+
+ Try with a particular model. You must be subscribed to configure the model.
+
+
+ }
+
+ {isLoading &&
}
- {
- initialResponse &&
-
-
- {officialFactToVerify}
-
-
-
-
-
-
-
-
- {
- initialReferences && initialReferences.online && Object.keys(initialReferences.online).length > 0 && (
-
+ {
+ initialResponse &&
+
+
+ {officialFactToVerify}
+
+
+
+ {
- const webpages = onlineData?.webpages || [];
- return renderWebpages(webpages);
- })
+ automationId: "",
+ by: "AI",
+ message: initialResponse,
+ context: [],
+ created: (new Date()).toISOString(),
+ onlineContext: {}
}
-
- )}
-
-
- }
- {
- initialReferences &&
-
-
Supplements
-
- { initialReferences.online !== undefined &&
- renderReferences(conversationID, initialReferences, officialFactToVerify, loadedFromStorage, childReferences)}
+ } isMobileWidth={isMobileWidth} />
+
+
+
+
+ {
+ initialReferences && initialReferences.online && Object.keys(initialReferences.online).length > 0 && (
+
+ {
+ Object.entries(initialReferences.online).map(([key, onlineData], index) => {
+ const webpages = onlineData?.webpages || [];
+ return renderWebpages(webpages);
+ })
+ }
+
+ )}
+
+
+ }
+ {
+ initialReferences &&
+
+
Supplements
+
+ {initialReferences.online !== undefined &&
+ renderReferences(conversationID, initialReferences, officialFactToVerify, loadedFromStorage, childReferences)}
+
-
- }
-
+ }
+
+ >
)
}