diff --git a/Assets/DocsGPT tee-back.jpeg b/Assets/DocsGPT tee-back.jpeg new file mode 100644 index 00000000..b13fe53d Binary files /dev/null and b/Assets/DocsGPT tee-back.jpeg differ diff --git a/Assets/DocsGPT tee-front.jpeg b/Assets/DocsGPT tee-front.jpeg new file mode 100644 index 00000000..8a4b7374 Binary files /dev/null and b/Assets/DocsGPT tee-front.jpeg differ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 76e60f65..3407fdc9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,19 +19,25 @@ Thank you for choosing to contribute to DocsGPT! We are all very grateful! We value contributions in the form of discussions or suggestions. We recommend taking a look at existing issues and our [roadmap](https://github.com/orgs/arc53/projects/2). -If you're interested in contributing code, here are some important things to know: +Before creating issues, please check out how the latest version of our app looks and works by launching it via [Quickstart](https://github.com/arc53/DocsGPT#quickstart) the version on our live demo is slightly modified with login. Your issues should relate to the version that you can launch via [Quickstart](https://github.com/arc53/DocsGPT#quickstart). -We have a frontend built with React (Vite) and a backend in Python. +### πŸ‘¨β€πŸ’» If you're interested in contributing code, here are some important things to know: -### If you are looking to contribute to frontend (βš›οΈReact, Vite): +Tech Stack Overview: + +- 🌐 Frontend: Built with React (Vite) βš›οΈ, + +- πŸ–₯ Backend: Developed in Python 🐍 + +### 🌐 If you are looking to contribute to frontend (βš›οΈReact, Vite): - The current frontend is being migrated from [`/application`](https://github.com/arc53/DocsGPT/tree/main/application) to [`/frontend`](https://github.com/arc53/DocsGPT/tree/main/frontend) with a new design, so please contribute to the new one. - Check out this [milestone](https://github.com/arc53/DocsGPT/milestone/1) and its issues. -- The Figma design can be found [here](https://www.figma.com/file/OXLtrl1EAy885to6S69554/DocsGPT?node-id=0%3A1&t=hjWVuxRg9yi5YkJ9-1). +- The updated Figma design can be found [here](https://www.figma.com/file/OXLtrl1EAy885to6S69554/DocsGPT?node-id=0%3A1&t=hjWVuxRg9yi5YkJ9-1). Please try to follow the guidelines. -### If you are looking to contribute to Backend (🐍 Python): +### πŸ–₯ If you are looking to contribute to Backend (🐍 Python): - Review our issues and contribute to [`/application`](https://github.com/arc53/DocsGPT/tree/main/application) or [`/scripts`](https://github.com/arc53/DocsGPT/tree/main/scripts) (please disregard old [`ingest_rst.py`](https://github.com/arc53/DocsGPT/blob/main/scripts/old/ingest_rst.py) [`ingest_rst_sphinx.py`](https://github.com/arc53/DocsGPT/blob/main/scripts/old/ingest_rst_sphinx.py) files; they will be deprecated soon). - All new code should be covered with unit tests ([pytest](https://github.com/pytest-dev/pytest)). Please find tests under [`/tests`](https://github.com/arc53/DocsGPT/tree/main/tests) folder. @@ -44,11 +50,62 @@ To run unit tests from the root of the repository, execute: python -m pytest ``` -### Workflow πŸ“ˆ : -- Fork repository -- Make the required changes on your forked version -- Commit those changes and submit those as a pull request so that it reflects on thr main repository. +## Workflow πŸ“ˆ + +Here's a step-by-step guide on how to contribute to DocsGPT: + +1. **Fork the Repository:** + - Click the "Fork" button at the top-right of this repository to create your fork. + +2. **Create and Switch to a New Branch:** + - Create a new branch for your contribution using: + ```shell + git checkout -b your-branch-name + ``` + +3. **Make Changes:** + - Make the required changes in your branch. + +4. **Add Changes to the Staging Area:** + - Add your changes to the staging area using: + ```shell + git add . + ``` + +5. **Commit Your Changes:** + - Commit your changes with a descriptive commit message using: + ```shell + git commit -m "Your descriptive commit message" + ``` + +6. **Push Your Changes to the Remote Repository:** + - Push your branch with changes to your fork on GitHub using: + ```shell + git push origin your-branch-name + ``` + +7. **Submit a Pull Request (PR):** + - Create a Pull Request from your branch to the main repository. Make sure to include a detailed description of your changes and reference any related issues. + +8. **Collaborate:** + - Be responsive to comments and feedback on your PR. + - Make necessary updates as suggested. + - Once your PR is approved, it will be merged into the main repository. + +9. **Testing:** + - Before submitting a Pull Request, ensure your code passes all unit tests. + - To run unit tests from the root of the repository, execute: + ```shell + python -m pytest + ``` + +*Note: You should run the unit test only after making the changes to the backend code.* + +10. **Questions and Collaboration:** + - Feel free to join our Discord. We're very friendly and welcoming to new contributors, so don't hesitate to reach out. + +Thank you for considering contributing to DocsGPT! πŸ™ ## Questions/collaboration Feel free to join our [Discord](https://discord.gg/n5BX8dh8rU). We're very friendly and welcoming to new contributors, so don't hesitate to reach out. -# Thank you so much for considering contributing to DocsGPT!πŸ™ +# Thank you so much for considering to contribute DocsGPT!πŸ™ diff --git a/HACKTOBERFEST.md b/HACKTOBERFEST.md index b1646619..5b693fe9 100644 --- a/HACKTOBERFEST.md +++ b/HACKTOBERFEST.md @@ -32,4 +32,10 @@ Once you have created your PR and our maintainers have merged it, please fill in Feel free to join our Discord server. We're here to help newcomers, so don't hesitate to jump in! [Join us here](https://discord.gg/n5BX8dh8rU). -Thank you very much for considering contributing to DocsGPT during Hacktoberfest! πŸ™ Your contributions could earn you a stylish new t-shirt as a token of our appreciation. 🎁 Join us, and let's code together! πŸš€ +Thank you very much for considering contributing to DocsGPT during Hacktoberfest! πŸ™ Your contributions (not just simple typo) could earn you a stylish new t-shirt as a token of our appreciation. 🎁 Join us, and let's code together! πŸš€ + +Here is a preview of the shirts: +

+ + +

diff --git a/README.md b/README.md index db561862..c24a7483 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Say goodbye to time-consuming manual searches, and let :7091` This will allow the frontend to connect to the backend. -#### Running the app +#### Running the Application You're almost there! Now that all the necessary bits and pieces have been installed, it is time to run the application. To do so, use the following command: @@ -95,18 +88,17 @@ You're almost there! Now that all the necessary bits and pieces have been instal Launching it for the first time will take a few minutes to download all the necessary dependencies and build. -Once this is done, you can go ahead and close the terminal window. +Once this is done you can go ahead and close the terminal window. -#### Enabling ports +#### Enabling Ports -Before you are able to access your live instance, you must first enable the port that it is using. +a. Before you are able to access your live instance, you must first enable the port that it is using. -Open your Lightsail instance and head to "Networking". +b. Open your Lightsail instance and head to "Networking". -Then click on "Add rule" under "IPv4 Firewall", enter `5173` as your port, and hit "Create". +c. Then click on "Add rule" under "IPv4 Firewall", enter `5173` as your port, and hit "Create". Repeat the process for port `7091`. #### Access your instance -Your instance will now be available under your Public IP Address and port `5173`. Enjoy! - +Your instance is now available at your Public IP Address on port 5173. Enjoy using DocsGPT! diff --git a/docs/pages/Deploying/Quickstart.md b/docs/pages/Deploying/Quickstart.md index 5ed37a5b..411e3234 100644 --- a/docs/pages/Deploying/Quickstart.md +++ b/docs/pages/Deploying/Quickstart.md @@ -1,24 +1,107 @@ ## Launching Web App -Note: Make sure you have Docker installed +**Note**: Make sure you have Docker installed -On macOS or Linux, just write: +**On macOS or Linux:** +Just run the following command:: `./setup.sh` -It will install all the dependencies and give you an option to download the local model or use OpenAI +This command will install all the necessary dependencies and provide you with an option to download the local model or use OpenAI. -Otherwise, refer to this Guide: +If you prefer to follow manual steps, refer to this guide: -1. Open and download this repository with `git clone https://github.com/arc53/DocsGPT.git`. +1. Open and download this repository with +`git clone https://github.com/arc53/DocsGPT.git`. 2. Create a `.env` file in your root directory and set your `API_KEY` with your [OpenAI API key](https://platform.openai.com/account/api-keys). -3. Run `docker-compose build && docker-compose up`. +3. Run the following commands: +`docker-compose build && docker-compose up`. 4. Navigate to `http://localhost:5173/`. -To stop, just run `Ctrl + C`. +To stop, simply press Ctrl + C. + +**For WINDOWS:** + +To run the setup on Windows, you have two options: using the Windows Subsystem for Linux (WSL) or using Git Bash or Command Prompt. + +**Option 1: Using Windows Subsystem for Linux (WSL):** + +1. Install WSL if you haven't already. You can follow the official Microsoft documentation for installation: (https://learn.microsoft.com/en-us/windows/wsl/install). +2. After setting up WSL, open the WSL terminal. +3. Clone the repository and create the `.env` file: + ``` + git clone https://github.com/arc53/DocsGPT.git + cd DocsGPT + echo "API_KEY=Yourkey" > .env + echo "VITE_API_STREAMING=true" >> .env + ``` +4. Run the following command to start the setup with Docker Compose: + `./run-with-docker-compose.sh` +5. Open your web browser and navigate to (http://localhost:5173/). +6. To stop the setup, just press `Ctrl + C` in the WSL terminal + +**Option 2: Using Git Bash or Command Prompt (CMD):** + +1. Install Git for Windows if you haven't already. Download it from the official website: (https://gitforwindows.org/). +2. Open Git Bash or Command Prompt. +3. Clone the repository and create the `.env` file: + ``` + git clone https://github.com/arc53/DocsGPT.git + cd DocsGPT + echo "API_KEY=Yourkey" > .env + echo "VITE_API_STREAMING=true" >> .env + ``` +4.Run the following command to start the setup with Docker Compose: + `./run-with-docker-compose.sh` +5.Open your web browser and navigate to (http://localhost:5173/). +6.To stop the setup, just press Ctrl + C in the Git Bash or Command Prompt terminal. + +These steps should help you set up and run the project on Windows using either WSL or Git Bash/Command Prompt. +**Important:** Ensure that Docker is installed and properly configured on your Windows system for these steps to work. + + +For WINDOWS: + +To run the given setup on Windows, you can use the Windows Subsystem for Linux (WSL) or a Git Bash terminal to execute similar commands. Here are the steps adapted for Windows: + +Option 1: Using Windows Subsystem for Linux (WSL): + +1. Install WSL if you haven't already. You can follow the official Microsoft documentation for installation: (https://learn.microsoft.com/en-us/windows/wsl/install). +2. After setting up WSL, open the WSL terminal. +3. Clone the repository and create the `.env` file: + ``` + git clone https://github.com/arc53/DocsGPT.git + cd DocsGPT + echo "API_KEY=Yourkey" > .env + echo "VITE_API_STREAMING=true" >> .env + ``` +4. Run the following command to start the setup with Docker Compose: + `./run-with-docker-compose.sh` +5. Open your web browser and navigate to (http://localhost:5173/). +6. To stop the setup, just press `Ctrl + C` in the WSL terminal + +Option 2: Using Git Bash or Command Prompt (CMD): + +1. Install Git for Windows if you haven't already. You can download it from the official website: (https://gitforwindows.org/). +2. Open Git Bash or Command Prompt. +3. Clone the repository and create the `.env` file: + ``` + git clone https://github.com/arc53/DocsGPT.git + cd DocsGPT + echo "API_KEY=Yourkey" > .env + echo "VITE_API_STREAMING=true" >> .env + ``` +4.Run the following command to start the setup with Docker Compose: + `./run-with-docker-compose.sh` +5.Open your web browser and navigate to (http://localhost:5173/). +6.To stop the setup, just press Ctrl + C in the Git Bash or Command Prompt terminal. + +These steps should help you set up and run the project on Windows using either WSL or Git Bash/Command Prompt. Make sure you have Docker installed and properly configured on your Windows system for this to work. + ### Chrome Extension -To install the Chrome extension: +#### Installing the Chrome extension: +To enhance your DocsGPT experience, you can install the DocsGPT Chrome extension. Here's how: 1. In the DocsGPT GitHub repository, click on the "Code" button and select "Download ZIP". 2. Unzip the downloaded file to a location you can easily access. diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 099a9426..2d832845 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -104,7 +104,9 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f Responses: There are two types of responses: -1. While task is still running, where "current" will show progress from 0 to 100: + +1. While the task is still running, the 'current' value will show progress from 0 to 100. + ```json { "result": { @@ -133,7 +135,8 @@ There are two types of responses: ``` ### /api/delete_old -Deletes old Vector stores: +Deletes old Vector Stores: + ```js // Task status (GET http://127.0.0.1:5000/api/docs_check) fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4fe2e7454d1", { @@ -144,7 +147,6 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f }) .then((res) => res.text()) .then(console.log.bind(console)) -``` Response: diff --git a/docs/pages/Extensions/Chatwoot-extension.md b/docs/pages/Extensions/Chatwoot-extension.md index e95891a4..ab0b8d7e 100644 --- a/docs/pages/Extensions/Chatwoot-extension.md +++ b/docs/pages/Extensions/Chatwoot-extension.md @@ -17,9 +17,9 @@ If you want for bot to stop responding to questions for a specific user or sessi ### Optional (extra validation) -In `app.py` uncomment lines 12-13 and 71-75 +1. In `app.py` uncomment lines 12-13 and 71-75 -in your `.env` file add: +2. in your `.env` file add: ``` account_id=(optional) 1 diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index e236b8a3..be308eab 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -165,11 +165,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { */ useEffect(() => { - if (isMobile) { - setNavOpen(false); - return; - } - setNavOpen(true); + setNavOpen(!isMobile); }, [isMobile]); return ( @@ -194,7 +190,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { ref={navRef} className={`${ !navOpen && '-ml-96 md:-ml-[18rem]' - } duration-20 fixed z-20 flex h-full w-72 flex-col border-r-2 bg-gray-50 transition-all`} + } duration-20 fixed top-0 z-20 flex h-full w-72 flex-col border-r-2 bg-gray-50 transition-all`} >
); } diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 87a5ebb7..503c4d56 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -39,11 +39,7 @@ export default function Conversation() { useEffect(() => { const observerCallback: IntersectionObserverCallback = (entries) => { entries.forEach((entry) => { - if (entry.isIntersecting) { - setHasScrolledToLast(true); - } else { - setHasScrolledToLast(false); - } + setHasScrolledToLast(entry.isIntersecting); }); }; @@ -121,7 +117,7 @@ export default function Conversation() { return (
- {queries.length > 0 && !hasScrolledToLast ? ( + {queries.length > 0 && !hasScrolledToLast && ( - ) : null} + )} {queries.length > 0 && (
diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index aba7c63b..ad7db7a7 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -74,7 +74,7 @@ const ConversationBubble = forwardRef<
-
+
Sources:
diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index 592c52b2..1b5dc42c 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -68,7 +68,7 @@ export default function ConversationTile({ onClick={() => { selectConversation(conversation.id); }} - className={`my-auto mx-4 mt-4 flex h-12 cursor-pointer items-center justify-between gap-4 rounded-3xl hover:bg-gray-100 ${ + className={`my-auto mx-4 mt-4 flex h-9 cursor-pointer items-center justify-between gap-4 rounded-3xl hover:bg-gray-100 ${ conversationId === conversation.id ? 'bg-gray-100' : '' }`} > @@ -77,7 +77,7 @@ export default function ConversationTile({ conversationId === conversation.id ? 'w-[75%]' : 'w-[95%]' } gap-4`} > - + {isEdit ? ( )}
- {conversationId === conversation.id ? ( + {conversationId === conversation.id && (
- ) : null} + )}
); } diff --git a/frontend/src/upload/Upload.tsx b/frontend/src/upload/Upload.tsx index 755a9ad4..0c37f48d 100644 --- a/frontend/src/upload/Upload.tsx +++ b/frontend/src/upload/Upload.tsx @@ -55,9 +55,8 @@ export default function Upload({ setProgress(undefined); setModalState('INACTIVE'); }} - className={`rounded-3xl bg-purple-30 px-4 py-2 text-sm font-medium text-white ${ - isCancellable ? '' : 'hidden' - }`} + className={`rounded-3xl bg-purple-30 px-4 py-2 text-sm font-medium text-white ${isCancellable ? '' : 'hidden' + }`} > Finish @@ -206,7 +205,9 @@ export default function Upload({
@@ -227,9 +228,8 @@ export default function Upload({ return (
{view} diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 7d48373f..5ead1d07 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -47,7 +47,7 @@ javalang==0.13.0 Jinja2==3.1.2 jmespath==1.0.1 joblib==1.3.1 -langchain==0.0.308 +langchain==0.0.312 lxml==4.9.3 manifest-ml==0.1.8 MarkupSafe==2.1.3 diff --git a/tests/test_vector_store.py b/tests/test_vector_store.py new file mode 100644 index 00000000..297a225c --- /dev/null +++ b/tests/test_vector_store.py @@ -0,0 +1,19 @@ +""" +Tests regarding the vector store class, including checking +compatibility between different transformers and local vector +stores (index.faiss) +""" +import pytest +from application.vectorstore.faiss import FaissStore +from application.core.settings import settings + +def test_init_local_faiss_store_huggingface(): + """ + Test that asserts that trying to initialize a FaissStore with + the huggingface sentence transformer below together with the + index.faiss file in the application/ folder results in a + dimension mismatch error. + """ + settings.EMBEDDINGS_NAME = "huggingface_sentence-transformers/all-mpnet-base-v2" + with pytest.raises(ValueError): + FaissStore("application/", "", None)