From 5b1f3c8d4ef4de6aa56488127b4378b1033985c3 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 3 Sep 2024 09:05:02 -0700 Subject: [PATCH] Formatting nits (#2311) * stream in all cases * update code block * code formatting nits * proper ports * proper ports * remove unnecessary lines --- backend/danswer/llm/answering/answer.py | 7 +++++++ web/src/app/chat/ChatPage.tsx | 1 - web/src/app/chat/message/Messages.tsx | 2 +- web/src/app/globals.css | 7 +++++++ web/tailwind-themes/tailwind.config.js | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/backend/danswer/llm/answering/answer.py b/backend/danswer/llm/answering/answer.py index 684b0aab7..7e7733cc0 100644 --- a/backend/danswer/llm/answering/answer.py +++ b/backend/danswer/llm/answering/answer.py @@ -248,6 +248,13 @@ class Answer: if self.is_cancelled: return yield cast(str, message.content) + if ( + message.additional_kwargs.get("usage_metadata", {}).get("stop") + == "length" + ): + yield StreamStopInfo( + stop_reason=StreamStopReason.CONTEXT_LENGTH + ) if not tool_call_chunk: return # no tool call needed diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 57c663af2..0c63ad216 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -99,7 +99,6 @@ import ExceptionTraceModal from "@/components/modals/ExceptionTraceModal"; import { SEARCH_TOOL_NAME } from "./tools/constants"; import { useUser } from "@/components/user/UserProvider"; -import { Stop } from "@phosphor-icons/react"; const TEMP_USER_MESSAGE_ID = -1; const TEMP_ASSISTANT_MESSAGE_ID = -2; diff --git a/web/src/app/chat/message/Messages.tsx b/web/src/app/chat/message/Messages.tsx index fa307ec93..ff177c6a6 100644 --- a/web/src/app/chat/message/Messages.tsx +++ b/web/src/app/chat/message/Messages.tsx @@ -364,7 +364,7 @@ export const AIMessage = ({ {typeof content === "string" ? ( -
+
li > p, +ul > li > p { + margin-top: 0; + margin-bottom: 0; + display: inline; /* Make paragraphs inline to reduce vertical space */ +} diff --git a/web/tailwind-themes/tailwind.config.js b/web/tailwind-themes/tailwind.config.js index f2d7601fd..1cac0c877 100644 --- a/web/tailwind-themes/tailwind.config.js +++ b/web/tailwind-themes/tailwind.config.js @@ -65,6 +65,7 @@ module.exports = { maxWidth: { "document-sidebar": "1000px", "message-max": "850px", + "content-max": "725px", "searchbar-max": "800px", }, colors: {