fix: empty types.d.ts generated during build + updated README.md

This commit is contained in:
Siddhant Rai 2024-06-01 14:10:12 +05:30
parent d8720d0849
commit f2c328d212
5 changed files with 2056 additions and 4383 deletions

View File

@ -1,6 +1,5 @@
# DocsGPT react widget
This widget will allow you to embed a DocsGPT assistant in your React app.
## Installation
@ -46,36 +45,44 @@ To link the widget to your api and your documents you can pass parameters to the
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DocsGPT Widget</title>
</head>
<body>
<div id="widget-container"></div>
<div id="app"></div>
<!-- Include the widget script -->
<script src="path/to/your/dist/main.js" type="module"></script>
<script src="./node_modules/docsgpt/dist/main.js" type="module"></script>
<script type="module">
window.onload = function() {
renderDocsGPTWidget('widget-container');
renderDocsGPTWidget('app');
}
</script>
</body>
</html>
```
##### Serve the HTML using Parcel: `parcel my-widget.html -p 3000`
To link the widget to your api and your documents you can pass parameters to the **renderDocsGPTWidget('div id', { parameters })**.
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DocsGPT Widget</title>
</head>
<body>
<div id="widget-container"></div>
<div id="app"></div>
<!-- Include the widget script -->
<script src="path/to/your/dist/main.js" type="module"></script>
<script src="./node_modules/docsgpt/dist/main.js" type="module"></script>
<script type="module">
window.onload = function() {
renderDocsGPTWidget('widget-container', , {
renderDocsGPTWidget('app', , {
apiHost: 'http://localhost:7001',
selectDocs: 'default',
apiKey: '',
@ -91,10 +98,8 @@ To link the widget to your api and your documents you can pass parameters to the
</html>
```
## Our github
[DocsGPT](https://github.com/arc53/DocsGPT)
You can find the source code in the extensions/react-widget folder.

File diff suppressed because it is too large Load Diff

View File

@ -33,8 +33,6 @@
"@parcel/transformer-typescript-tsc": "^2.12.0",
"@parcel/validator-typescript": "^2.12.0",
"@radix-ui/react-icons": "^1.3.0",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"dompurify": "^3.0.9",
@ -53,6 +51,8 @@
"@parcel/packager-ts": "^2.12.0",
"@parcel/transformer-typescript-types": "^2.12.0",
"@types/dompurify": "^3.0.5",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"babel-loader": "^8.0.4",
"parcel": "^2.12.0",
"process": "^0.11.10",

View File

@ -2,7 +2,7 @@
import { Fragment, useEffect, useRef, useState } from 'react'
import { PaperPlaneIcon, RocketIcon, ExclamationTriangleIcon, Cross2Icon } from '@radix-ui/react-icons';
import { MESSAGE_TYPE, Query, Status } from '../types/index';
import MessageIcon from '../assets/message.svg'
import MessageIcon from '../assets/message.svg';
import { fetchAnswerStreaming } from '../requests/streamingApi';
import styled, { keyframes, createGlobalStyle } from 'styled-components';
import snarkdown from '@bpmn-io/snarkdown';

View File

@ -8,3 +8,4 @@ const renderWidget = (elementId: string, props = {}) => {
};
(window as any).renderDocsGPTWidget = renderWidget;
export { DocsGPTWidget };