diff --git a/extensions/react-widget/README.md b/extensions/react-widget/README.md index 0d802f44..aca5f56c 100644 --- a/extensions/react-widget/README.md +++ b/extensions/react-widget/README.md @@ -25,7 +25,16 @@ To link the widget to your api and your documents you can pass parameters to the import { DocsGPTWidget } from "docsgpt"; const App = () => { - return ; + return ; }; ``` diff --git a/extensions/react-widget/package.json b/extensions/react-widget/package.json index f2fb1297..39740d68 100644 --- a/extensions/react-widget/package.json +++ b/extensions/react-widget/package.json @@ -1,6 +1,6 @@ { "name": "docsgpt-bot", - "version": "4.0.6", + "version": "4.0.7", "description": "docsgpt ai assistant", "source": "./src/index.html", "main": "dist/main.js", diff --git a/extensions/react-widget/src/components/DocsGPTWidget.tsx b/extensions/react-widget/src/components/DocsGPTWidget.tsx index adbae962..1a94318d 100644 --- a/extensions/react-widget/src/components/DocsGPTWidget.tsx +++ b/extensions/react-widget/src/components/DocsGPTWidget.tsx @@ -1,6 +1,6 @@ "use client"; import { Fragment, useEffect, useRef, useState } from 'react' -import { PaperPlaneIcon, RocketIcon, ExclamationTriangleIcon, Cross1Icon, WidthIcon } from '@radix-ui/react-icons'; +import { PaperPlaneIcon, RocketIcon, ExclamationTriangleIcon, Cross1Icon } from '@radix-ui/react-icons'; import { MESSAGE_TYPE } from '../models/types'; import { Query, Status } from '../models/types'; import MessageIcon from '../assets/message.svg' @@ -211,7 +211,7 @@ const HeroWrapper = styled.div` background-color: #222327; border-radius: 10px; font-weight: normal; - padding: 2px; + padding: 6px; display: flex; justify-content: space-between; ` @@ -226,7 +226,10 @@ const HeroDescription = styled.p` color: #fff; font-size: 13px; `; -const Hero = () => { +const Avatar = styled.img<{width:number,height:number}>` +max-width: ${props => props.width}; +` +const Hero = ({title,description}:{title:string,description:string}) => { return ( <> @@ -235,9 +238,9 @@ const Hero = () => {
- Welcome to DocsGPT ! + {title} - This is a chatbot that uses GPT-3, Faiss, and LangChain to answer questions. + {description}
@@ -245,7 +248,16 @@ const Hero = () => { ); }; -export const DocsGPTWidget = ({ apiHost = 'https://gptcloud.arc53.com', selectDocs = 'default', apiKey = 'docsgpt-public' }) => { +export const DocsGPTWidget = ({ + apiHost = 'https://gptcloud.arc53.com', + selectDocs = 'default', + apiKey = 'docsgpt-public', + avatar = 'https://d3dg1063dc54p9.cloudfront.net/cute-docsgpt.png', + title = 'Get AI assistance', + description = 'DocsGPT\'s AI Chatbot is here to help', + heroTitle = 'Welcome to DocsGPT !', + heroDescription='This chatbot is built with DocsGPT and utilises GenAI, please review important information using sources.' +}) => { const [prompt, setPrompt] = useState(''); const [status, setStatus] = useState('idle'); @@ -319,12 +331,14 @@ export const DocsGPTWidget = ({ apiHost = 'https://gptcloud.arc53.com', selectDo setPrompt('') await stream(prompt) } - + const handleImageError = (event: React.SyntheticEvent) => { + event.currentTarget.src = "https://d3dg1063dc54p9.cloudfront.net/cute-docsgpt.png"; + }; return ( <> setOpen(true)} hidden={open}> - + {open &&
@@ -333,12 +347,12 @@ export const DocsGPTWidget = ({ apiHost = 'https://gptcloud.arc53.com', selectDo
- - docs-gpt - + + docs-gpt + - Get AI assistance - DocsGPT's AI Chatbot is here to help + {title} + {description}
@@ -389,7 +403,7 @@ export const DocsGPTWidget = ({ apiHost = 'https://gptcloud.arc53.com', selectDo } ) }) - : + : }