-
setOpen(true)}
- className={`${open ? 'hidden' : ''} cursor-pointer`}>
-
-
-
-
-
+
+ setOpen(true)} hidden={open}>
+
+
+ {open &&
-
{
- event.stopPropagation();
- setOpen(false);
- }}
- />
-
-
-
-
-
Get AI assistance
-
DocsGPT's AI Chatbot is here to help
-
-
-
+
setOpen(false)}>
+
+
+
+
+
+
+
+
+ Get AI assistance
+ DocsGPT's AI Chatbot is here to help
+
+
-
- {open && (
-
-
- {
- queries.length > 0 ? queries?.map((query, index) => {
- return (
-
- {
- query.prompt &&
- }
- {
- query.response ?
- :
- {
- query.error ?
-
- Network Error
-
- Something went wrong !
-
-
- :
- }
-
- }
- )
- })
- :
-
-
- Welcome to DocsGPT !
-
- This is a chatbot that uses the GPT-3, Faiss and LangChain to answer questions.
-
-
-
- }
-
-
-
- )}
+
+
+ {
+ queries.length > 0 ? queries?.map((query, index) => {
+ return (
+
+ {
+ query.prompt &&
+
+ {query.prompt}
+
+
+ }
+ {
+ query.response ?
+
+ {query.response}
+
+
+ :
+ {
+ query.error ?
+
+
+
+
+
Network Error
+ Something went wrong !
+
+
+ :
+
+ .
+ .
+ .
+
+
+ }
+
+ }
+ )
+ })
+ :
+ }
+
+
+ setPrompt(event.target.value)}
+ type='text' placeholder="What do you want to do?" />
+
+
+
+
+
-
-
+ }
+
>
)
-}
+}
\ No newline at end of file
diff --git a/extensions/react-widget/src/components/Response.tsx b/extensions/react-widget/src/components/Response.tsx
deleted file mode 100644
index b281453c..00000000
--- a/extensions/react-widget/src/components/Response.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs/styles/prism';
-import remarkGfm from 'remark-gfm';
-import ReactMarkdown from 'react-markdown'
-import SyntaxHighlighter from 'react-syntax-highlighter/dist/esm/light-async';
-interface typeProps {
- message: string
-}
-const classes = {
- list: {
- p: {
- display: 'inline'
- },
- li: {
- ':not(:first-child)': {
- marginTop: '1em'
- },
- '> .list': {
- marginTop: '1em'
- }
- }
- }
-};
-const Response = (props: typeProps) => {
- return (
-
- {String(children).replace(/\n$/, '')}
-
- ) : (
-
- {children}
-
- );
- },
- ul({ children }) {
- return (
-
- );
- },
- ol({ children }) {
- return (
-
- {children}
-
- );
- },
- table({ children }) {
- return (
-
- );
- },
- thead({ children }) {
- return (
-
- {children}
-
- );
- },
- tr({ children }) {
- return (
-
- {children}
-
- );
- },
- td({ children }) {
- return {children} | ;
- },
- th({ children }) {
- return {children} | ;
- },
- }}
- >
- {props.message}
-
-
- )
-}
-export default Response
\ No newline at end of file
diff --git a/extensions/react-widget/src/components/ui/alert.tsx b/extensions/react-widget/src/components/ui/alert.tsx
deleted file mode 100644
index 5afd41d1..00000000
--- a/extensions/react-widget/src/components/ui/alert.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import * as React from "react"
-import { cva, type VariantProps } from "class-variance-authority"
-
-import { cn } from "@/lib/utils"
-
-const alertVariants = cva(
- "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
- {
- variants: {
- variant: {
- default: "bg-background text-foreground",
- destructive:
- "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- }
-)
-
-const Alert = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes
& VariantProps
->(({ className, variant, ...props }, ref) => (
-
-))
-Alert.displayName = "Alert"
-
-const AlertTitle = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
-AlertTitle.displayName = "AlertTitle"
-
-const AlertDescription = React.forwardRef<
- HTMLParagraphElement,
- React.HTMLAttributes
->(({ className, ...props }, ref) => (
-
-))
-AlertDescription.displayName = "AlertDescription"
-
-export { Alert, AlertTitle, AlertDescription }
diff --git a/extensions/react-widget/src/components/ui/button.tsx b/extensions/react-widget/src/components/ui/button.tsx
deleted file mode 100644
index 0270f644..00000000
--- a/extensions/react-widget/src/components/ui/button.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-import * as React from "react"
-import { Slot } from "@radix-ui/react-slot"
-import { cva, type VariantProps } from "class-variance-authority"
-
-import { cn } from "@/lib/utils"
-
-const buttonVariants = cva(
- "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
- {
- variants: {
- variant: {
- default:
- "bg-primary text-primary-foreground shadow hover:bg-primary/90",
- destructive:
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
- outline:
- "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
- secondary:
- "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
- ghost: "hover:bg-accent hover:text-accent-foreground",
- link: "text-primary underline-offset-4 hover:underline",
- },
- size: {
- default: "h-9 px-4 py-2",
- sm: "h-8 rounded-md px-3 text-xs",
- lg: "h-10 rounded-md px-8",
- icon: "h-9 w-9",
- },
- },
- defaultVariants: {
- variant: "default",
- size: "default",
- },
- }
-)
-
-export interface ButtonProps
- extends React.ButtonHTMLAttributes,
- VariantProps {
- asChild?: boolean
-}
-
-const Button = React.forwardRef(
- ({ className, variant, size, asChild = false, ...props }, ref) => {
- const Comp = asChild ? Slot : "button"
- return (
-
- )
- }
-)
-Button.displayName = "Button"
-
-export { Button, buttonVariants }
diff --git a/extensions/react-widget/src/components/ui/input.tsx b/extensions/react-widget/src/components/ui/input.tsx
deleted file mode 100644
index a92b8e0e..00000000
--- a/extensions/react-widget/src/components/ui/input.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as React from "react"
-
-import { cn } from "@/lib/utils"
-
-export interface InputProps
- extends React.InputHTMLAttributes {}
-
-const Input = React.forwardRef(
- ({ className, type, ...props }, ref) => {
- return (
-
- )
- }
-)
-Input.displayName = "Input"
-
-export { Input }
diff --git a/extensions/react-widget/src/components/ui/scroll-area.tsx b/extensions/react-widget/src/components/ui/scroll-area.tsx
deleted file mode 100644
index 0b4a48d8..00000000
--- a/extensions/react-widget/src/components/ui/scroll-area.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-"use client"
-
-import * as React from "react"
-import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
-
-import { cn } from "@/lib/utils"
-
-const ScrollArea = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, children, ...props }, ref) => (
-
-
- {children}
-
-
-
-
-))
-ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
-
-const ScrollBar = React.forwardRef<
- React.ElementRef,
- React.ComponentPropsWithoutRef
->(({ className, orientation = "vertical", ...props }, ref) => (
-
-
-
-))
-ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
-
-export { ScrollArea, ScrollBar }
diff --git a/extensions/react-widget/src/components/ui/textarea.tsx b/extensions/react-widget/src/components/ui/textarea.tsx
deleted file mode 100644
index d1258e47..00000000
--- a/extensions/react-widget/src/components/ui/textarea.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import * as React from "react"
-
-import { cn } from "@/lib/utils"
-
-export interface TextareaProps
- extends React.TextareaHTMLAttributes {}
-
-const Textarea = React.forwardRef(
- ({ className, ...props }, ref) => {
- return (
-
- )
- }
-)
-Textarea.displayName = "Textarea"
-
-export { Textarea }
diff --git a/extensions/react-widget/src/index.css b/extensions/react-widget/src/index.css
deleted file mode 100644
index 094fa073..00000000
--- a/extensions/react-widget/src/index.css
+++ /dev/null
@@ -1,119 +0,0 @@
-@tailwind base;
-@tailwind components;
-@tailwind utilities;
-
-#docsgpt-answer {
- max-height: 50vh; /* 50% of the viewport height */
- overflow-y: auto; /* Adds a vertical scrollbar if the content exceeds the container height */
-}
-
-.widget-container {
-position: fixed; /* fixed positioning */
-right: 10px; /* from the right edge */
-bottom: 10px; /* from the bottom edge */
-z-index: 1000; /* to ensure it appears on top of other content, if any */
-display: flex;
-flex-direction: column;
-align-items: center;
-width: 355px;
-height: 405px;
-}
-
-@keyframes dotBounce {
- 0%, 80%, 100% {
- transform: translateY(0);
- }
- 40% {
- transform: translateY(-5px);
- }
-}
-
-.dot-animation {
- display: inline-block;
- animation: dotBounce 1s infinite ease-in-out;
-}
-
-.delay-200 {
- animation-delay: 200ms;
-}
-
-.delay-400 {
- animation-delay: 400ms;
-}
-
-.white-filter {
- filter: invert(1) brightness(2);
-}
-
-@layer base {
- :root {
- --background: 0 0% 100%;
- --foreground: 0 0% 3.9%;
-
- --card: 0 0% 100%;
- --card-foreground: 0 0% 3.9%;
-
- --popover: 0 0% 100%;
- --popover-foreground: 0 0% 3.9%;
-
- --primary: 0 0% 9%;
- --primary-foreground: 0 0% 98%;
-
- --secondary: 0 0% 96.1%;
- --secondary-foreground: 0 0% 9%;
-
- --muted: 0 0% 96.1%;
- --muted-foreground: 0 0% 45.1%;
-
- --accent: 0 0% 96.1%;
- --accent-foreground: 0 0% 9%;
-
- --destructive: 0 84.2% 60.2%;
- --destructive-foreground: 0 0% 98%;
-
- --border: 0 0% 89.8%;
- --input: 0 0% 89.8%;
- --ring: 0 0% 3.9%;
-
- --radius: 0.5rem;
- }
-
- .dark {
- --background: 0 0% 3.9%;
- --foreground: 0 0% 98%;
-
- --card: 0 0% 3.9%;
- --card-foreground: 0 0% 98%;
-
- --popover: 0 0% 3.9%;
- --popover-foreground: 0 0% 98%;
-
- --primary: 0 0% 98%;
- --primary-foreground: 0 0% 9%;
-
- --secondary: 0 0% 14.9%;
- --secondary-foreground: 0 0% 98%;
-
- --muted: 0 0% 14.9%;
- --muted-foreground: 0 0% 63.9%;
-
- --accent: 0 0% 14.9%;
- --accent-foreground: 0 0% 98%;
-
- --destructive: 0 62.8% 30.6%;
- --destructive-foreground: 0 0% 98%;
-
- --border: 0 0% 14.9%;
- --input: 0 0% 14.9%;
- --ring: 0 0% 83.1%;
- }
-}
-
-@layer base {
- * {
- @apply border-border;
- }
- body {
- @apply bg-background text-foreground;
- }
-}
\ No newline at end of file
diff --git a/extensions/react-widget/src/index.html b/extensions/react-widget/src/index.html
new file mode 100644
index 00000000..9928934f
--- /dev/null
+++ b/extensions/react-widget/src/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ React (Parcel + TypeScript)
+
+
+
+
+
+
diff --git a/extensions/react-widget/src/index.ts b/extensions/react-widget/src/index.ts
index 69e041f8..1efa89a6 100644
--- a/extensions/react-widget/src/index.ts
+++ b/extensions/react-widget/src/index.ts
@@ -1 +1 @@
-export { DocsGPTWidget } from "./components/DocsGPTWidget";
+export { DocsGPTWidget } from "./components/DocsGPTWidget";
\ No newline at end of file
diff --git a/extensions/react-widget/src/main.tsx b/extensions/react-widget/src/main.tsx
index 3d7150da..19fb0ab9 100644
--- a/extensions/react-widget/src/main.tsx
+++ b/extensions/react-widget/src/main.tsx
@@ -1,10 +1,6 @@
-import React from 'react'
-import ReactDOM from 'react-dom/client'
-import App from './App.tsx'
-import './index.css'
+import { createRoot } from 'react-dom/client';
+import App from './App.tsx';
+import React from 'react';
+const root = createRoot(document.getElementById('app') as HTMLElement);
-ReactDOM.createRoot(document.getElementById('root')!).render(
-
-
- ,
-)
+root.render();
diff --git a/extensions/react-widget/src/vite-env.d.ts b/extensions/react-widget/src/vite-env.d.ts
deleted file mode 100644
index 11f02fe2..00000000
--- a/extensions/react-widget/src/vite-env.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/extensions/react-widget/tailwind.config.js b/extensions/react-widget/tailwind.config.js
deleted file mode 100644
index 92c034c7..00000000
--- a/extensions/react-widget/tailwind.config.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/** @type {import('tailwindcss').Config} */
-module.exports = {
- darkMode: ["class"],
- content: [
- './pages/**/*.{ts,tsx}',
- './components/**/*.{ts,tsx}',
- './app/**/*.{ts,tsx}',
- './src/**/*.{ts,tsx}',
- ],
- prefix: "",
- theme: {
- container: {
- center: true,
- padding: "2rem",
- screens: {
- "2xl": "1400px",
- },
- },
- extend: {
- colors: {
- border: "hsl(var(--border))",
- input: "hsl(var(--input))",
- ring: "hsl(var(--ring))",
- background: "hsl(var(--background))",
- foreground: "hsl(var(--foreground))",
- primary: {
- DEFAULT: "hsl(var(--primary))",
- foreground: "hsl(var(--primary-foreground))",
- },
- secondary: {
- DEFAULT: "hsl(var(--secondary))",
- foreground: "hsl(var(--secondary-foreground))",
- },
- destructive: {
- DEFAULT: "hsl(var(--destructive))",
- foreground: "hsl(var(--destructive-foreground))",
- },
- muted: {
- DEFAULT: "hsl(var(--muted))",
- foreground: "hsl(var(--muted-foreground))",
- },
- accent: {
- DEFAULT: "hsl(var(--accent))",
- foreground: "hsl(var(--accent-foreground))",
- },
- popover: {
- DEFAULT: "hsl(var(--popover))",
- foreground: "hsl(var(--popover-foreground))",
- },
- card: {
- DEFAULT: "hsl(var(--card))",
- foreground: "hsl(var(--card-foreground))",
- },
- },
- borderRadius: {
- lg: "var(--radius)",
- md: "calc(var(--radius) - 2px)",
- sm: "calc(var(--radius) - 4px)",
- },
- keyframes: {
- "accordion-down": {
- from: { height: "0" },
- to: { height: "var(--radix-accordion-content-height)" },
- },
- "accordion-up": {
- from: { height: "var(--radix-accordion-content-height)" },
- to: { height: "0" },
- },
- },
- animation: {
- "accordion-down": "accordion-down 0.2s ease-out",
- "accordion-up": "accordion-up 0.2s ease-out",
- },
- fontFamily: {
- sans: [
- '"Segoe UI"',
- 'Roboto',
- 'sans-serif',
- ],
- }
- },
- },
- plugins: [require("tailwindcss-animate")],
-}
\ No newline at end of file
diff --git a/extensions/react-widget/tsconfig.json b/extensions/react-widget/tsconfig.json
index b3b13fdb..e73dd80f 100644
--- a/extensions/react-widget/tsconfig.json
+++ b/extensions/react-widget/tsconfig.json
@@ -1,35 +1,34 @@
{
- "compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "@/*": ["./src/*"]
- },
- "target": "ES2020",
- "useDefineForClassFields": true,
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
- "module": "ESNext",
- "skipLibCheck": true,
-
- /* Bundler mode */
- "moduleResolution": "bundler",
- "allowImportingTsExtensions": true,
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "jsx": "react-jsx",
-
- /* Linting */
- "strict": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "noFallthroughCasesInSwitch": true,
- /* The "typeRoots" configuration specifies the locations where
- TypeScript looks for type definitions (.d.ts files) to
- include in the compilation process.*/
- "typeRoots": ["./dist/index.d.ts", "node_modules/@types"]
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*", "@/*"]
},
- /* include /index.ts*/
- "include": ["src", "./index.ts"],
- "exclude": ["node_modules","dist"],
- "references": [{ "path": "./tsconfig.node.json" }]
-}
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react-jsx",
+
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": false,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true,
+ /* The "typeRoots" configuration specifies the locations where
+ TypeScript looks for type definitions (.d.ts files) to
+ include in the compilation process.*/
+ "typeRoots": ["./dist/index.d.ts", "node_modules/@types"]
+ },
+ /* include /index.ts*/
+ "include": ["src/index.ts","custom.d.ts"],
+ "exclude": ["node_modules"],
+ }
\ No newline at end of file
diff --git a/extensions/react-widget/tsconfig.node.json b/extensions/react-widget/tsconfig.node.json
deleted file mode 100644
index 97ede7ee..00000000
--- a/extensions/react-widget/tsconfig.node.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "skipLibCheck": true,
- "module": "ESNext",
- "moduleResolution": "bundler",
- "allowSyntheticDefaultImports": true,
- "strict": true
- },
- "include": ["vite.config.ts"]
-}
diff --git a/extensions/react-widget/vite.config.ts b/extensions/react-widget/vite.config.ts
deleted file mode 100644
index c7699731..00000000
--- a/extensions/react-widget/vite.config.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import path from "path"
-import react from "@vitejs/plugin-react"
-import { defineConfig } from "vite"
-import dts from "vite-plugin-dts";
-import css from "rollup-plugin-import-css";
-
-
-export default defineConfig({
- build: {
- //Specifies that the output of the build will be a library.
- lib: {
- //Defines the entry point for the library build. It resolves
- //to src/index.ts,indicating that the library starts from this file.
- entry: path.resolve(__dirname, "src/index.ts"),
- name: "docsgpt-widget",
- //A function that generates the output file
- //name for different formats during the build
- fileName: (format) => `index.${format}.js`,
- },
- cssCodeSplit: false,
- rollupOptions: {
- external: ["react", "react-dom"],
- output: {
- globals: {
- react: "React",
- "react-dom": "ReactDOM",
- },
- },
- },
- //Generates sourcemaps for the built files,
- //aiding in debugging.
- sourcemap: 'inline',
- //Clears the output directory before building.
- emptyOutDir: true,
- },
- plugins: [react(), dts(),css({
- inject:true,
- include:['./src/index.css']
- })],
- resolve: {
- alias: {
- "@": path.resolve(__dirname, "./src"),
- },
- },
-})