From 4b1dad96cd4a7d90af5d85fc4aae0ac0dcc53343 Mon Sep 17 00:00:00 2001 From: Ayan Joshi Date: Sun, 8 Oct 2023 12:42:56 +0530 Subject: [PATCH 01/25] Commit --- application/prompts/custom_prompt.txt | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 application/prompts/custom_prompt.txt diff --git a/application/prompts/custom_prompt.txt b/application/prompts/custom_prompt.txt new file mode 100644 index 0000000..054da1e --- /dev/null +++ b/application/prompts/custom_prompt.txt @@ -0,0 +1,34 @@ +Welcome to the custom prompt file. You can use this file to create prompts for various tasks or experiments. Below are some examples of prompts you can use: + +1. *Summarization Task:* + + Prompt: Summarize the following article in 3-4 sentences. + Input: [Insert article here] + Output: Summarized article + +2. *Translation Task:* + + Prompt: Translate the English text into French. + Input: "Hello, how are you?" + Output: "Bonjour, comment รงa va ?" + +3. *Coding Task:* + + Prompt: Write a Python function that calculates the factorial of a given number. + Input: (Provide any specific number) + Output: (Gives factorial of the number) + +4. *Question-Answering Task:* + + Prompt: Answer the following question based on the given passage. + Input: [Insert passage here] + Question: [Insert question here] + Output: [Provided answer of the question] + +5. *Story Generation Task:* + + Prompt: Generate a short story about a detective solving a mystery. + Input: [Provide any additional context or details] + Output: [Gives short summary of the story] + +Feel free to customize and add your own prompts to this file. Each section includes a prompt and optional input. Happy Coding ! \ No newline at end of file From c688656607a6be2cbdf57038a75bf533556fb4ab Mon Sep 17 00:00:00 2001 From: Ayan Joshi Date: Mon, 9 Oct 2023 14:27:59 +0530 Subject: [PATCH 02/25] Commit --- application/prompts/custom_prompt.txt | 34 -------------------- docs/pages/Guides/Customising-prompts.md | 40 ++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 36 deletions(-) delete mode 100644 application/prompts/custom_prompt.txt diff --git a/application/prompts/custom_prompt.txt b/application/prompts/custom_prompt.txt deleted file mode 100644 index 054da1e..0000000 --- a/application/prompts/custom_prompt.txt +++ /dev/null @@ -1,34 +0,0 @@ -Welcome to the custom prompt file. You can use this file to create prompts for various tasks or experiments. Below are some examples of prompts you can use: - -1. *Summarization Task:* - - Prompt: Summarize the following article in 3-4 sentences. - Input: [Insert article here] - Output: Summarized article - -2. *Translation Task:* - - Prompt: Translate the English text into French. - Input: "Hello, how are you?" - Output: "Bonjour, comment รงa va ?" - -3. *Coding Task:* - - Prompt: Write a Python function that calculates the factorial of a given number. - Input: (Provide any specific number) - Output: (Gives factorial of the number) - -4. *Question-Answering Task:* - - Prompt: Answer the following question based on the given passage. - Input: [Insert passage here] - Question: [Insert question here] - Output: [Provided answer of the question] - -5. *Story Generation Task:* - - Prompt: Generate a short story about a detective solving a mystery. - Input: [Provide any additional context or details] - Output: [Gives short summary of the story] - -Feel free to customize and add your own prompts to this file. Each section includes a prompt and optional input. Happy Coding ! \ No newline at end of file diff --git a/docs/pages/Guides/Customising-prompts.md b/docs/pages/Guides/Customising-prompts.md index 1d3a7d4..e2e2613 100644 --- a/docs/pages/Guides/Customising-prompts.md +++ b/docs/pages/Guides/Customising-prompts.md @@ -1,4 +1,40 @@ -## To customize a main prompt navigate to `/application/prompt/combine_prompt.txt` +# Customizing the Main Prompt -You can try editing it to see how the model responses. +To customize the main prompt for DocsGPT, follow these steps: + +1. Navigate to `/application/prompt/combine_prompt.txt`. + +2. Edit the `combine_prompt.txt` file to modify the prompt text. You can experiment with different phrasings and structures to see how the model responds. + +## Example Prompt Modification + +**Original Prompt:** +```markdown +QUESTION: How to merge tables in pandas? +========= +Content: pandas provides various facilities for easily combining together Series or DataFrame with various kinds of set logic for the indexes and relational algebra functionality in the case of join / merge-type operations. +Source: 28-pl +Content: pandas provides a single function, merge(), as the entry point for all standard database join operations between DataFrame or named Series objects: \n\npandas.merge(left, right, how='inner', on=None, left_on=None, right_on=None, left_index=False, right_index=False, sort=False, suffixes=('_x', '_y'), copy=True, indicator=False, validate=None) +Source: 30-pl +========= +FINAL ANSWER: To merge two tables in pandas, you can use the pd.merge() function. The basic syntax is: \n\npd.merge(left, right, on, how) \n\nwhere left and right are the two tables to merge, on is the column to merge on, and how is the type of merge to perform. \n\nFor example, to merge the two tables df1 and df2 on the column 'id', you can use: \n\npd.merge(df1, df2, on='id', how='inner') +SOURCES: 28-pl 30-pl + + +## Modified Prompt (for illustration): + +QUESTION: Explain the concept of pandas merge in Python. +========= +Content: The pandas merge function in Python allows you to combine DataFrame objects by performing SQL-style joins. It is a powerful tool for data manipulation and analysis. +Source: Official pandas documentation +Content: You can use the merge function with various options such as 'how,' 'on,' 'left_on,' and 'right_on' to control how the merging is done. +Source: Data science tutorial blog +========= +FINAL ANSWER: To perform a pandas merge in Python, use the `pd.merge()` function. This function takes two DataFrames as input and merges them based on the specified columns. For example, to merge DataFrames `df1` and `df2` on the 'key' column, you can use: `pd.merge(df1, df2, on='key', how='inner')`. +SOURCES: Official pandas documentation, Data science tutorial blog + + +## Conclusion + +Customizing the main prompt for DocsGPT allows you to tailor the AI's responses to your unique requirements. Whether you need in-depth explanations, code examples, or specific insights, you can achieve it by modifying the main prompt. Remember to experiment and fine-tune your prompts to get the best results. From d7b28a35867e5751aa4f735d5af0bbbf120dca2a Mon Sep 17 00:00:00 2001 From: Ayan Joshi Date: Tue, 10 Oct 2023 19:10:24 +0530 Subject: [PATCH 03/25] Update Customising-prompts.md --- docs/pages/Guides/Customising-prompts.md | 32 ++++++++---------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/docs/pages/Guides/Customising-prompts.md b/docs/pages/Guides/Customising-prompts.md index e2e2613..2426974 100644 --- a/docs/pages/Guides/Customising-prompts.md +++ b/docs/pages/Guides/Customising-prompts.md @@ -10,28 +10,16 @@ To customize the main prompt for DocsGPT, follow these steps: **Original Prompt:** ```markdown -QUESTION: How to merge tables in pandas? -========= -Content: pandas provides various facilities for easily combining together Series or DataFrame with various kinds of set logic for the indexes and relational algebra functionality in the case of join / merge-type operations. -Source: 28-pl -Content: pandas provides a single function, merge(), as the entry point for all standard database join operations between DataFrame or named Series objects: \n\npandas.merge(left, right, how='inner', on=None, left_on=None, right_on=None, left_index=False, right_index=False, sort=False, suffixes=('_x', '_y'), copy=True, indicator=False, validate=None) -Source: 30-pl -========= -FINAL ANSWER: To merge two tables in pandas, you can use the pd.merge() function. The basic syntax is: \n\npd.merge(left, right, on, how) \n\nwhere left and right are the two tables to merge, on is the column to merge on, and how is the type of merge to perform. \n\nFor example, to merge the two tables df1 and df2 on the column 'id', you can use: \n\npd.merge(df1, df2, on='id', how='inner') -SOURCES: 28-pl 30-pl - - -## Modified Prompt (for illustration): - -QUESTION: Explain the concept of pandas merge in Python. -========= -Content: The pandas merge function in Python allows you to combine DataFrame objects by performing SQL-style joins. It is a powerful tool for data manipulation and analysis. -Source: Official pandas documentation -Content: You can use the merge function with various options such as 'how,' 'on,' 'left_on,' and 'right_on' to control how the merging is done. -Source: Data science tutorial blog -========= -FINAL ANSWER: To perform a pandas merge in Python, use the `pd.merge()` function. This function takes two DataFrames as input and merges them based on the specified columns. For example, to merge DataFrames `df1` and `df2` on the 'key' column, you can use: `pd.merge(df1, df2, on='key', how='inner')`. -SOURCES: Official pandas documentation, Data science tutorial blog +You are a DocsGPT, friendly and helpful AI assistant by Arc53 that provides help with documents. You give thorough answers with code examples if possible. +Use the following pieces of context to help answer the users question. If its not relevant to the question, provide friendly responses. +You have access to chat history, and can use it to help answer the question. +When using code examples, use the following format: + +(code) +{summaries} + +Thank you + ## Conclusion From ca3e549dd4f35d3c7b3b33ff85a32e861f6ccd83 Mon Sep 17 00:00:00 2001 From: shivanandmn Date: Thu, 12 Oct 2023 13:29:52 +0530 Subject: [PATCH 04/25] added delete index of vector store in faiss --- application/vectorstore/faiss.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/vectorstore/faiss.py b/application/vectorstore/faiss.py index 217b045..e5e8f7f 100644 --- a/application/vectorstore/faiss.py +++ b/application/vectorstore/faiss.py @@ -24,3 +24,6 @@ class FaissStore(BaseVectorStore): def save_local(self, *args, **kwargs): return self.docsearch.save_local(*args, **kwargs) + + def delete_index(self, *args, **kwargs): + return self.docsearch.delete(*args, **kwargs) From 2e95666939a5df2ea0d1c8be2d47a54b5820103c Mon Sep 17 00:00:00 2001 From: shivanandmn Date: Mon, 16 Oct 2023 02:46:48 +0530 Subject: [PATCH 05/25] added new endpoint --- application/api/user/routes.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index fdff2e9..b80562b 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -84,6 +84,19 @@ def api_feedback(): ) return {"status": http.client.responses.get(response.status_code, "ok")} +@user.route("/api/delete_by_ids", methods=["get"]) +def delete_by_ids(): + """Delete by ID. These are the IDs in the vectorstore""" + + ids = request.args.get("path") + if not ids: + return {"status": "error"} + + if settings.VECTOR_STORE == "faiss": + result = vectors_collection.delete_index(ids=ids) + if result: + return {"status": "ok"} + return {"status": "error"} @user.route("/api/delete_old", methods=["get"]) def delete_old(): From fa8177d0e57c55b6e5fa8f47f1daf7707ace79e5 Mon Sep 17 00:00:00 2001 From: Vedant Borkar Date: Mon, 16 Oct 2023 19:52:16 +0530 Subject: [PATCH 06/25] Update Navigation.tsx --- frontend/src/Navigation.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index be308ea..361ee65 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -264,7 +264,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { src={UploadIcon} onClick={() => setUploadModalState('ACTIVE')} > - {isDocsListOpen && ( + {!isDocsListOpen && (
{docs ? ( docs.map((doc, index) => { @@ -274,7 +274,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { key={index} onClick={() => { dispatch(setSelectedDocs(doc)); - setIsDocsListOpen(false); + setIsDocsListOpen(true); }} className="flex h-10 w-full cursor-pointer items-center justify-between border-x-2 border-b-2 hover:bg-gray-100" > From efcce6a8261065d816d901c677e08f34a396869d Mon Sep 17 00:00:00 2001 From: Rahul Kumar <104289350+rahul0x00@users.noreply.github.com> Date: Mon, 16 Oct 2023 14:51:24 +0000 Subject: [PATCH 07/25] Enhancement: Improve API Endpoint Documentation --- docs/pages/Developing/API-docs.md | 85 ++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 25 deletions(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 2d83284..6142818 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -1,9 +1,22 @@ -Currently, the application provides the following main API endpoints: +*Currently, the application provides the following main API endpoints:* -### /api/answer -It's a POST request that sends a JSON in body with 4 values. It will receive an answer for a user provided question. -Here is a JavaScript fetch example: +# API Endpoints Documentation +### /api/answer +**Description:**: +This endpoint is used to request answers to user-provided questions. + +**Request:** +Method: POST +Headers: Content-Type should be set to "application/json; charset=utf-8" +Request Body: JSON object with the following fields: +* **question:** The user's question +* **history:** (Optional) Previous conversation history +* **api_key:** Your API key +* **embeddings_key:** Your embeddings key +* **active_docs:** The location of active documentation + +Here is a JavaScript Fetch Request example: ```js // answer (POST http://127.0.0.1:5000/api/answer) fetch("http://127.0.0.1:5000/api/answer", { @@ -17,9 +30,8 @@ fetch("http://127.0.0.1:5000/api/answer", { .then((res) => res.text()) .then(console.log.bind(console)) ``` - -In response, you will get a JSON document like this one: - +**Response** +In response, you will get a JSON document containing the answer,query and the result: ```json { "answer": " Hi there! How can I help you?\n", @@ -29,9 +41,13 @@ In response, you will get a JSON document like this one: ``` ### /api/docs_check -It will make sure documentation is loaded on a server (just run it every time user is switching between libraries (documentations)). -It's a POST request that sends a JSON in a body with 1 value. Here is a JavaScript fetch example: +**Description:** +This endpoint will make sure documentation is loaded on the server (just run it every time user is switching between libraries (documentations)). +**Request:** +Headers: Content-Type should be set to "application/json; charset=utf-8" +Request Body: JSON object with the field: +* **docs:** The location of the documentation ```js // answer (POST http://127.0.0.1:5000/api/docs_check) fetch("http://127.0.0.1:5000/api/docs_check", { @@ -45,7 +61,8 @@ fetch("http://127.0.0.1:5000/api/docs_check", { .then(console.log.bind(console)) ``` -In response, you will get a JSON document like this one: +**Response:** +In response, you will get a JSON document like this one indicating whether the documentation exists or not.: ```json { "status": "exists" @@ -54,8 +71,13 @@ In response, you will get a JSON document like this one: ### /api/combine -Provides JSON that tells UI which vectors are available and where they are located with a simple get request. +**Description:** +This endpoint provides information about available vectors and their locations with a simple GET request. + +**Request:** +Method: GET +**Response:** Response will include: `date`, `description`, `docLink`, `fullName`, `language`, `location` (local or docshub), `model`, `name`, `version`. @@ -64,7 +86,13 @@ Example of JSON in Docshub and local: ### /api/upload -Uploads file that needs to be trained, response is JSON with task ID, which can be used to check on task's progress +**Description:** +This endpoint is used to upload a file that needs to be trained, response is JSON with task ID, which can be used to check on task's progress. + +**Request:** +Method: POST +Request Body: A multipart/form-data form with file upload and additional fields, including "user" and "name." + HTML example: ```html @@ -79,20 +107,23 @@ HTML example: ``` -Response: -```json -{ - "status": "ok", - "task_id": "b2684988-9047-428b-bd47-08518679103c" -} +**Response:** +This endpoint is used to get the JSON response with a status and a task ID that can be used to check the task's progress. + -``` ### /api/task_status -Gets task status (`task_id`) from `/api/upload`: +**Description:** +This endpoint is used to get the status of a task (`task_id`) from `/api/upload` + +**Request:** +Method: GET +Query Parameter: task_id (task ID to check) + +**Sample JavaScript Fetch Request:** ```js // Task status (Get http://127.0.0.1:5000/api/task_status) -fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4fe2e7454d1", { +fetch("http://localhost:5001/api/task_status?task_id=YOUR_TASK_ID", { "method": "GET", "headers": { "Content-Type": "application/json; charset=utf-8" @@ -102,7 +133,7 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f .then(console.log.bind(console)) ``` -Responses: +**Responses:** There are two types of responses: 1. While the task is still running, the 'current' value will show progress from 0 to 100. @@ -135,8 +166,11 @@ There are two types of responses: ``` ### /api/delete_old -Deletes old Vector Stores: +**Description:** +This endpoint is used to delete old Vector Stores. +**Request:** +Method: GET ```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", { @@ -148,8 +182,9 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f .then((res) => res.text()) .then(console.log.bind(console)) -Response: - +``` +**Response:** +JSON response indicating the status of the operation. ```json { "status": "ok" } ``` From 1c0b68f0e326f4a89b8bc2e05338f6b173232013 Mon Sep 17 00:00:00 2001 From: Rahul Kumar <104289350+rahul0x00@users.noreply.github.com> Date: Mon, 16 Oct 2023 20:27:09 +0530 Subject: [PATCH 08/25] Update API-docs.md --- docs/pages/Developing/API-docs.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 6142818..9ef964f 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -108,8 +108,7 @@ HTML example: ``` **Response:** -This endpoint is used to get the JSON response with a status and a task ID that can be used to check the task's progress. - +JSON response with a status and a task ID that can be used to check the task's progress. ### /api/task_status @@ -133,7 +132,7 @@ fetch("http://localhost:5001/api/task_status?task_id=YOUR_TASK_ID", { .then(console.log.bind(console)) ``` -**Responses:** +**Response:** There are two types of responses: 1. While the task is still running, the 'current' value will show progress from 0 to 100. From 06cc4b07ab58684045537f647e4f22b8fa270626 Mon Sep 17 00:00:00 2001 From: Rahul Kumar <104289350+rahul0x00@users.noreply.github.com> Date: Mon, 16 Oct 2023 20:35:17 +0530 Subject: [PATCH 09/25] Update API-docs.md --- docs/pages/Developing/API-docs.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 9ef964f..9007f48 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -3,10 +3,12 @@ # API Endpoints Documentation ### /api/answer -**Description:**: +**Description:** + This endpoint is used to request answers to user-provided questions. **Request:** + Method: POST Headers: Content-Type should be set to "application/json; charset=utf-8" Request Body: JSON object with the following fields: @@ -30,7 +32,9 @@ fetch("http://127.0.0.1:5000/api/answer", { .then((res) => res.text()) .then(console.log.bind(console)) ``` + **Response** + In response, you will get a JSON document containing the answer,query and the result: ```json { @@ -41,10 +45,13 @@ In response, you will get a JSON document containing the answer,query and the re ``` ### /api/docs_check + **Description:** + This endpoint will make sure documentation is loaded on the server (just run it every time user is switching between libraries (documentations)). **Request:** + Headers: Content-Type should be set to "application/json; charset=utf-8" Request Body: JSON object with the field: * **docs:** The location of the documentation @@ -62,6 +69,7 @@ fetch("http://127.0.0.1:5000/api/docs_check", { ``` **Response:** + In response, you will get a JSON document like this one indicating whether the documentation exists or not.: ```json { @@ -72,24 +80,31 @@ In response, you will get a JSON document like this one indicating whether the d ### /api/combine **Description:** + This endpoint provides information about available vectors and their locations with a simple GET request. **Request:** + Method: GET **Response:** + Response will include: `date`, `description`, `docLink`, `fullName`, `language`, `location` (local or docshub), `model`, `name`, `version`. + Example of JSON in Docshub and local: + image ### /api/upload **Description:** + This endpoint is used to upload a file that needs to be trained, response is JSON with task ID, which can be used to check on task's progress. **Request:** + Method: POST Request Body: A multipart/form-data form with file upload and additional fields, including "user" and "name." @@ -108,11 +123,13 @@ HTML example: ``` **Response:** + JSON response with a status and a task ID that can be used to check the task's progress. ### /api/task_status **Description:** + This endpoint is used to get the status of a task (`task_id`) from `/api/upload` **Request:** @@ -133,6 +150,7 @@ fetch("http://localhost:5001/api/task_status?task_id=YOUR_TASK_ID", { ``` **Response:** + There are two types of responses: 1. While the task is still running, the 'current' value will show progress from 0 to 100. @@ -166,9 +184,11 @@ There are two types of responses: ### /api/delete_old **Description:** + This endpoint is used to delete old Vector Stores. **Request:** + Method: GET ```js // Task status (GET http://127.0.0.1:5000/api/docs_check) @@ -183,6 +203,7 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f ``` **Response:** + JSON response indicating the status of the operation. ```json { "status": "ok" } From f9e67512791fd594cb926b09a0bc2117e8cc9960 Mon Sep 17 00:00:00 2001 From: Alexander Deshkevich Date: Mon, 16 Oct 2023 18:58:55 -0300 Subject: [PATCH 10/25] fix render lists in conversation --- .../ConversationBubble.module.css | 11 ++++++ .../src/conversation/ConversationBubble.tsx | 35 ++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 frontend/src/conversation/ConversationBubble.module.css diff --git a/frontend/src/conversation/ConversationBubble.module.css b/frontend/src/conversation/ConversationBubble.module.css new file mode 100644 index 0000000..4a8d3a1 --- /dev/null +++ b/frontend/src/conversation/ConversationBubble.module.css @@ -0,0 +1,11 @@ +.list p { + display: inline; +} + +.list li:not(:first-child) { + margin-top: 1em; +} + +.list li > .list { + margin-top: 1em; +} diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index ad7db7a..47fe709 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -1,6 +1,7 @@ import { forwardRef, useState } from 'react'; import Avatar from '../Avatar'; import { FEEDBACK, MESSAGE_TYPE } from './conversationModels'; +import classes from './ConversationBubble.module.css'; import Alert from './../assets/alert.svg'; import { ReactComponent as Like } from './../assets/like.svg'; import { ReactComponent as Dislike } from './../assets/dislike.svg'; @@ -40,16 +41,6 @@ const ConversationBubble = forwardRef< }, 2000); }; - const List = ({ - ordered, - children, - }: { - ordered?: boolean; - children: React.ReactNode; - }) => { - const Tag = ordered ? 'ol' : 'ul'; - return {children}; - }; let bubble; if (type === 'QUESTION') { @@ -104,11 +95,23 @@ const ConversationBubble = forwardRef< ); }, - ul({ node, children }) { - return {children}; + ul({ children }) { + return ( +
    + {children} +
+ ); }, - ol({ node, children }) { - return {children}; + ol({ children }) { + return ( +
    + {children} +
+ ); }, }} > @@ -118,9 +121,7 @@ const ConversationBubble = forwardRef< <>
-
- Sources: -
+
Sources:
{sources?.map((source, index) => (
Date: Mon, 16 Oct 2023 20:09:59 -0300 Subject: [PATCH 11/25] Prevent unneccessary renders. Update show/hide state of feedback buttons by css instead React --- .../src/conversation/ConversationBubble.tsx | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index ad7db7a..83b98cd 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -27,7 +27,6 @@ const ConversationBubble = forwardRef< { message, type, className, feedback, handleFeedback, sources }, ref, ) { - const [showFeedback, setShowFeedback] = useState(false); const [openSource, setOpenSource] = useState(null); const [copied, setCopied] = useState(false); @@ -65,12 +64,7 @@ const ConversationBubble = forwardRef< ); } else { bubble = ( -
setShowFeedback(true)} - onMouseLeave={() => setShowFeedback(false)} - > +
-
- Sources: -
+
Sources:
{sources?.map((source, index) => (
{copied ? ( @@ -167,10 +159,10 @@ const ConversationBubble = forwardRef< )}
Date: Tue, 17 Oct 2023 08:09:32 +0530 Subject: [PATCH 12/25] Update react-widget.md --- docs/pages/Extensions/react-widget.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/pages/Extensions/react-widget.md b/docs/pages/Extensions/react-widget.md index 1cc1132..a31306a 100644 --- a/docs/pages/Extensions/react-widget.md +++ b/docs/pages/Extensions/react-widget.md @@ -14,9 +14,9 @@ import "docsgpt/dist/style.css"; Then you can use it like this: `` DocsGPTWidget takes 3 props: -- `apiHost` โ€” URL of your DocsGPT API. -- `selectDocs` โ€” documentation that you want to use for your widget (e.g. `default` or `local/docs1.zip`). -- `apiKey` โ€” usually it's empty. +1. `apiHost` โ€” URL of your DocsGPT API. +2. `selectDocs` โ€” documentation that you want to use for your widget (e.g. `default` or `local/docs1.zip`). +3. `apiKey` โ€” usually it's empty. ### How to use DocsGPTWidget with [Nextra](https://nextra.site/) (Next.js + MDX) Install your widget as described above and then go to your `pages/` folder and create a new file `_app.js` with the following content: From a9fb61bbd6854b4ccc7d778263ce84e726f7a26c Mon Sep 17 00:00:00 2001 From: Rahul Kumar <104289350+rahul0x00@users.noreply.github.com> Date: Tue, 17 Oct 2023 08:28:13 +0530 Subject: [PATCH 13/25] Update API-docs.md --- docs/pages/Developing/API-docs.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 9007f48..1f9626e 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -2,7 +2,7 @@ # API Endpoints Documentation -### /api/answer +### 1. /api/answer **Description:** This endpoint is used to request answers to user-provided questions. @@ -44,7 +44,7 @@ In response, you will get a JSON document containing the answer,query and the re } ``` -### /api/docs_check +### 2. /api/docs_check **Description:** @@ -78,7 +78,7 @@ In response, you will get a JSON document like this one indicating whether the d ``` -### /api/combine +### 3. /api/combine **Description:** This endpoint provides information about available vectors and their locations with a simple GET request. @@ -127,7 +127,7 @@ HTML example: JSON response with a status and a task ID that can be used to check the task's progress. -### /api/task_status +### 4. /api/task_status **Description:** This endpoint is used to get the status of a task (`task_id`) from `/api/upload` @@ -182,7 +182,7 @@ There are two types of responses: } ``` -### /api/delete_old +### 5. /api/delete_old **Description:** This endpoint is used to delete old Vector Stores. From 5c2b4398d9194268b6d21c6ec1a7651a9ec1720b Mon Sep 17 00:00:00 2001 From: Vedant Borkar Date: Tue, 17 Oct 2023 11:53:57 +0530 Subject: [PATCH 14/25] Update Navigation.tsx --- frontend/src/Navigation.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 361ee65..ede4ced 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -255,7 +255,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { src={Arrow2} alt="arrow" className={`${ - isDocsListOpen ? 'rotate-0' : 'rotate-180' + !isDocsListOpen ? 'rotate-0' : 'rotate-180' } ml-auto mr-3 w-3 transition-all`} />
@@ -264,7 +264,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { src={UploadIcon} onClick={() => setUploadModalState('ACTIVE')} > - {!isDocsListOpen && ( + {isDocsListOpen && (
{docs ? ( docs.map((doc, index) => { @@ -274,7 +274,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { key={index} onClick={() => { dispatch(setSelectedDocs(doc)); - setIsDocsListOpen(true); + setIsDocsListOpen(false); }} className="flex h-10 w-full cursor-pointer items-center justify-between border-x-2 border-b-2 hover:bg-gray-100" > From 186f565b99915966ac95c7da882992da37e33ba9 Mon Sep 17 00:00:00 2001 From: Rahul Kumar <104289350+rahul0x00@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:27:38 +0530 Subject: [PATCH 15/25] Update API-docs.md --- docs/pages/Developing/API-docs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 1f9626e..fd01096 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -98,7 +98,7 @@ Example of JSON in Docshub and local: image -### /api/upload +### 4. /api/upload **Description:** This endpoint is used to upload a file that needs to be trained, response is JSON with task ID, which can be used to check on task's progress. @@ -127,7 +127,7 @@ HTML example: JSON response with a status and a task ID that can be used to check the task's progress. -### 4. /api/task_status +### 5. /api/task_status **Description:** This endpoint is used to get the status of a task (`task_id`) from `/api/upload` @@ -182,7 +182,7 @@ There are two types of responses: } ``` -### 5. /api/delete_old +### 6. /api/delete_old **Description:** This endpoint is used to delete old Vector Stores. From 062f3256a7cee1e70c5334cee40be6dc569fcc13 Mon Sep 17 00:00:00 2001 From: Rahul Kumar <104289350+rahul0x00@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:28:50 +0530 Subject: [PATCH 16/25] Update API-docs.md --- docs/pages/Developing/API-docs.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index fd01096..09e4f87 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -1,6 +1,7 @@ +# API Endpoints Documentation + *Currently, the application provides the following main API endpoints:* -# API Endpoints Documentation ### 1. /api/answer **Description:** From ca48f000bd2e2852fec5650b5f1f1eb1f196c376 Mon Sep 17 00:00:00 2001 From: ManiYadla Date: Tue, 17 Oct 2023 20:40:27 +0530 Subject: [PATCH 17/25] changed the typos --- README.md | 70 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index c24a748..53d590a 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- DocsGPT is a cutting-edge open-source solution that streamlines the process of finding information in project documentation. With its integration of the powerful GPT models, developers can easily ask questions about a project and receive accurate answers. + DocsGPT is a cutting-edge open-source solution that streamlines the process of finding information in the project documentation. With its integration of the powerful GPT models, developers can easily ask questions about a project and receive accurate answers. Say goodbye to time-consuming manual searches, and let DocsGPT help you quickly find the information you need. Try it out and see how it revolutionizes your project documentation experience. Contribute to its development and be a part of the future of AI-powered assistance.

@@ -21,61 +21,56 @@ Say goodbye to time-consuming manual searches, and let - + + Contributors ## License From f0d4847946a5389dfd9cf9b1d6d214c6f054b680 Mon Sep 17 00:00:00 2001 From: debghs <145260557+debghs@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:46:29 +0530 Subject: [PATCH 20/25] Update How-to-train-on-other-documentation.md --- .../How-to-train-on-other-documentation.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/pages/Guides/How-to-train-on-other-documentation.md b/docs/pages/Guides/How-to-train-on-other-documentation.md index 2e8e4af..aa1ff41 100644 --- a/docs/pages/Guides/How-to-train-on-other-documentation.md +++ b/docs/pages/Guides/How-to-train-on-other-documentation.md @@ -12,28 +12,28 @@ It currently uses OPEN_AI to create the vector store, so make sure your document You can usually find documentation on Github in `docs/` folder for most open-source projects. ### 1. Find documentation in .rst/.md and create a folder with it in your scripts directory -- Name it `inputs/` -- Put all your .rst/.md files in there -- The search is recursive, so you don't need to flatten them +- Name it `inputs/`. +- Put all your .rst/.md files in there. +- The search is recursive, so you don't need to flatten them. -If there are no .rst/.md files just convert whatever you find to .txt and feed it. (don't forget to change the extension in script) +If there are no .rst/.md files just convert whatever you find to .txt file and feed it. (don't forget to change the extension in script) ### 2. Create .env file in `scripts/` folder And write your OpenAI API key inside -`OPENAI_API_KEY=` +`OPENAI_API_KEY=`. ### 3. Run scripts/ingest.py `python ingest.py ingest` -It will tell you how much it will cost +It will tell you how much it will cost. ### 4. Move `index.faiss` and `index.pkl` generated in `scripts/output` to `application/` folder. ### 5. Run web app -Once you run it will use new context that is relevant to your documentation -Make sure you select default in the dropdown in the UI +Once you run it will use new context that is relevant to your documentation. +Make sure you select default in the dropdown in the UI. ## Customization You can learn more about options while running ingest.py by running: From d40ea44ae66a8f8b9fc5ad2663e79a79721386d8 Mon Sep 17 00:00:00 2001 From: Shivam Bhatnagar <88842947+Bitnagar@users.noreply.github.com> Date: Wed, 18 Oct 2023 10:33:44 +0000 Subject: [PATCH 21/25] fix(frontend): fix navigation z-index in mobiles --- frontend/src/Navigation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index be308ea..f34050c 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -362,7 +362,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
-
+
@@ -205,9 +206,10 @@ export default function Upload({
@@ -228,8 +230,9 @@ export default function Upload({ return (
{view} From d93266fee29aa6ead88475c60c7ce9086cc633c8 Mon Sep 17 00:00:00 2001 From: Ayush-Prabhu <126278585+Ayush-Prabhu@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:21:15 +0530 Subject: [PATCH 23/25] Update How-to-use-different-LLM.md Corrected grammatical errors to remove ambiguity and improve professionalism. --- docs/pages/Guides/How-to-use-different-LLM.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/pages/Guides/How-to-use-different-LLM.md b/docs/pages/Guides/How-to-use-different-LLM.md index 0eaf483..8d7cccc 100644 --- a/docs/pages/Guides/How-to-use-different-LLM.md +++ b/docs/pages/Guides/How-to-use-different-LLM.md @@ -1,10 +1,10 @@ -Fortunately, there are many providers for LLM's and some of them can even be run locally +Fortunately, there are many providers for LLMs, and some of them can even be run locally. There are two models used in the app: 1. Embeddings. 2. Text generation. -By default, we use OpenAI's models but if you want to change it or even run it locally, it's very simple! +By default, we use OpenAI's models, but if you want to change it or even run it locally, it's very simple! ### Go to .env file or set environment variables: @@ -31,6 +31,6 @@ Alternatively, if you wish to run Llama locally, you can run `setup.sh` and choo That's it! ### Hosting everything locally and privately (for using our optimised open-source models) -If you are working with important data and don't want anything to leave your premises. +If you are working with critical data and don't want anything to leave your premises. -Make sure you set `SELF_HOSTED_MODEL` as true in your `.env` variable and for your `LLM_NAME` you can use anything that's on Hugging Face. +Make sure you set `SELF_HOSTED_MODEL` as true in your `.env` variable, and for your `LLM_NAME`, you can use anything that is on Hugging Face. From 2f6213c944c0c7bc948e57c3b02243668223331b Mon Sep 17 00:00:00 2001 From: "beKool.sh" <76424367+beKoool@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:11:30 +0545 Subject: [PATCH 24/25] Change font weight --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 8958f6d..4e41a0d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,4 +50,4 @@ yarn dev - Now, you should be able to view the docs on your local environment by visiting `http://localhost:5000`. You can explore the different markdown files and make changes as you see fit. -- Footnotes: This guide assumes you have Node.js and npm installed. The guide involves running a local server using yarn, and viewing the documentation offline. If you encounter any issues, it may be worth verifying your Node.js and npm installations and whether you have installed yarn correctly. +- **Footnotes:** This guide assumes you have Node.js and npm installed. The guide involves running a local server using yarn, and viewing the documentation offline. If you encounter any issues, it may be worth verifying your Node.js and npm installations and whether you have installed yarn correctly. From 06f0129b595d04be48870314bab51148cece0081 Mon Sep 17 00:00:00 2001 From: Saksham Tyagi Date: Thu, 19 Oct 2023 20:12:40 +0530 Subject: [PATCH 25/25] =?UTF-8?q?=F0=9F=92=84=20About=20margin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/About.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/About.tsx b/frontend/src/About.tsx index fe26835..bde6ad9 100644 --- a/frontend/src/About.tsx +++ b/frontend/src/About.tsx @@ -4,7 +4,7 @@ export default function About() { return (
-
+

About DocsGPT

๐Ÿฆ–