From 5bbf6d2ae9afa5744a89f2c1de8d9204c68c96e2 Mon Sep 17 00:00:00 2001 From: Digvijay Shelar <82649533+shelar1423@users.noreply.github.com> Date: Thu, 5 Oct 2023 20:38:02 +0530 Subject: [PATCH 01/32] Update README.md --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index aba1401..b734af6 100644 --- a/README.md +++ b/README.md @@ -56,17 +56,19 @@ If you don't have enough resources to run it you can use bitsnbytes to quantize ## Useful links - [Live preview](https://docsgpt.arc53.com/) - - [Join Our Discord](https://discord.gg/n5BX8dh8rU) - - [Guides](https://docs.docsgpt.co.uk/) + Audit [Live preview](https://docsgpt.arc53.com/) - [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) - [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) + Discord [Join Our Discord](https://discord.gg/n5BX8dh8rU) - [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) +external-guide-lifestyles-flaticons-lineal-color-flat-icons [Guides](https://docs.docsgpt.co.uk/) + + +external-contribution-achievements-flaticons-lineal-color-flat-icons-2 [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) + +document--v1 [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) + +virtual-machine2 [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) ## Project structure From 35fef11d2a3d3766a18a0bb2a4d6416e3ead4ca2 Mon Sep 17 00:00:00 2001 From: Digvijay Shelar <82649533+shelar1423@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:40:46 +0530 Subject: [PATCH 02/32] Update README.md --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b734af6..5c115b4 100644 --- a/README.md +++ b/README.md @@ -56,19 +56,21 @@ If you don't have enough resources to run it you can use bitsnbytes to quantize ## Useful links - Audit [Live preview](https://docsgpt.arc53.com/) + Audit [Live preview](https://docsgpt.arc53.com/) Discord [Join Our Discord](https://discord.gg/n5BX8dh8rU) -external-guide-lifestyles-flaticons-lineal-color-flat-icons [Guides](https://docs.docsgpt.co.uk/) +external-guide-lifestyles-flaticons-lineal-color-flat-icons[Guides](https://docs.docsgpt.co.uk/) -external-contribution-achievements-flaticons-lineal-color-flat-icons-2 [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) +external-contribution-achievements-flaticons-lineal-color-flat-icons-2 [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) + +document--v1 [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) + +virtual-machine2 [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) -document--v1 [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) -virtual-machine2 [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) ## Project structure From bdfcf6591e58b8a5984108c4877e58a4dcf1f609 Mon Sep 17 00:00:00 2001 From: Nick Rogers Date: Fri, 6 Oct 2023 21:20:40 -0700 Subject: [PATCH 03/32] Fix missing documentation for using Llama_cpp --- docs/pages/Guides/How-to-use-different-LLM.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/pages/Guides/How-to-use-different-LLM.md b/docs/pages/Guides/How-to-use-different-LLM.md index aa5815f..f9a2fec 100644 --- a/docs/pages/Guides/How-to-use-different-LLM.md +++ b/docs/pages/Guides/How-to-use-different-LLM.md @@ -21,9 +21,13 @@ By default, we use OpenAI's models but if you want to change it or even run it l You don't need to provide keys if you are happy with users providing theirs, so make sure you set `LLM_NAME` and `EMBEDDINGS_NAME`. Options: -LLM_NAME (openai, manifest, cohere, Arc53/docsgpt-14b, Arc53/docsgpt-7b-falcon) +LLM_NAME (openai, manifest, cohere, Arc53/docsgpt-14b, Arc53/docsgpt-7b-falcon, llama.cpp) EMBEDDINGS_NAME (openai_text-embedding-ada-002, huggingface_sentence-transformers/all-mpnet-base-v2, huggingface_hkunlp/instructor-large, cohere_medium) +If using Llama, set the `EMBEDDINGS_NAME` to `huggingface_sentence-transformers/all-mpnet-base-v2`. + +Alternatively, if you wish to run Llama locally, you can run `setup.sh` and choose option 1 when prompted. + That's it! ### Hosting everything locally and privately (for using our optimised open-source models) From 6758b51617a9cbda1d88ff569d6fa26f709019f5 Mon Sep 17 00:00:00 2001 From: Digvijay Shelar <82649533+shelar1423@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:20:28 +0530 Subject: [PATCH 04/32] Update README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4b2247b..543bfb1 100644 --- a/README.md +++ b/README.md @@ -55,18 +55,18 @@ If you don't have enough resources to run it, you can use bitsnbytes to quantize ## Useful links + - πŸ”πŸ”₯ [Live preview](https://docsgpt.arc53.com/) + + - Discord [Join our Discord](https://discord.gg/n5BX8dh8rU) + + - πŸ“šπŸ˜Ž [Guides](https://docs.docsgpt.co.uk/) + - πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»πŸ’ͺ [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) - Discord [Join Our Discord](https://discord.gg/n5BX8dh8rU) - -external-guide-lifestyles-flaticons-lineal-color-flat-icons[Guides](https://docs.docsgpt.co.uk/) - - -external-contribution-achievements-flaticons-lineal-color-flat-icons-2 [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) + - πŸ—‚οΈπŸš€ [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) -document--v1 [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) + - πŸ πŸ’ΎπŸ” [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) -virtual-machine2 [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) From fc50bb6e57893fd9ea712c049bb9e51e419930c6 Mon Sep 17 00:00:00 2001 From: "beKool.sh" <76424367+beKoool@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:10:33 +0545 Subject: [PATCH 05/32] Add Backlink to Vector Stores --- 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 eabd29c..99d9896 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -104,7 +104,7 @@ fetch("http://localhost:5001/api/task_status?task_id=b2d2a0f4-387c-44fd-a443-e4f Responses: There are two types of responses: -1. while task it still running, where "current" will show progress from 0 to 100 +1. While task is still running, where "current" will show progress from 0 to 100: ```json { "result": { @@ -114,7 +114,7 @@ There are two types of responses: } ``` -2. When task is completed +2. When task is completed: ```json { "result": { @@ -133,7 +133,7 @@ There are two types of responses: ``` ### /api/delete_old -Deletes old vectorstores: +Deletes old [Vector stores](https://python.langchain.com/docs/modules/data_connection/vectorstores/): ```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", { From 5c9d11861efb41c2a1f07f98ddfbd62c7579969b Mon Sep 17 00:00:00 2001 From: staticGuru Date: Sun, 8 Oct 2023 22:08:19 +0530 Subject: [PATCH 06/32] add the coversation tile in the chat section --- frontend/src/Navigation.tsx | 51 ++++++++++++------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index e6c5bb6..4c5aac3 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -32,6 +32,7 @@ import { useMediaQuery, useOutsideAlerter } from './hooks'; import Upload from './upload/Upload'; import { Doc, getConversations } from './preferences/preferenceApi'; import SelectDocsModal from './preferences/SelectDocsModal'; +import ConversationTile from './conversation/ConversationTile'; interface NavigationProps { navOpen: boolean; @@ -126,6 +127,10 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { ); }); }; + + function updateConversationName(updatedConversation: object) { + console.log(updatedConversation); + } useOutsideAlerter( navRef, () => { @@ -210,41 +215,17 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
{conversations - ? conversations.map((conversation) => { - return ( -
{ - handleConversationClick(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 ${ - conversationId === conversation.id ? 'bg-gray-100' : '' - }`} - > -
- -

- {conversation.name.length > 45 - ? conversation.name.substring(0, 45) + '...' - : conversation.name} -

-
- - {conversationId === conversation.id ? ( - Exit { - event.stopPropagation(); - handleDeleteConversation(conversation.id); - }} - /> - ) : null} -
- ); - }) + ? conversations.map((conversation, index) => ( + handleConversationClick(id)} + onDeleteConversation={(id) => handleDeleteConversation(id)} + onSave={(conversation) => + updateConversationName(conversation) + } + /> + )) : null}
From ceb9c70fbae464f537c45d612f0f10cd777ddf73 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Sun, 8 Oct 2023 22:08:42 +0530 Subject: [PATCH 07/32] add the edit icons in the assets --- frontend/src/assets/edit.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 frontend/src/assets/edit.svg diff --git a/frontend/src/assets/edit.svg b/frontend/src/assets/edit.svg new file mode 100644 index 0000000..2565377 --- /dev/null +++ b/frontend/src/assets/edit.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From f91ca796deadf8bc1fc35367f7bc5df5f5caa8d5 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Sun, 8 Oct 2023 22:09:16 +0530 Subject: [PATCH 08/32] add the check Mark icons --- frontend/src/assets/checkMark.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 frontend/src/assets/checkMark.svg diff --git a/frontend/src/assets/checkMark.svg b/frontend/src/assets/checkMark.svg new file mode 100644 index 0000000..9ed02cb --- /dev/null +++ b/frontend/src/assets/checkMark.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From 10cf0470cb3453312b1800c11fd2a5d808d1a679 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Sun, 8 Oct 2023 22:09:38 +0530 Subject: [PATCH 09/32] add the conversation Tile --- .../src/conversation/ConversationTile.tsx | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 frontend/src/conversation/ConversationTile.tsx diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx new file mode 100644 index 0000000..e97d998 --- /dev/null +++ b/frontend/src/conversation/ConversationTile.tsx @@ -0,0 +1,84 @@ +import React, { useState } from 'react'; +import { useSelector } from 'react-redux'; +import Edit from '../assets/edit.svg'; +import Exit from '../assets/exit.svg'; +import Message from '../assets/message.svg'; + +import { selectConversationId } from '../preferences/preferenceSlice'; + +interface ConversationTileProps { + conversation: { name: string; id: string }; + selectConversation: (arg1: string) => void; + onDeleteConversation: (arg1: string) => void; + onSave: ({ name, id }: { name: string; id: string }) => void; +} + +export default function ConversationTile({ + conversation, + selectConversation, + onDeleteConversation, + onSave, +}: ConversationTileProps) { + const conversationId = useSelector(selectConversationId); + + const [isEdit, setIsEdit] = useState(false); + const [conversationName, setConversationsName] = useState(conversation.name); + + function handleEditConversation() { + setIsEdit(true); + } + return ( +
{ + 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 ${ + conversationId === conversation.id ? 'bg-gray-100' : '' + }`} + > +
+ + {isEdit ? ( + setConversationsName(e.target.value)} + /> + ) : ( +

+ {conversationName.length > 45 + ? conversationName.substring(0, 45) + '...' + : conversationName} +

+ )} +
+ {conversationId === conversation.id ? ( + <> + Edit { + event.stopPropagation(); + isEdit + ? onSave({ id: conversationId, name: conversationName }) + : handleEditConversation(); + }} + /> + Exit { + event.stopPropagation(); + onDeleteConversation(conversation.id); + }} + /> + + ) : null} +
+ ); +} From 6b617955b7433eade76f8b765687084ee9c31cb2 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Sun, 8 Oct 2023 22:31:17 +0530 Subject: [PATCH 10/32] add the check mark logics --- .../src/conversation/ConversationTile.tsx | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index e97d998..b7e0058 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -1,8 +1,9 @@ -import React, { useState } from 'react'; +import React, { useRef, useState } from 'react'; import { useSelector } from 'react-redux'; import Edit from '../assets/edit.svg'; import Exit from '../assets/exit.svg'; import Message from '../assets/message.svg'; +import CheckMark from '../assets/checkMark.svg'; import { selectConversationId } from '../preferences/preferenceSlice'; @@ -20,12 +21,26 @@ export default function ConversationTile({ onSave, }: ConversationTileProps) { const conversationId = useSelector(selectConversationId); + const inputRef = useRef(null); const [isEdit, setIsEdit] = useState(false); const [conversationName, setConversationsName] = useState(conversation.name); function handleEditConversation() { setIsEdit(true); + // inputRef?.current?.focus(); + } + function handleSaveConversation(changedConversation: any) { + onSave(changedConversation); + setIsEdit(false); + } + function handleBlur() { + if (conversation.name !== conversationName) { + handleSaveConversation({ + id: conversationId, + name: conversationName, + }); + } } return (
{isEdit ? ( setConversationsName(e.target.value)} /> ) : ( @@ -56,14 +74,17 @@ export default function ConversationTile({ {conversationId === conversation.id ? ( <> Edit { event.stopPropagation(); isEdit - ? onSave({ id: conversationId, name: conversationName }) + ? handleSaveConversation({ + id: conversationId, + name: conversationName, + }) : handleEditConversation(); }} /> From 261c674832e4a61655ab82d574c5664feeb81e14 Mon Sep 17 00:00:00 2001 From: "beKool.sh" <76424367+beKoool@users.noreply.github.com> Date: Mon, 9 Oct 2023 05:48:27 +0545 Subject: [PATCH 11/32] Update API-docs.md --- docs/pages/Developing/API-docs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/Developing/API-docs.md b/docs/pages/Developing/API-docs.md index 99d9896..26ad640 100644 --- a/docs/pages/Developing/API-docs.md +++ b/docs/pages/Developing/API-docs.md @@ -133,7 +133,7 @@ There are two types of responses: ``` ### /api/delete_old -Deletes old [Vector stores](https://python.langchain.com/docs/modules/data_connection/vectorstores/): +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", { From f88806fc3c10977cff952a67a56964246eceebc7 Mon Sep 17 00:00:00 2001 From: Digvijay Shelar <82649533+shelar1423@users.noreply.github.com> Date: Mon, 9 Oct 2023 07:26:34 +0530 Subject: [PATCH 12/32] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f326f42..3784278 100644 --- a/README.md +++ b/README.md @@ -57,16 +57,15 @@ If you don't have enough resources to run it, you can use bitsnbytes to quantize - πŸ”πŸ”₯ [Live preview](https://docsgpt.arc53.com/) - - Discord [Join our Discord](https://discord.gg/n5BX8dh8rU) + - πŸ’¬πŸŽ‰[Join our Discord](https://discord.gg/n5BX8dh8rU) - πŸ“šπŸ˜Ž [Guides](https://docs.docsgpt.co.uk/) - - πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»πŸ’ͺ [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) + - πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» [Interested in contributing?](https://github.com/arc53/DocsGPT/blob/main/CONTRIBUTING.md) - πŸ—‚οΈπŸš€ [How to use any other documentation](https://docs.docsgpt.co.uk/Guides/How-to-train-on-other-documentation) - - πŸ πŸ’ΎπŸ” [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) - + - πŸ πŸ” [How to host it locally (so all data will stay on-premises)](https://docs.docsgpt.co.uk/Guides/How-to-use-different-LLM) From f8ca6c019f5d8fdea8a5fe6d08b84d861cd9e609 Mon Sep 17 00:00:00 2001 From: Shuvadipta Das Date: Mon, 9 Oct 2023 09:46:54 +0530 Subject: [PATCH 13/32] Update My-AI-answers-questions-using-external-knowledge.md --- .../My-AI-answers-questions-using-external-knowledge.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/pages/Guides/My-AI-answers-questions-using-external-knowledge.md b/docs/pages/Guides/My-AI-answers-questions-using-external-knowledge.md index fb15835..a546116 100644 --- a/docs/pages/Guides/My-AI-answers-questions-using-external-knowledge.md +++ b/docs/pages/Guides/My-AI-answers-questions-using-external-knowledge.md @@ -1,10 +1,10 @@ -If your AI uses external knowledge and is not explicit enough, it is ok, because we try to make docsgpt friendly. +If your AI uses external knowledge and is not explicit enough, it is ok, because we try to make DocsGPT friendly. -But if you want to adjust it, here is a simple way. +But if you want to adjust it, here is a simple way:- -Got to `application/prompts/chat_combine_prompt.txt` +- Got to `application/prompts/chat_combine_prompt.txt` -And change it to +- And change it to ``` From a032164a99ca07d4b1f75fb48f4998671917d563 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 10:25:38 +0530 Subject: [PATCH 14/32] Add update conversation name API --- application/api/user/routes.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 02a0876..aa0d15b 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -53,6 +53,15 @@ def get_single_conversation(): conversation = conversations_collection.find_one({"_id": ObjectId(conversation_id)}) return jsonify(conversation['queries']) +@user.route("/api/update_conversation_name", methods=["POST"]) +def update_conversation_name(): + # update data for a conversation + data = request.get_json() + id = data["id"] + name = data["name"] + conversation = conversations_collection.update_one({"_id": ObjectId(id)},{"$set":{"name":name}}) + return {"status": "ok"} + @user.route("/api/feedback", methods=["POST"]) def api_feedback(): From 7bf67869b015d65b894f7ea3f6bee269f70420c6 Mon Sep 17 00:00:00 2001 From: Nick Rogers Date: Sun, 8 Oct 2023 22:03:32 -0700 Subject: [PATCH 15/32] Reference DocsGPT model in custom model steps. --- docs/pages/Guides/How-to-use-different-LLM.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/Guides/How-to-use-different-LLM.md b/docs/pages/Guides/How-to-use-different-LLM.md index 413bef1..0eaf483 100644 --- a/docs/pages/Guides/How-to-use-different-LLM.md +++ b/docs/pages/Guides/How-to-use-different-LLM.md @@ -24,9 +24,9 @@ Options: LLM_NAME (openai, manifest, cohere, Arc53/docsgpt-14b, Arc53/docsgpt-7b-falcon, llama.cpp) EMBEDDINGS_NAME (openai_text-embedding-ada-002, huggingface_sentence-transformers/all-mpnet-base-v2, huggingface_hkunlp/instructor-large, cohere_medium) -If using Llama, set the `EMBEDDINGS_NAME` to `huggingface_sentence-transformers/all-mpnet-base-v2`. +If using Llama, set the `EMBEDDINGS_NAME` to `huggingface_sentence-transformers/all-mpnet-base-v2` and be sure to download [this model](https://d3dg1063dc54p9.cloudfront.net/models/docsgpt-7b-f16.gguf) into the `models/` folder: `https://d3dg1063dc54p9.cloudfront.net/models/docsgpt-7b-f16.gguf`. -Alternatively, if you wish to run Llama locally, you can run `setup.sh` and choose option 1 when prompted. +Alternatively, if you wish to run Llama locally, you can run `setup.sh` and choose option 1 when prompted. You do not need to manually add the DocsGPT model mentioned above to your `models/` folder if you use `setup.sh`, as the script will manage that step for you. That's it! From 4ca906a51808628885f8760386699e7886db43ef Mon Sep 17 00:00:00 2001 From: Vaibhav91one Date: Mon, 9 Oct 2023 10:44:14 +0530 Subject: [PATCH 16/32] bug(front): The text seems to go out of screen when the result is too big, needed some tailwind --- frontend/src/conversation/ConversationBubble.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index b74c65f..e872d87 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -60,7 +60,7 @@ const ConversationBubble = forwardRef<
)} Date: Mon, 9 Oct 2023 12:48:48 +0530 Subject: [PATCH 17/32] add the update conversation callbacks --- frontend/src/Navigation.tsx | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 4c5aac3..97034ea 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -69,16 +69,20 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { useEffect(() => { if (!conversations) { - getConversations() - .then((fetchedConversations) => { - dispatch(setConversations(fetchedConversations)); - }) - .catch((error) => { - console.error('Failed to fetch conversations: ', error); - }); + fetchConversations(); } }, [conversations, dispatch]); + async function fetchConversations() { + return await getConversations() + .then((fetchedConversations) => { + dispatch(setConversations(fetchedConversations)); + }) + .catch((error) => { + console.error('Failed to fetch conversations: ', error); + }); + } + const handleDeleteConversation = (id: string) => { fetch(`${apiHost}/api/delete_conversation?id=${id}`, { method: 'POST', @@ -128,8 +132,27 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { }); }; - function updateConversationName(updatedConversation: object) { - console.log(updatedConversation); + async function updateConversationName(updatedConversation: { + name: string; + id: string; + }) { + await fetch(`${apiHost}/api/update_conversation_name`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(updatedConversation), + }) + .then((response) => response.json()) + .then((data) => { + if (data) { + navigate('/'); + fetchConversations(); + } + }) + .catch((err) => { + console.error(err); + }); } useOutsideAlerter( navRef, From 022c0c3a890fb469936d74da5726d576b4f1ed3d Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 12:49:09 +0530 Subject: [PATCH 18/32] add trash icons changes --- frontend/src/assets/trash.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 frontend/src/assets/trash.svg diff --git a/frontend/src/assets/trash.svg b/frontend/src/assets/trash.svg new file mode 100644 index 0000000..d0e4546 --- /dev/null +++ b/frontend/src/assets/trash.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From 17264e787242d93f7eddd4f87dcc463e15c7d82a Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 12:50:12 +0530 Subject: [PATCH 19/32] add the outside click listioner --- .../src/conversation/ConversationTile.tsx | 74 ++++++++++++------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index b7e0058..b578e38 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -1,11 +1,13 @@ -import React, { useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { useSelector } from 'react-redux'; import Edit from '../assets/edit.svg'; import Exit from '../assets/exit.svg'; import Message from '../assets/message.svg'; import CheckMark from '../assets/checkMark.svg'; +import Trash from '../assets/trash.svg'; import { selectConversationId } from '../preferences/preferenceSlice'; +import { useOutsideAlerter } from '../hooks'; interface ConversationTileProps { conversation: { name: string; id: string }; @@ -21,29 +23,47 @@ export default function ConversationTile({ onSave, }: ConversationTileProps) { const conversationId = useSelector(selectConversationId); - const inputRef = useRef(null); + const tileRef = useRef(null); const [isEdit, setIsEdit] = useState(false); - const [conversationName, setConversationsName] = useState(conversation.name); + const [conversationName, setConversationsName] = useState(''); + useOutsideAlerter( + tileRef, + () => + handleSaveConversation({ + id: conversationId || conversation.id, + name: conversationName, + }), + [conversationName], + ); + + useEffect(() => { + setConversationsName(conversation.name); + }, [conversation.name]); function handleEditConversation() { setIsEdit(true); - // inputRef?.current?.focus(); - } - function handleSaveConversation(changedConversation: any) { - onSave(changedConversation); - setIsEdit(false); } - function handleBlur() { - if (conversation.name !== conversationName) { - handleSaveConversation({ - id: conversationId, - name: conversationName, - }); + + function handleSaveConversation(changedConversation: { + name: string; + id: string; + }) { + if (changedConversation.name.trim().length) { + onSave(changedConversation); + setIsEdit(false); + } else { + onClear(); } } + + function onClear() { + setConversationsName(conversation.name); + setIsEdit(false); + } return (
{ selectConversation(conversation.id); }} @@ -51,32 +71,28 @@ export default function ConversationTile({ conversationId === conversation.id ? 'bg-gray-100' : '' }`} > -
+
{isEdit ? ( setConversationsName(e.target.value)} /> ) : ( -

- {conversationName.length > 45 - ? conversationName.substring(0, 45) + '...' - : conversationName} +

+ {conversationName}

)}
{conversationId === conversation.id ? ( - <> +
Edit { event.stopPropagation(); @@ -89,16 +105,18 @@ export default function ConversationTile({ }} /> Exit { event.stopPropagation(); - onDeleteConversation(conversation.id); + isEdit ? onClear() : onDeleteConversation(conversation.id); }} /> - +
) : null}
); From b49e8deb3ef427cff6b5a8da954c57b455665823 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 14:13:09 +0530 Subject: [PATCH 20/32] add the typescript props interface --- .../src/conversation/ConversationTile.tsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index b578e38..29a0d51 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { useSelector } from 'react-redux'; import Edit from '../assets/edit.svg'; import Exit from '../assets/exit.svg'; @@ -9,11 +9,15 @@ import Trash from '../assets/trash.svg'; import { selectConversationId } from '../preferences/preferenceSlice'; import { useOutsideAlerter } from '../hooks'; +interface ConversationProps { + name: string; + id: string; +} interface ConversationTileProps { - conversation: { name: string; id: string }; + conversation: ConversationProps; selectConversation: (arg1: string) => void; onDeleteConversation: (arg1: string) => void; - onSave: ({ name, id }: { name: string; id: string }) => void; + onSave: ({ name, id }: ConversationProps) => void; } export default function ConversationTile({ @@ -45,10 +49,7 @@ export default function ConversationTile({ setIsEdit(true); } - function handleSaveConversation(changedConversation: { - name: string; - id: string; - }) { + function handleSaveConversation(changedConversation: ConversationProps) { if (changedConversation.name.trim().length) { onSave(changedConversation); setIsEdit(false); @@ -71,7 +72,11 @@ export default function ConversationTile({ conversationId === conversation.id ? 'bg-gray-100' : '' }`} > -
+
{isEdit ? ( Date: Mon, 9 Oct 2023 14:44:43 +0530 Subject: [PATCH 21/32] Change the width in the tile --- frontend/src/conversation/ConversationTile.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index 29a0d51..b5cb755 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -74,7 +74,7 @@ export default function ConversationTile({ >
From 95fe1037180fbb1f958a1b81ca27fed26bbf626f Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 15:17:32 +0530 Subject: [PATCH 22/32] add the conversation in the result response --- application/api/user/routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index aa0d15b..9853f9a 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -60,7 +60,7 @@ def update_conversation_name(): id = data["id"] name = data["name"] conversation = conversations_collection.update_one({"_id": ObjectId(id)},{"$set":{"name":name}}) - return {"status": "ok"} + return {"status": "ok","result":conversation} @user.route("/api/feedback", methods=["POST"]) From a06369dd7b89ac111ca103f3f13d81ba62cca3f8 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 15:19:29 +0530 Subject: [PATCH 23/32] add the checkmark icons --- frontend/src/assets/checkmark.svg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/assets/checkmark.svg b/frontend/src/assets/checkmark.svg index 682c29d..9ed02cb 100644 --- a/frontend/src/assets/checkmark.svg +++ b/frontend/src/assets/checkmark.svg @@ -1,3 +1,3 @@ - - - + + + \ No newline at end of file From 340647cb220e9cebe75b850524436ec49d0aaced Mon Sep 17 00:00:00 2001 From: Robbie Walmsley <65429016+robbiebusinessacc@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:53:03 +0100 Subject: [PATCH 24/32] Update ingest.py --- scripts/ingest.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/ingest.py b/scripts/ingest.py index 6ab9cce..e0d5ce1 100644 --- a/scripts/ingest.py +++ b/scripts/ingest.py @@ -78,14 +78,12 @@ def ingest(yes: bool = typer.Option(False, "-y", "--yes", prompt=False, # Here we check for command line arguments for bot calls. # If no argument exists or the yes is not True, then the # user permission is requested to call the API. - if len(sys.argv) > 1: - if yes: - call_openai_api(docs, folder_name) - else: - get_user_permission(docs, folder_name) + if len(sys.argv) > 1 and yes: + call_openai_api(docs, folder_name) else: get_user_permission(docs, folder_name) + folder_counts = defaultdict(int) folder_names = [] for dir_path in dir: From 57fb29b6008e38f6445f91066d3fbacd7eaf25b2 Mon Sep 17 00:00:00 2001 From: Robbie Walmsley <65429016+robbiebusinessacc@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:55:34 +0100 Subject: [PATCH 25/32] Update worker.py --- application/worker.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/worker.py b/application/worker.py index 5c87c70..71fcd61 100644 --- a/application/worker.py +++ b/application/worker.py @@ -21,8 +21,7 @@ except FileExistsError: def metadata_from_filename(title): - store = title.split('/') - store = store[1] + '/' + store[2] + store = '/'.join(title.split('/')[1:3]) return {'title': title, 'store': store} From 2d0b6bcfcc0c852a65444594c2ed85d1d79f88e8 Mon Sep 17 00:00:00 2001 From: Robbie Walmsley <65429016+robbiebusinessacc@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:04:55 +0100 Subject: [PATCH 26/32] Update ingest.py --- scripts/ingest.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/ingest.py b/scripts/ingest.py index e0d5ce1..4834844 100644 --- a/scripts/ingest.py +++ b/scripts/ingest.py @@ -108,14 +108,19 @@ def convert(dir: Optional[str] = typer.Option("inputs", Creates documentation linked to original functions from specified location. By default /inputs folder is used, .py is parsed. """ - if formats == 'py': - functions_dict, classes_dict = extract_py(dir) - elif formats == 'js': - functions_dict, classes_dict = extract_js(dir) - elif formats == 'java': - functions_dict, classes_dict = extract_java(dir) + # Using a dictionary to map between the formats and their respective extraction functions + # makes the code more scalable. When adding more formats in the future, + # you only need to update the extraction_functions dictionary. + extraction_functions = { + 'py': extract_py, + 'js': extract_js, + 'java': extract_java + } + + if formats in extraction_functions: + functions_dict, classes_dict = extraction_functions[formats](dir) else: - raise Exception("Sorry, language not supported yet") + raise Exception("Sorry, language not supported yet") transform_to_docs(functions_dict, classes_dict, formats, dir) From 4d92606562c3cb553ebf6b55210bce4e822b3193 Mon Sep 17 00:00:00 2001 From: Robbie Walmsley <65429016+robbiebusinessacc@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:11:07 +0100 Subject: [PATCH 27/32] Update ingest.py --- scripts/ingest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ingest.py b/scripts/ingest.py index 4834844..8c74fd0 100644 --- a/scripts/ingest.py +++ b/scripts/ingest.py @@ -120,7 +120,7 @@ def convert(dir: Optional[str] = typer.Option("inputs", if formats in extraction_functions: functions_dict, classes_dict = extraction_functions[formats](dir) else: - raise Exception("Sorry, language not supported yet") + raise Exception("Sorry, language not supported yet") transform_to_docs(functions_dict, classes_dict, formats, dir) From 3753f7d138e104c3ac043842c19482f335cea270 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 16:12:56 +0530 Subject: [PATCH 28/32] change the input outline border color --- frontend/src/conversation/ConversationTile.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/conversation/ConversationTile.tsx b/frontend/src/conversation/ConversationTile.tsx index b5cb755..592c52b 100644 --- a/frontend/src/conversation/ConversationTile.tsx +++ b/frontend/src/conversation/ConversationTile.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import Edit from '../assets/edit.svg'; import Exit from '../assets/exit.svg'; import Message from '../assets/message.svg'; -import CheckMark from '../assets/checkMark.svg'; +import CheckMark from '../assets/checkmark.svg'; import Trash from '../assets/trash.svg'; import { selectConversationId } from '../preferences/preferenceSlice'; @@ -82,7 +82,7 @@ export default function ConversationTile({ setConversationsName(e.target.value)} /> From 72481e845344f1c01e807ac73c939c475e95e5bc Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 16:16:20 +0530 Subject: [PATCH 29/32] Fix the post API issues --- application/api/user/routes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 9853f9a..fdff2e9 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -59,8 +59,8 @@ def update_conversation_name(): data = request.get_json() id = data["id"] name = data["name"] - conversation = conversations_collection.update_one({"_id": ObjectId(id)},{"$set":{"name":name}}) - return {"status": "ok","result":conversation} + conversations_collection.update_one({"_id": ObjectId(id)},{"$set":{"name":name}}) + return {"status": "ok"} @user.route("/api/feedback", methods=["POST"]) From c79ec45adb9ab3fedac84c005d1f4a8913f38297 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 16:16:56 +0530 Subject: [PATCH 30/32] Fix the lint issues --- frontend/src/About.tsx | 2 +- frontend/src/App.tsx | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/About.tsx b/frontend/src/About.tsx index ca318a6..fe26835 100644 --- a/frontend/src/About.tsx +++ b/frontend/src/About.tsx @@ -4,7 +4,7 @@ export default function About() { return (
-
+

About DocsGPT

πŸ¦–

diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ad9d72a..4454094 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -18,9 +18,7 @@ export default function App() {
From a998db057028aaa14e8688f32be60b83f64eee04 Mon Sep 17 00:00:00 2001 From: staticGuru Date: Mon, 9 Oct 2023 16:30:09 +0530 Subject: [PATCH 31/32] add fetch conversations in the delete callbacks --- frontend/src/Navigation.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index bf43cbd..7a55cd0 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -94,6 +94,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { ) as HTMLElement; const parentElement = imageElement.parentNode as HTMLElement; parentElement.parentNode?.removeChild(parentElement); + fetchConversations(); }) .catch((error) => console.error(error)); }; From cb0e4b6e870dde050c04673ce186817a62004d15 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 9 Oct 2023 15:37:40 +0100 Subject: [PATCH 32/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05a5feb..55b5448 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Say goodbye to time-consuming manual searches, and let