From 9b6c5ddba42431e6a6ee44e566ed52879e31d63e Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 10 Nov 2023 16:32:22 -0800 Subject: [PATCH 1/3] Update action row padding in cards on config page of web app --- src/khoj/interface/web/base_config.html | 12 +++++--- src/khoj/interface/web/config.html | 40 ++++++++++++------------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/khoj/interface/web/base_config.html b/src/khoj/interface/web/base_config.html index 309fdba6..05119fad 100644 --- a/src/khoj/interface/web/base_config.html +++ b/src/khoj/interface/web/base_config.html @@ -109,7 +109,7 @@ display: grid; grid-template-rows: repeat(3, 1fr); gap: 8px; - padding: 24px 16px; + padding: 24px 16px 8px; width: 320px; height: 180px; background: var(--background-color); @@ -162,10 +162,13 @@ color: grey; font-size: 16px; } - .card-button-row { + .card-description-row { + padding-top: 4px; + } + .card-action-row { display: grid; - grid-template-columns: auto; - text-align: right; + grid-auto-flow: row; + justify-content: left; } .card-button { border: none; @@ -287,6 +290,7 @@ select#chat-models { margin-bottom: 0; + padding: 8px; } diff --git a/src/khoj/interface/web/config.html b/src/khoj/interface/web/config.html index b2b7fbb3..34a4f642 100644 --- a/src/khoj/interface/web/config.html +++ b/src/khoj/interface/web/config.html @@ -29,12 +29,12 @@ {% endif %} - -
- +
+ +
@@ -61,13 +61,13 @@ {% endif %} -
-
- +
+ +
@@ -94,13 +94,13 @@ {% endif %} -
-
- +
+ +
From c9c0ba67c68812c31c678ae32d8c0120f93fa828 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 10 Nov 2023 17:29:23 -0800 Subject: [PATCH 2/3] Fix chat_client configurations for OpenAI chat director tests --- tests/conftest.py | 4 +++- tests/test_openai_chat_director.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 08ff7033..8cf0a391 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -235,7 +235,7 @@ def chat_client(search_config: SearchConfig, default_user2: KhojUser): OpenAIProcessorConversationConfigFactory() UserConversationProcessorConfigFactory(user=default_user2, setting=chat_model) - state.anonymous_mode = False + state.anonymous_mode = True app = FastAPI() @@ -253,7 +253,9 @@ def chat_client_no_background(search_config: SearchConfig, default_user2: KhojUs # Initialize Processor from Config if os.getenv("OPENAI_API_KEY"): + chat_model = ChatModelOptionsFactory(chat_model="gpt-3.5-turbo", model_type="openai") OpenAIProcessorConversationConfigFactory() + UserConversationProcessorConfigFactory(user=default_user2, setting=chat_model) state.anonymous_mode = True diff --git a/tests/test_openai_chat_director.py b/tests/test_openai_chat_director.py index 14a73f15..c7d2e0ec 100644 --- a/tests/test_openai_chat_director.py +++ b/tests/test_openai_chat_director.py @@ -307,6 +307,7 @@ def test_ask_for_clarification_if_not_enough_context_in_question(chat_client_no_ "which one is", "which of namita's sons", "the birth order", + "provide more context", ] assert response.status_code == 200 assert any([expected_response in response_message.lower() for expected_response in expected_responses]), ( From 45b8670c25bb6c17c7ef022b22eab6d949acf3eb Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Fri, 10 Nov 2023 17:34:19 -0800 Subject: [PATCH 3/3] Fix return type hint for generate_chat_response func --- src/khoj/routers/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/khoj/routers/helpers.py b/src/khoj/routers/helpers.py index 99c1b281..e2e62d96 100644 --- a/src/khoj/routers/helpers.py +++ b/src/khoj/routers/helpers.py @@ -2,7 +2,7 @@ import logging import asyncio from datetime import datetime from functools import partial -from typing import Iterator, List, Optional, Union +from typing import Iterator, List, Optional, Tuple, Union from concurrent.futures import ThreadPoolExecutor from fastapi import HTTPException, Request @@ -109,7 +109,7 @@ def generate_chat_response( inferred_queries: List[str] = [], conversation_command: ConversationCommand = ConversationCommand.Default, user: KhojUser = None, -) -> Union[ThreadedGenerator, Iterator[str]]: +) -> Tuple[Union[ThreadedGenerator, Iterator[str]], dict]: def _save_to_conversation_log( q: str, chat_response: str,