From 15f2bfcb6a5fac64cb5eb5e0d862b7668d628b4c Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Fri, 20 Sep 2024 13:25:06 -0700 Subject: [PATCH 1/7] cleaner initial chat screen --- backend/danswer/configs/app_configs.py | 2 +- .../docker_compose/docker-compose.dev.yml | 2 +- .../docker_compose/docker-compose.gpu-dev.yml | 2 +- .../docker-compose.search-testing.yml | 2 +- web/src/app/chat/ChatIntro.tsx | 159 ++++++++++-------- web/src/app/chat/ChatPage.tsx | 90 +++++----- web/src/app/chat/StarterMessage.tsx | 21 ++- .../components/assistants/AssistantCards.tsx | 53 ++++++ .../components/assistants/AssistantIcon.tsx | 30 +++- web/src/components/tooltip/CustomTooltip.tsx | 3 + 10 files changed, 234 insertions(+), 130 deletions(-) diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index 2dbe596b635..fe262c1f680 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -135,7 +135,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 5893fc2960f..0b58c5f5b70 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -293,7 +293,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index bc8bf10dffc..9063a23bb21 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -303,7 +303,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432:5432" + - "5433:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index a64b30f09d7..36b093fbae9 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -154,7 +154,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5432" + - "5433" volumes: - db_volume:/var/lib/postgresql/data diff --git a/web/src/app/chat/ChatIntro.tsx b/web/src/app/chat/ChatIntro.tsx index 3703655d7f9..44cfb976a09 100644 --- a/web/src/app/chat/ChatIntro.tsx +++ b/web/src/app/chat/ChatIntro.tsx @@ -4,6 +4,10 @@ import { Persona } from "../admin/assistants/interfaces"; import { Divider } from "@tremor/react"; import { FiBookmark, FiInfo } from "react-icons/fi"; import { HoverPopup } from "@/components/HoverPopup"; +import { AssistantIcon } from "@/components/assistants/AssistantIcon"; +import { CustomTooltip } from "@/components/tooltip/CustomTooltip"; +import { useState } from "react"; +import { DisplayAssistantCard } from "@/components/assistants/AssistantCards"; export function ChatIntro({ availableSources, @@ -12,86 +16,105 @@ export function ChatIntro({ availableSources: ValidSources[]; selectedPersona: Persona; }) { + const [hoveredAssistant, setHoveredAssistant] = useState(false); const availableSourceMetadata = getSourceMetadataForSources(availableSources); return ( <> -
-
-
-
-
- {selectedPersona?.name || "How can I help you today?"} +
+
+
+
+ {selectedPersona?.name || "How can I help you today?"} +
+
+
setHoveredAssistant(true)} + onMouseLeave={() => setHoveredAssistant(false)} + className="p-4 cursor-pointer border-dashed rounded-full flex border border-border border-2 border-dashed" + style={{ + borderStyle: "dashed", + borderWidth: "1.5px", + borderSpacing: "4px", + }} + > + +
+
+ {hoveredAssistant && ( + + )}
- {selectedPersona && ( -
{selectedPersona.description}
- )}
+
- {selectedPersona && selectedPersona.num_chunks !== 0 && ( - <> - -
- {selectedPersona.document_sets.length > 0 && ( -
-

- Knowledge Sets:{" "} -

-
- {selectedPersona.document_sets.map((documentSet) => ( -
- -
- -
- {documentSet.name} - - } - popupContent={ -
- -
- {documentSet.description} -
+ {selectedPersona && selectedPersona.num_chunks !== 0 && ( + <> + +
+ {selectedPersona.document_sets.length > 0 && ( +
+

+ Knowledge Sets:{" "} +

+
+ {selectedPersona.document_sets.map((documentSet) => ( +
+ +
+
- } - direction="top" - /> -
- ))} -
+ {documentSet.name} + + } + popupContent={ +
+ +
+ {documentSet.description} +
+
+ } + direction="top" + /> +
+ ))}
- )} +
+ )} - {availableSources.length > 0 && ( -
-

- Connected Sources:{" "} -

-
- {availableSourceMetadata.map((sourceMetadata) => ( - -
- {sourceMetadata.icon({})} -
-
- {sourceMetadata.displayName} -
-
- ))} -
+ {availableSources.length > 0 && ( +
+

+ Connected Sources:{" "} +

+
+ {availableSourceMetadata.map((sourceMetadata) => ( + +
+ {sourceMetadata.icon({})} +
+
+ {sourceMetadata.displayName} +
+
+ ))}
- )} -
- - )} -
+
+ )} +
+ + )}
); diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 403c40b3dc4..dae15768d8b 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -1925,7 +1925,7 @@ export function ChatPage({ {...getRootProps()} >
{/* ChatBanner is a custom banner that displays a admin-specified message at @@ -1935,11 +1935,52 @@ export function ChatPage({ !isFetchingChatMessages && currentSessionChatState == "input" && !loadingError && ( - +
+ + {currentPersona && + currentPersona.starter_messages && + currentPersona.starter_messages.length > 0 && + selectedAssistant && + messageHistory.length === 0 && + !isFetchingChatMessages && ( +
+ {currentPersona.starter_messages.map( + (starterMessage, i) => ( +
+ + onSubmit({ + messageOverride: + starterMessage.message, + }) + } + /> +
+ ) + )} +
+ )} +
)} +
)} - {currentPersona && - currentPersona.starter_messages && - currentPersona.starter_messages.length > 0 && - selectedAssistant && - messageHistory.length === 0 && - !isFetchingChatMessages && ( -
- {currentPersona.starter_messages.map( - (starterMessage, i) => ( -
- - onSubmit({ - messageOverride: - starterMessage.message, - }) - } - /> -
- ) - )} -
- )} {/* Some padding at the bottom so the search bar has space at the bottom to not cover the last message*/}
diff --git a/web/src/app/chat/StarterMessage.tsx b/web/src/app/chat/StarterMessage.tsx index f344739148f..bbdfef6a69b 100644 --- a/web/src/app/chat/StarterMessage.tsx +++ b/web/src/app/chat/StarterMessage.tsx @@ -1,21 +1,28 @@ -import { StarterMessage } from "../admin/assistants/interfaces"; +import { StarterMessage as StarterMessageType } from "../admin/assistants/interfaces"; +import { NewChatIcon } from "@/components/icons/icons"; export function StarterMessage({ starterMessage, onClick, }: { - starterMessage: StarterMessage; + starterMessage: StarterMessageType; onClick: () => void; }) { return (
-

{starterMessage.name}

-

{starterMessage.description}

+
+

+ {starterMessage.name} +

+
+

{starterMessage.description}

+
+
+ +
); } diff --git a/web/src/components/assistants/AssistantCards.tsx b/web/src/components/assistants/AssistantCards.tsx index 60c6ee24896..0d57d819ed9 100644 --- a/web/src/components/assistants/AssistantCards.tsx +++ b/web/src/components/assistants/AssistantCards.tsx @@ -115,3 +115,56 @@ export function DraggableAssistantCard(props: {
); } + +export function DisplayAssistantCard({ + selectedPersona, +}: { + selectedPersona: Persona; +}) { + return ( +
+
+ +

+ {selectedPersona.name} +

+
+

+ {selectedPersona.description} +

+ {selectedPersona.tools.length > 0 || + selectedPersona.llm_relevance_filter || + selectedPersona.llm_filter_extraction ? ( +
+

Capabilities:

+
    + {selectedPersona.tools.map((tool, index) => ( +
  • + {tool.name} +
  • + ))} + {selectedPersona.llm_relevance_filter && ( +
  • + Advanced Relevance + Filtering +
  • + )} + {selectedPersona.llm_filter_extraction && ( +
  • + Smart Information + Extraction +
  • + )} +
+
+ ) : ( +

+ No specific capabilities listed for this assistant. +

+ )} +
+ ); +} diff --git a/web/src/components/assistants/AssistantIcon.tsx b/web/src/components/assistants/AssistantIcon.tsx index 07ab05aa145..9bcb344d9c2 100644 --- a/web/src/components/assistants/AssistantIcon.tsx +++ b/web/src/components/assistants/AssistantIcon.tsx @@ -23,21 +23,29 @@ export function AssistantIcon({ assistant, size, border, + disableToolip, }: { assistant: Persona; - size?: "small" | "medium" | "large"; + size?: "small" | "medium" | "large" | "header"; border?: boolean; + disableToolip?: boolean; }) { const color = darkerGenerateColorFromId(assistant.id.toString()); return ( - + { // Prioritization order: image, graph, defaults assistant.uploaded_image_id ? ( @@ -45,20 +53,28 @@ export function AssistantIcon({
{createSVG( { encodedGrid: assistant.icon_shape, filledSquares: 0 }, assistant.icon_color, - size == "large" ? 36 : 24 + size === "large" + ? 40 + : size === "header" + ? 56 + : size === "medium" + ? 32 + : 24 )}
) : (
) diff --git a/web/src/components/tooltip/CustomTooltip.tsx b/web/src/components/tooltip/CustomTooltip.tsx index 2f4ca2d1254..f5f0c9dda97 100644 --- a/web/src/components/tooltip/CustomTooltip.tsx +++ b/web/src/components/tooltip/CustomTooltip.tsx @@ -46,6 +46,7 @@ export const CustomTooltip = ({ showTick = false, delay = 500, position = "bottom", + disabled, }: { medium?: boolean; content: string | ReactNode; @@ -58,6 +59,7 @@ export const CustomTooltip = ({ wrap?: boolean; citation?: boolean; position?: "top" | "bottom"; + disabled?: boolean; }) => { const [isVisible, setIsVisible] = useState(false); const [tooltipPosition, setTooltipPosition] = useState({ top: 0, left: 0 }); @@ -119,6 +121,7 @@ export const CustomTooltip = ({ {children} {isVisible && + !disabled && createPortal(
Date: Fri, 20 Sep 2024 13:33:34 -0700 Subject: [PATCH 2/7] slightly cleaner animation --- web/src/app/chat/StarterMessage.tsx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/web/src/app/chat/StarterMessage.tsx b/web/src/app/chat/StarterMessage.tsx index bbdfef6a69b..7bc3a90d8ce 100644 --- a/web/src/app/chat/StarterMessage.tsx +++ b/web/src/app/chat/StarterMessage.tsx @@ -1,5 +1,6 @@ import { StarterMessage as StarterMessageType } from "../admin/assistants/interfaces"; import { NewChatIcon } from "@/components/icons/icons"; +import { useState, useEffect } from "react"; export function StarterMessage({ starterMessage, @@ -8,16 +9,37 @@ export function StarterMessage({ starterMessage: StarterMessageType; onClick: () => void; }) { + const [showText, setShowText] = useState(false); + const [hideText, setHideText] = useState(false); + + useEffect(() => { + const timer = setTimeout(() => { + setShowText(true); + }, 1000); // Slightly after the showing animation + + return () => clearTimeout(timer); + }, []); + return (
{ + setTimeout(() => { + setHideText(true); + }, 100); + setTimeout(() => { + setHideText(false); + }, 600); + }} + className="group relative overflow-hidden rounded-lg border border-border bg-gradient-to-br from-background-50 to-background p-4 shadow-sm mobile:transition-none mobile:duration-0 transition-all duration-300 mobile:hover:shadow-none mobile:hover:scale-100 hover:shadow-md hover:scale-[1.02] cursor-pointer" onClick={onClick} >

{starterMessage.name}

-
+

{starterMessage.description}

From 8325571193ca87870e4682839387c6518ac9b369 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Fri, 20 Sep 2024 13:38:04 -0700 Subject: [PATCH 3/7] cleaner cards --- .../components/assistants/AssistantCards.tsx | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/web/src/components/assistants/AssistantCards.tsx b/web/src/components/assistants/AssistantCards.tsx index 0d57d819ed9..879f4898edd 100644 --- a/web/src/components/assistants/AssistantCards.tsx +++ b/web/src/components/assistants/AssistantCards.tsx @@ -122,46 +122,51 @@ export function DisplayAssistantCard({ selectedPersona: Persona; }) { return ( -
-
- -

+
+
+ +

{selectedPersona.name}

-

+

{selectedPersona.description}

{selectedPersona.tools.length > 0 || selectedPersona.llm_relevance_filter || selectedPersona.llm_filter_extraction ? (
-

Capabilities:

+

Capabilities:

    {selectedPersona.tools.map((tool, index) => (
  • - {tool.name} + {" "} + {tool.name}
  • ))} {selectedPersona.llm_relevance_filter && (
  • - Advanced Relevance - Filtering + {" "} + Advanced Relevance Filtering
  • )} {selectedPersona.llm_filter_extraction && (
  • - Smart Information - Extraction + Smart + Information Extraction
  • )}
) : ( -

+

No specific capabilities listed for this assistant.

)} From 4dab7877c70a3caf7a896224e9f7145a663b7aa8 Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Fri, 20 Sep 2024 19:40:40 -0700 Subject: [PATCH 4/7] use display name + minor updates to models --- backend/danswer/db/persona.py | 2 ++ backend/danswer/server/features/persona/api.py | 6 +++++- web/src/app/assistants/gallery/AssistantsGallery.tsx | 1 + web/src/app/chat/ChatPage.tsx | 1 + web/src/components/assistants/AssistantCards.tsx | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/danswer/db/persona.py b/backend/danswer/db/persona.py index 36d2d25c402..02d840e2189 100644 --- a/backend/danswer/db/persona.py +++ b/backend/danswer/db/persona.py @@ -256,6 +256,7 @@ def get_personas( include_deleted: bool = False, joinedload_all: bool = False, ) -> Sequence[Persona]: + print("Executing query to fetch personas:") stmt = select(Persona).distinct() stmt = _add_user_filters(stmt=stmt, user=user, get_editable=get_editable) @@ -265,6 +266,7 @@ def get_personas( stmt = stmt.where(not_(Persona.name.startswith(SLACK_BOT_PERSONA_PREFIX))) if not include_deleted: stmt = stmt.where(Persona.deleted.is_(False)) + print(stmt) if joinedload_all: stmt = stmt.options( diff --git a/backend/danswer/server/features/persona/api.py b/backend/danswer/server/features/persona/api.py index bcc4800b860..21df4eab468 100644 --- a/backend/danswer/server/features/persona/api.py +++ b/backend/danswer/server/features/persona/api.py @@ -217,7 +217,9 @@ def list_personas( db_session: Session = Depends(get_session), include_deleted: bool = False, ) -> list[PersonaSnapshot]: - return [ + print("getting perosnas") + + personas = [ PersonaSnapshot.from_model(persona) for persona in get_personas( user=user, @@ -227,6 +229,8 @@ def list_personas( joinedload_all=True, ) ] + print(len(personas)) + return personas @basic_router.get("/{persona_id}") diff --git a/web/src/app/assistants/gallery/AssistantsGallery.tsx b/web/src/app/assistants/gallery/AssistantsGallery.tsx index 8926238b454..08fc09b0ca0 100644 --- a/web/src/app/assistants/gallery/AssistantsGallery.tsx +++ b/web/src/app/assistants/gallery/AssistantsGallery.tsx @@ -154,6 +154,7 @@ export function AssistantsGallery({ user, assistants ); + console.log(assistants); const defaultAssistants = assistants .filter((assistant) => assistant.is_default_persona) diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index dae15768d8b..5ea2a4f2a8a 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -1669,6 +1669,7 @@ export function ChatPage({ mostVisibleMessageId: null, }; + console.log(availableAssistants); useEffect(() => { const includes = checkAnyAssistantHasSearch( messageHistory, diff --git a/web/src/components/assistants/AssistantCards.tsx b/web/src/components/assistants/AssistantCards.tsx index 879f4898edd..0317f50743b 100644 --- a/web/src/components/assistants/AssistantCards.tsx +++ b/web/src/components/assistants/AssistantCards.tsx @@ -141,14 +141,14 @@ export function DisplayAssistantCard({ selectedPersona.llm_filter_extraction ? (

Capabilities:

-
    +
      {selectedPersona.tools.map((tool, index) => (
    • {" "} - {tool.name} + {tool.display_name}
    • ))} {selectedPersona.llm_relevance_filter && ( From 40415237df108b5dc81fb194abfdbedc9c130bef Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Fri, 20 Sep 2024 19:41:22 -0700 Subject: [PATCH 5/7] remove prints --- backend/danswer/server/features/persona/api.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backend/danswer/server/features/persona/api.py b/backend/danswer/server/features/persona/api.py index 21df4eab468..bcc4800b860 100644 --- a/backend/danswer/server/features/persona/api.py +++ b/backend/danswer/server/features/persona/api.py @@ -217,9 +217,7 @@ def list_personas( db_session: Session = Depends(get_session), include_deleted: bool = False, ) -> list[PersonaSnapshot]: - print("getting perosnas") - - personas = [ + return [ PersonaSnapshot.from_model(persona) for persona in get_personas( user=user, @@ -229,8 +227,6 @@ def list_personas( joinedload_all=True, ) ] - print(len(personas)) - return personas @basic_router.get("/{persona_id}") From e8ba4ac39f40bf37521c9a27d62a9d1bcf9d032d Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Sat, 21 Sep 2024 17:56:11 -0700 Subject: [PATCH 6/7] minor udpate to ui --- backend/danswer/chat/personas.yaml | 53 +++++++++++++++- backend/danswer/configs/app_configs.py | 2 +- backend/danswer/db/persona.py | 5 +- .../docker_compose/docker-compose.dev.yml | 2 +- .../docker_compose/docker-compose.gpu-dev.yml | 2 +- .../docker-compose.search-testing.yml | 2 +- .../app/admin/assistants/AssistantEditor.tsx | 4 ++ web/src/app/chat/ChatPage.tsx | 63 +++++++++---------- web/src/app/chat/StarterMessage.tsx | 44 +++++-------- 9 files changed, 109 insertions(+), 68 deletions(-) diff --git a/backend/danswer/chat/personas.yaml b/backend/danswer/chat/personas.yaml index 0aececcee6c..b92802b35bb 100644 --- a/backend/danswer/chat/personas.yaml +++ b/backend/danswer/chat/personas.yaml @@ -41,6 +41,19 @@ personas: icon_color: "#6FB1FF" display_priority: 1 is_visible: true + starter_messages: + - name: "General Information" + description: "Ask about available information" + message: "Hello! I'm interested in learning more about the information available here. Could you give me an overview of the types of data or documents that might be accessible?" + - name: "Specific Topic Search" + description: "Find information on a particular subject" + message: "Hi there! I'm looking for information on a specific topic. How can I best search for detailed information about [insert your topic of interest]?" + - name: "Recent Updates" + description: "Inquire about latest additions" + message: "Hello! I'm curious about any recent updates or additions to the knowledge base. Can you tell me what new information has been added lately?" + - name: "Cross-referencing Information" + description: "Connect information from different sources" + message: "Hi! I'm working on a project that requires connecting information from multiple sources. How can I effectively cross-reference data across different documents or categories?" - id: 1 name: "General" @@ -57,6 +70,19 @@ personas: icon_color: "#FF6F6F" display_priority: 0 is_visible: true + starter_messages: + - name: "Open Discussion" + description: "Start an open-ended conversation" + message: "Hi there! I'm interested in having a discussion about recent advancements in artificial intelligence. What are some key developments you think are worth exploring?" + - name: "Problem Solving" + description: "Get help with a challenge" + message: "Hello! I'm facing a challenge with time management in my daily work. Do you have any strategies or techniques you could suggest to help me improve my productivity?" + - name: "Learn Something New" + description: "Explore a new topic" + message: "Hi! I've been hearing a lot about quantum computing lately, but I don't really understand it. Could you give me an introduction to the basic concepts?" + - name: "Creative Brainstorming" + description: "Generate creative ideas" + message: "Hello! I'm trying to come up with ideas for a new mobile app that helps people reduce their carbon footprint. Do you have any suggestions or innovative features we could consider?" - id: 2 name: "Paraphrase" @@ -73,7 +99,19 @@ personas: icon_color: "#6FFF8D" display_priority: 2 is_visible: false - + starter_messages: + - name: "Document Search" + description: "Find specific information" + message: "Hi, I'm looking for information about our company's mission statement. Can you find the exact wording from our official documents?" + - name: "Policy Verification" + description: "Check company policies" + message: "Hello! I need to verify our company's policy on remote work. Can you find and quote the specific section that outlines this policy?" + - name: "Technical Specifications" + description: "Retrieve technical details" + message: "Hi there! I need the exact system requirements for our main software product. Can you locate and provide the full list from our technical documentation?" + - name: "Legal Clause Lookup" + description: "Find legal information" + message: "Hello! I'm trying to find the exact wording of our data privacy policy in our terms of service. Can you locate and quote the relevant clause?" - id: 3 name: "Art" @@ -91,3 +129,16 @@ personas: image_generation: true display_priority: 3 is_visible: true + starter_messages: + - name: "Landscape" + description: "Generate a landscape image" + message: "Create an image of a serene mountain lake at sunset, with snow-capped peaks reflected in the calm water and a small wooden cabin on the shore." + - name: "Character" + description: "Generate a character image" + message: "Generate an image of a futuristic robot with glowing blue eyes, sleek metallic body, and intricate circuitry visible through transparent panels on its chest and arms." + - name: "Abstract" + description: "Create an abstract image" + message: "Create an abstract image representing the concept of time, using swirling clock hands, fragmented hourglasses, and streaks of light to convey the passage of moments and eras." + - name: "Urban Scene" + description: "Generate an urban landscape" + message: "Generate an image of a bustling futuristic cityscape at night, with towering skyscrapers, flying vehicles, holographic advertisements, and a mix of neon and bioluminescent lighting." diff --git a/backend/danswer/configs/app_configs.py b/backend/danswer/configs/app_configs.py index fe262c1f680..2dbe596b635 100644 --- a/backend/danswer/configs/app_configs.py +++ b/backend/danswer/configs/app_configs.py @@ -135,7 +135,7 @@ os.environ.get("POSTGRES_PASSWORD") or "password" ) POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost" -POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433" +POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432" POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres" # defaults to False diff --git a/backend/danswer/db/persona.py b/backend/danswer/db/persona.py index 02d840e2189..c04b40139b6 100644 --- a/backend/danswer/db/persona.py +++ b/backend/danswer/db/persona.py @@ -256,7 +256,6 @@ def get_personas( include_deleted: bool = False, joinedload_all: bool = False, ) -> Sequence[Persona]: - print("Executing query to fetch personas:") stmt = select(Persona).distinct() stmt = _add_user_filters(stmt=stmt, user=user, get_editable=get_editable) @@ -266,7 +265,6 @@ def get_personas( stmt = stmt.where(not_(Persona.name.startswith(SLACK_BOT_PERSONA_PREFIX))) if not include_deleted: stmt = stmt.where(Persona.deleted.is_(False)) - print(stmt) if joinedload_all: stmt = stmt.options( @@ -423,6 +421,9 @@ def upsert_persona( chunks_above: int = CONTEXT_CHUNKS_ABOVE, chunks_below: int = CONTEXT_CHUNKS_BELOW, ) -> Persona: + print("upserting with ") + print(starter_messages) + print("-----\n\n\n") if persona_id is not None: persona = db_session.query(Persona).filter_by(id=persona_id).first() else: diff --git a/deployment/docker_compose/docker-compose.dev.yml b/deployment/docker_compose/docker-compose.dev.yml index 0b58c5f5b70..5893fc2960f 100644 --- a/deployment/docker_compose/docker-compose.dev.yml +++ b/deployment/docker_compose/docker-compose.dev.yml @@ -293,7 +293,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.gpu-dev.yml b/deployment/docker_compose/docker-compose.gpu-dev.yml index 9063a23bb21..bc8bf10dffc 100644 --- a/deployment/docker_compose/docker-compose.gpu-dev.yml +++ b/deployment/docker_compose/docker-compose.gpu-dev.yml @@ -303,7 +303,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433:5432" + - "5432:5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/deployment/docker_compose/docker-compose.search-testing.yml b/deployment/docker_compose/docker-compose.search-testing.yml index 36b093fbae9..a64b30f09d7 100644 --- a/deployment/docker_compose/docker-compose.search-testing.yml +++ b/deployment/docker_compose/docker-compose.search-testing.yml @@ -154,7 +154,7 @@ services: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password} ports: - - "5433" + - "5432" volumes: - db_volume:/var/lib/postgresql/data diff --git a/web/src/app/admin/assistants/AssistantEditor.tsx b/web/src/app/admin/assistants/AssistantEditor.tsx index 1f961614dbc..067cca49b8a 100644 --- a/web/src/app/admin/assistants/AssistantEditor.tsx +++ b/web/src/app/admin/assistants/AssistantEditor.tsx @@ -1048,6 +1048,10 @@ export function AssistantEditor({ Starter Messages (Optional){" "}
+ + Add pre-defined messages to help users get started. Only + the first 4 will be displayed. + - {currentPersona && - currentPersona.starter_messages && - currentPersona.starter_messages.length > 0 && - selectedAssistant && - messageHistory.length === 0 && - !isFetchingChatMessages && ( -
- {currentPersona.starter_messages.map( - (starterMessage, i) => ( -
- - onSubmit({ - messageOverride: - starterMessage.message, - }) - } - /> -
- ) - )} -
- )} + > + {currentPersona?.starter_messages && + currentPersona.starter_messages.length > + 0 && + currentPersona.starter_messages + .slice(0, 4) + .map((starterMessage, i) => ( +
+ + onSubmit({ + messageOverride: + starterMessage.message, + }) + } + /> +
+ ))} +

)} diff --git a/web/src/app/chat/StarterMessage.tsx b/web/src/app/chat/StarterMessage.tsx index 7bc3a90d8ce..082b21540aa 100644 --- a/web/src/app/chat/StarterMessage.tsx +++ b/web/src/app/chat/StarterMessage.tsx @@ -1,6 +1,6 @@ import { StarterMessage as StarterMessageType } from "../admin/assistants/interfaces"; -import { NewChatIcon } from "@/components/icons/icons"; -import { useState, useEffect } from "react"; +import { NewChatIcon, SendIcon } from "@/components/icons/icons"; +import { useState } from "react"; export function StarterMessage({ starterMessage, @@ -9,41 +9,31 @@ export function StarterMessage({ starterMessage: StarterMessageType; onClick: () => void; }) { - const [showText, setShowText] = useState(false); - const [hideText, setHideText] = useState(false); - - useEffect(() => { - const timer = setTimeout(() => { - setShowText(true); - }, 1000); // Slightly after the showing animation - - return () => clearTimeout(timer); - }, []); + const [isHovered, setIsHovered] = useState(false); return (
{ - setTimeout(() => { - setHideText(true); - }, 100); - setTimeout(() => { - setHideText(false); - }, 600); - }} - className="group relative overflow-hidden rounded-lg border border-border bg-gradient-to-br from-background-50 to-background p-4 shadow-sm mobile:transition-none mobile:duration-0 transition-all duration-300 mobile:hover:shadow-none mobile:hover:scale-100 hover:shadow-md hover:scale-[1.02] cursor-pointer" + className="mx-2 group relative overflow-hidden rounded-lg border border-border bg-gradient-to-br from-white to-background p-4 shadow-sm transition-all duration-300 hover:shadow-md hover:scale-[1.01] cursor-pointer" onClick={onClick} + onMouseEnter={() => setIsHovered(true)} + onMouseLeave={() => setIsHovered(false)} > -
-

+
+

{starterMessage.name}

-

{starterMessage.description}

+

+ {starterMessage.description} +

-
- +
+
); From f574a4452b8490bafcb1c8d13027e2365217756b Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Sat, 21 Sep 2024 17:57:45 -0700 Subject: [PATCH 7/7] remove logs --- backend/danswer/db/persona.py | 3 --- web/src/app/assistants/gallery/AssistantsGallery.tsx | 1 - web/src/app/chat/ChatPage.tsx | 1 - 3 files changed, 5 deletions(-) diff --git a/backend/danswer/db/persona.py b/backend/danswer/db/persona.py index c04b40139b6..36d2d25c402 100644 --- a/backend/danswer/db/persona.py +++ b/backend/danswer/db/persona.py @@ -421,9 +421,6 @@ def upsert_persona( chunks_above: int = CONTEXT_CHUNKS_ABOVE, chunks_below: int = CONTEXT_CHUNKS_BELOW, ) -> Persona: - print("upserting with ") - print(starter_messages) - print("-----\n\n\n") if persona_id is not None: persona = db_session.query(Persona).filter_by(id=persona_id).first() else: diff --git a/web/src/app/assistants/gallery/AssistantsGallery.tsx b/web/src/app/assistants/gallery/AssistantsGallery.tsx index 08fc09b0ca0..8926238b454 100644 --- a/web/src/app/assistants/gallery/AssistantsGallery.tsx +++ b/web/src/app/assistants/gallery/AssistantsGallery.tsx @@ -154,7 +154,6 @@ export function AssistantsGallery({ user, assistants ); - console.log(assistants); const defaultAssistants = assistants .filter((assistant) => assistant.is_default_persona) diff --git a/web/src/app/chat/ChatPage.tsx b/web/src/app/chat/ChatPage.tsx index 8ec6d7e91d7..0d3c0484b79 100644 --- a/web/src/app/chat/ChatPage.tsx +++ b/web/src/app/chat/ChatPage.tsx @@ -1669,7 +1669,6 @@ export function ChatPage({ mostVisibleMessageId: null, }; - console.log(availableAssistants); useEffect(() => { const includes = checkAnyAssistantHasSearch( messageHistory,