From e97e1ba4bc2b7e4d279007b86f03800083d2ff00 Mon Sep 17 00:00:00 2001 From: SamDanielDev <149076627+SDanielDev@users.noreply.github.com> Date: Fri, 7 Jun 2024 18:16:50 +0100 Subject: [PATCH 1/5] Updated nextra docs with new html code block installation instruction --- docs/pages/Extensions/react-widget.md | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/pages/Extensions/react-widget.md b/docs/pages/Extensions/react-widget.md index 6368899..94e6c23 100644 --- a/docs/pages/Extensions/react-widget.md +++ b/docs/pages/Extensions/react-widget.md @@ -51,6 +51,59 @@ export default function MyApp({ Component, pageProps }) { ) } ``` +### How to use DocsGPTWidget with HTML +```html + + + + + + + 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) From 8834a19743197e0c227c614b42b3ea6d56246cda Mon Sep 17 00:00:00 2001 From: ilyasosman Date: Mon, 10 Jun 2024 22:50:35 +0300 Subject: [PATCH 2/5] Denominations on tokens --- frontend/src/settings/Documents.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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' From 9862083e0bfc04a7ae4d4c10419ec9274d853184 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 11 Jun 2024 10:11:09 +0100 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 🦖 - - - -
- - - + + + + + + DocsGPT 🦖 + + + + +
+ + + + \ No newline at end of file diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index cf4949e..f19446c 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -137,13 +137,13 @@ export default function Conversation() {
{queries.length > 0 && !hasScrolledToLast && (
-
+
{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 f19446c..636d405 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -137,7 +137,7 @@ export default function Conversation() {
{queries.length > 0 && !hasScrolledToLast && (
-
-
+
+
) : (
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); +}