Giter Club home page Giter Club logo

chatgpt-langchain-qna-on-your-docs's Introduction

Find me here

KeyStrokes KeyStrokes

Support me:

KeyStrokes KeyStrokes KeyStrokes

Chat App with ChatGPT API Integration

Personalize ChatGPT using LangChain, and get answers from your own documents and knowledge base.

Video Link

KeyStrokes

Preview

Running the app

Use the subsections below to:

  1. Setup the backend, and start the server
  2. Setup the frontend, and start the server

Note: Both the backend and frontend servers need to be running together, otherwise it will not work.

Backend

Uses ExpressJS.

Setup

  1. Update OPEN_AI_API_KEY in ./backend/env/development.env with your Open AI API Key.
  2. Run the following commands to setup the backend
cd backend
npm install

Start the server

Run the following command to start the server

npm run dev

Frontend

Uses NextJS and ReactJS.

Setup

Run the following commands to setup the frontend

cd frontend
npm install

Start the NextJS server

Run the following command to start the NextJS server

npm run dev

Access the Chat page at http://localhost:3001/

Note

Please note, this is for demonstration purposes only. Do not deploy this to production without making certain changes.

If you really want to deploy this to production, then you may following these steps:

  • Add various protection to the APIs, like authentication, authorization throttling etc
  • Do not store index files on the file system. Use a database, and add restrictions on the file types, size, etc, and make sure that user's don't use this as an attack vector to overload your server.

There are many other best practices that need to be implemented. But the above two summarize the most important ones. If someone really deploys this to production, then please send a pull request with a more comprehensive list.

chatgpt-langchain-qna-on-your-docs's People

Contributors

doingthisalright avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chatgpt-langchain-qna-on-your-docs's Issues

crashing with missing files

Hi there,
i have just found your repository on my way to learn how to make chatbots. trying to run your app, i run into this error:


[2023-08-03T10:10:21.325Z] INFO: Express server started on port: 3000
[Error: ENOENT: no such file or directory, open '/home/user/git/chatbot/backend/src/documents/Ethereum Whitepaper/index/data/args.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/user/git/chatbot/backend/src/documents/Ethereum Whitepaper/index/data/args.json'
}
[nodemon] app crashed - waiting for file changes before starting...

any idea what is goin on here?

thanks a lot!

Cannot Install Modules

While
npm i

This happens

npm ERR! code 1
npm ERR! path
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.3 found at "C:\Users\MehebubMukut\AppData\Local\Programs\Python\Python311\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS checking VS2022 (17.5.33627.172) found at:
npm ERR! gyp ERR! find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - missing any VC++ toolset
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:369:14)
npm ERR! gyp ERR! stack at C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:390:16
npm ERR! gyp ERR! stack at C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:427:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\MehebubMukut\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\Node\LangChainNew\YouTube101\backend\node_modules\hnswlib-node
npm ERR! gyp ERR! node -v v18.13.0
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\MehebubMukut\AppData\Local\npm-cache_logs\2023-05-04T17_17_26_221Z-debug-0.log

image

Using Markdown in Conversation

Hi,
I'm trying to use Markdown in the Conversation.tsx
So, I added these import:

import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

And I changed the div for the AI answers this way:

<div className={styles.messageAvatarContainer}>
                  {message.role === "AI" && "๐Ÿค–"}
                </div>
                <div style={{ textAlign: message.role === "AI" ? 'start' : 'end' }}>
                    <ReactMarkdown remarkPlugins={[remarkGfm]} children={unskipNewlines(message.content)} />
                </div>

It seems to be partially fine: bold is correctly rendered. But the lists (bullet or number) just do not display correctly.
It seems to be due to the fact that JSON skip the newlines, so I added a function:

function unskipNewlines(text: string): string {
    return text.replace(/\\n/g, '\n');
  }

Still that doesn't render correctly... any suggestion?

Regards,
Calo

how to publish this ?

I am trying to deploy this on the web instead of localhost but I tried Vercel and Netfly they keep running in the deployment stage without going further. what should be done to publish this?

getting a error when I run ingest in postman

I get this error when I run the code and go to postman and Ingest
throw new Error("Please install hnswlib-node as a dependency with, e.g. npm install -S hnswlib-node"); ^ Error: Please install hnswlib-node as a dependency with, e.g. npm install -S hnswlib-node``

I tried installing with command npm install -S hnswlib-node but still I get this error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.