From 7919787fb7ddca24d6c68036bce0b1a6604165bf Mon Sep 17 00:00:00 2001 From: Debanjum Date: Sat, 26 Aug 2023 18:11:18 -0700 Subject: [PATCH] Use Slash Commands and Add Notes Slash Command (#463) * Store conversation command options in an Enum * Move to slash commands instead of using @ to specify general commands * Calculate conversation command once & pass it as arg to child funcs * Add /notes command to respond using only knowledge base as context This prevents the chat model to try respond using it's general world knowledge only without any references pulled from the indexed knowledge base * Test general and notes slash commands in openai chat director tests * Update gpt4all tests to use md configuration * Add a /help tooltip * Add dynamic support for describing slash commands. Remove default and treat notes as the default type --------- Co-authored-by: sabaimran --- src/khoj/interface/web/chat.html | 54 ++++++++++++++++++- src/khoj/interface/web/index.html | 2 +- src/khoj/main.py | 2 + .../conversation/gpt4all/chat_model.py | 10 ++-- src/khoj/processor/conversation/openai/gpt.py | 6 ++- src/khoj/processor/conversation/prompts.py | 19 +++++++ src/khoj/routers/api.py | 49 +++++++++++++++-- src/khoj/routers/helpers.py | 29 +++++++--- src/khoj/utils/helpers.py | 14 +++++ src/khoj/utils/state.py | 1 + tests/conftest.py | 21 ++++---- tests/test_client.py | 4 +- tests/test_gpt4all_chat_director.py | 6 ++- tests/test_openai_chat_director.py | 53 ++++++++++++++++++ 14 files changed, 237 insertions(+), 33 deletions(-) diff --git a/src/khoj/interface/web/chat.html b/src/khoj/interface/web/chat.html index 4450646b..c5f4b703 100644 --- a/src/khoj/interface/web/chat.html +++ b/src/khoj/interface/web/chat.html @@ -9,6 +9,7 @@