diff --git a/README.md b/README.md index bce8d91..2ddcce1 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Say goodbye to time-consuming manual searches, and let + + + + + DocsGPT Widget + + +
+ + + + + +``` +To link the widget to your api and your documents you can pass parameters to the renderDocsGPTWidget('div id', { parameters }). +```html + + + + + + + DocsGPT Widget + + +
+ + + + + +``` For more information about React, refer to this [link here](https://react.dev/learn) diff --git a/frontend/index.html b/frontend/index.html index 3717e3e..5af1721 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,13 +1,17 @@ - - - - DocsGPT 🦖 - - - -
- - - + + + + + + DocsGPT 🦖 + + + + +
+ + + + \ No newline at end of file diff --git a/frontend/src/Hero.tsx b/frontend/src/Hero.tsx index f138ec4..904dd27 100644 --- a/frontend/src/Hero.tsx +++ b/frontend/src/Hero.tsx @@ -29,7 +29,7 @@ export default function Hero({
-
+
{demos?.map( (demo: { header: string; query: string }, key: number) => demo.header && diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index ea1dafb..42a14ad 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -19,7 +19,6 @@ import { FEEDBACK, Query } from './conversationModels'; import { sendFeedback } from './conversationApi'; import { useTranslation } from 'react-i18next'; import ArrowDown from './../assets/arrow-down.svg'; -import RetryIcon from '../components/RetryIcon'; export default function Conversation() { const queries = useSelector(selectQueries); const status = useSelector(selectStatus); @@ -176,13 +175,13 @@ export default function Conversation() {
{queries.length > 0 && !hasScrolledToLast && (
- - {/* INPUTS VIEW */} -
- {lastQueryReturnedErr && ( - - )} - -
+
+
) : (
diff --git a/frontend/src/index.css b/frontend/src/index.css index c47b442..ac90fc6 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -408,3 +408,7 @@ template { ::-webkit-scrollbar { width: 0; } + +.bottom-safe { + bottom: env(safe-area-inset-bottom, 0); +} diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index e73ce73..19bde1f 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -2,6 +2,24 @@ import { DocumentsProps } from '../models/misc'; import Trash from '../assets/trash.svg'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; + +// Utility function to format numbers +const formatTokens = (tokens: number): string => { + const roundToTwoDecimals = (num: number): string => { + return (Math.round((num + Number.EPSILON) * 100) / 100).toString(); + }; + + if (tokens >= 1_000_000_000) { + return roundToTwoDecimals(tokens / 1_000_000_000) + 'b'; + } else if (tokens >= 1_000_000) { + return roundToTwoDecimals(tokens / 1_000_000) + 'm'; + } else if (tokens >= 1_000) { + return roundToTwoDecimals(tokens / 1_000) + 'k'; + } else { + return tokens.toString(); + } +}; + const Documents: React.FC = ({ documents, handleDeleteDocument, @@ -40,7 +58,7 @@ const Documents: React.FC = ({ {document.date} - {document.tokens ? document.tokens : ''} + {document.tokens ? formatTokens(+document.tokens) : ''} {document.location === 'remote'