mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-15 15:43:16 +02:00
Minor search formatting updates (#2276)
This commit is contained in:
@ -11,6 +11,7 @@ class EnterpriseSettings(BaseModel):
|
|||||||
use_custom_logotype: bool = False
|
use_custom_logotype: bool = False
|
||||||
|
|
||||||
# custom Chat components
|
# custom Chat components
|
||||||
|
two_lines_for_chat_header: bool | None = None
|
||||||
custom_lower_disclaimer_content: str | None = None
|
custom_lower_disclaimer_content: str | None = None
|
||||||
custom_header_content: str | None = None
|
custom_header_content: str | None = None
|
||||||
custom_popup_header: str | None = None
|
custom_popup_header: str | None = None
|
||||||
|
@ -23,6 +23,7 @@ export interface EnterpriseSettings {
|
|||||||
// custom Chat components
|
// custom Chat components
|
||||||
custom_lower_disclaimer_content: string | null;
|
custom_lower_disclaimer_content: string | null;
|
||||||
custom_header_content: string | null;
|
custom_header_content: string | null;
|
||||||
|
two_lines_for_chat_header: boolean | null;
|
||||||
custom_popup_header: string | null;
|
custom_popup_header: string | null;
|
||||||
custom_popup_content: string | null;
|
custom_popup_content: string | null;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ export function ChatBanner() {
|
|||||||
w-full
|
w-full
|
||||||
mx-auto
|
mx-auto
|
||||||
relative
|
relative
|
||||||
|
cursor-default
|
||||||
shadow-sm
|
shadow-sm
|
||||||
rounded
|
rounded
|
||||||
border-l-8 border-l-400
|
border-l-8 border-l-400
|
||||||
@ -53,7 +54,7 @@ export function ChatBanner() {
|
|||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div
|
<div
|
||||||
ref={contentRef}
|
ref={contentRef}
|
||||||
className="line-clamp-2 text-center w-full overflow-hidden pr-8"
|
className={`${settings.enterpriseSettings.two_lines_for_chat_header ? "line-clamp-2" : "line-clamp-1"} text-center w-full overflow-hidden pr-8`}
|
||||||
>
|
>
|
||||||
<MinimalMarkdown
|
<MinimalMarkdown
|
||||||
content={settings.enterpriseSettings.custom_header_content}
|
content={settings.enterpriseSettings.custom_header_content}
|
||||||
|
@ -249,6 +249,7 @@ export function ChatPage({
|
|||||||
|
|
||||||
updateChatState("input", currentSession);
|
updateChatState("input", currentSession);
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is for "@"ing assistants
|
// this is for "@"ing assistants
|
||||||
|
|
||||||
// this is used to track which assistant is being used to generate the current message
|
// this is used to track which assistant is being used to generate the current message
|
||||||
@ -1723,8 +1724,12 @@ export function ChatPage({
|
|||||||
)}
|
)}
|
||||||
<div
|
<div
|
||||||
className={
|
className={
|
||||||
"mt-4 -ml-4 w-full mx-auto " +
|
"-ml-4 w-full mx-auto " +
|
||||||
"absolute mobile:top-0 desktop:top-12 left-0 " +
|
"absolute mobile:top-0 desktop:top-12 left-0 " +
|
||||||
|
(settings?.enterpriseSettings
|
||||||
|
?.two_lines_for_chat_header
|
||||||
|
? "mt-20 "
|
||||||
|
: "mt-8") +
|
||||||
(hasPerformedInitialScroll ? "" : "invisible")
|
(hasPerformedInitialScroll ? "" : "invisible")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -21,11 +21,11 @@ export default function FixedLogo() {
|
|||||||
}
|
}
|
||||||
className="fixed cursor-pointer flex z-40 left-2.5 top-2"
|
className="fixed cursor-pointer flex z-40 left-2.5 top-2"
|
||||||
>
|
>
|
||||||
<div className="max-w-[200px] mobile:hidden flex items-center gap-x-1 my-auto">
|
<div className="max-w-[175px] mobile:hidden flex items-center gap-x-1 my-auto">
|
||||||
<div className="flex-none my-auto">
|
<div className="flex-none my-auto">
|
||||||
<Logo height={24} width={24} />
|
<Logo height={24} width={24} />
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div className="w-full">
|
||||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||||
<div>
|
<div>
|
||||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||||
|
@ -122,6 +122,8 @@ export default function FunctionalWrapper({
|
|||||||
const settings = combinedSettings?.settings;
|
const settings = combinedSettings?.settings;
|
||||||
const chatBannerPresent =
|
const chatBannerPresent =
|
||||||
combinedSettings?.enterpriseSettings?.custom_header_content;
|
combinedSettings?.enterpriseSettings?.custom_header_content;
|
||||||
|
const twoLines =
|
||||||
|
combinedSettings?.enterpriseSettings?.two_lines_for_chat_header;
|
||||||
|
|
||||||
const [toggledSidebar, setToggledSidebar] = useState(initiallyToggled);
|
const [toggledSidebar, setToggledSidebar] = useState(initiallyToggled);
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ export default function FunctionalWrapper({
|
|||||||
{(!settings ||
|
{(!settings ||
|
||||||
(settings.search_page_enabled && settings.chat_page_enabled)) && (
|
(settings.search_page_enabled && settings.chat_page_enabled)) && (
|
||||||
<div
|
<div
|
||||||
className={`mobile:hidden z-30 flex fixed ${chatBannerPresent ? "top-20" : "top-4"} left-1/2 transform -translate-x-1/2`}
|
className={`mobile:hidden z-30 flex fixed ${chatBannerPresent ? (twoLines ? "top-20" : "top-14") : "top-4"} left-1/2 transform -translate-x-1/2`}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={{ transition: "width 0.30s ease-out" }}
|
style={{ transition: "width 0.30s ease-out" }}
|
||||||
|
@ -7,6 +7,7 @@ import { SettingsContext } from "@/components/settings/SettingsProvider";
|
|||||||
import { Form, Formik } from "formik";
|
import { Form, Formik } from "formik";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import {
|
import {
|
||||||
|
BooleanFormField,
|
||||||
Label,
|
Label,
|
||||||
SubLabel,
|
SubLabel,
|
||||||
TextFormField,
|
TextFormField,
|
||||||
@ -55,7 +56,8 @@ export function WhitelabelingForm() {
|
|||||||
application_name: enterpriseSettings?.application_name || null,
|
application_name: enterpriseSettings?.application_name || null,
|
||||||
use_custom_logo: enterpriseSettings?.use_custom_logo || false,
|
use_custom_logo: enterpriseSettings?.use_custom_logo || false,
|
||||||
use_custom_logotype: enterpriseSettings?.use_custom_logotype || false,
|
use_custom_logotype: enterpriseSettings?.use_custom_logotype || false,
|
||||||
|
two_lines_for_chat_header:
|
||||||
|
enterpriseSettings?.two_lines_for_chat_header || false,
|
||||||
custom_header_content:
|
custom_header_content:
|
||||||
enterpriseSettings?.custom_header_content || "",
|
enterpriseSettings?.custom_header_content || "",
|
||||||
custom_popup_header: enterpriseSettings?.custom_popup_header || "",
|
custom_popup_header: enterpriseSettings?.custom_popup_header || "",
|
||||||
@ -68,6 +70,7 @@ export function WhitelabelingForm() {
|
|||||||
use_custom_logo: Yup.boolean().required(),
|
use_custom_logo: Yup.boolean().required(),
|
||||||
use_custom_logotype: Yup.boolean().required(),
|
use_custom_logotype: Yup.boolean().required(),
|
||||||
custom_header_content: Yup.string().nullable(),
|
custom_header_content: Yup.string().nullable(),
|
||||||
|
two_lines_for_chat_header: Yup.boolean().nullable(),
|
||||||
custom_popup_header: Yup.string().nullable(),
|
custom_popup_header: Yup.string().nullable(),
|
||||||
custom_popup_content: Yup.string().nullable(),
|
custom_popup_content: Yup.string().nullable(),
|
||||||
custom_lower_disclaimer_content: Yup.string().nullable(),
|
custom_lower_disclaimer_content: Yup.string().nullable(),
|
||||||
@ -204,6 +207,12 @@ export function WhitelabelingForm() {
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<BooleanFormField
|
||||||
|
name="two_lines_for_chat_header"
|
||||||
|
label="Two lines for chat header?"
|
||||||
|
subtext="If enabled, the chat header will be displayed on two lines instead of one."
|
||||||
|
/>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<TextFormField
|
<TextFormField
|
||||||
|
@ -15,9 +15,7 @@ import { buildClientUrl } from "@/lib/utilsSS";
|
|||||||
import { Inter } from "next/font/google";
|
import { Inter } from "next/font/google";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { EnterpriseSettings } from "./admin/settings/interfaces";
|
import { EnterpriseSettings } from "./admin/settings/interfaces";
|
||||||
import { redirect } from "next/navigation";
|
import { Card } from "@tremor/react";
|
||||||
import { Button, Card } from "@tremor/react";
|
|
||||||
import LogoType from "@/components/header/LogoType";
|
|
||||||
import { HeaderTitle } from "@/components/header/HeaderTitle";
|
import { HeaderTitle } from "@/components/header/HeaderTitle";
|
||||||
import { Logo } from "@/components/Logo";
|
import { Logo } from "@/components/Logo";
|
||||||
import { UserProvider } from "@/components/user/UserProvider";
|
import { UserProvider } from "@/components/user/UserProvider";
|
||||||
|
@ -48,13 +48,13 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) {
|
|||||||
: "/search"
|
: "/search"
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="max-w-[200px] flex gap-x-1 my-auto">
|
<div className="max-w-[200px] w-full flex gap-x-1 my-auto">
|
||||||
<div className="flex-none mb-auto">
|
<div className="flex-none mb-auto">
|
||||||
<Logo />
|
<Logo />
|
||||||
</div>
|
</div>
|
||||||
<div className="my-auto">
|
<div className="flex-grow min-w-0 my-auto">
|
||||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||||
<div>
|
<div className="w-full">
|
||||||
<HeaderTitle>
|
<HeaderTitle>
|
||||||
{enterpriseSettings.application_name}
|
{enterpriseSettings.application_name}
|
||||||
</HeaderTitle>
|
</HeaderTitle>
|
||||||
@ -75,8 +75,8 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) {
|
|||||||
<div className="flex w-full justify-center">
|
<div className="flex w-full justify-center">
|
||||||
<Link href={"/chat"}>
|
<Link href={"/chat"}>
|
||||||
<button className="text-sm block w-52 py-2.5 flex px-2 text-left bg-background-200 hover:bg-background-200/80 cursor-pointer rounded">
|
<button className="text-sm block w-52 py-2.5 flex px-2 text-left bg-background-200 hover:bg-background-200/80 cursor-pointer rounded">
|
||||||
<BackIcon size={20} className="text-neutral" />
|
<BackIcon size={20} />
|
||||||
<p className="ml-1">
|
<p className="ml-1 break-words line-clamp-2 ellipsis leading-none">
|
||||||
Back to{" "}
|
Back to{" "}
|
||||||
{combinedSettings.enterpriseSettings?.application_name ||
|
{combinedSettings.enterpriseSettings?.application_name ||
|
||||||
"Danswer"}
|
"Danswer"}
|
||||||
|
@ -64,7 +64,7 @@ export default function FunctionalHeader({
|
|||||||
router.push(newChatUrl);
|
router.push(newChatUrl);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className="left-0 sticky top-0 z-20 w-full relative flex">
|
<div className="left-0 h-0 sticky top-0 z-20 w-full relative flex">
|
||||||
<div className="mt-2 mx-2.5 cursor-pointer text-text-700 relative flex w-full">
|
<div className="mt-2 mx-2.5 cursor-pointer text-text-700 relative flex w-full">
|
||||||
<LogoType
|
<LogoType
|
||||||
assistantId={currentChatSession?.persona_id}
|
assistantId={currentChatSession?.persona_id}
|
||||||
|
@ -7,7 +7,9 @@ export function HeaderTitle({ children }: { children: JSX.Element | string }) {
|
|||||||
const textSize = isString && children.length > 10 ? "text-xl" : "text-2xl";
|
const textSize = isString && children.length > 10 ? "text-xl" : "text-2xl";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<h1 className={`flex ${textSize} text-strong leading-none font-bold`}>
|
<h1
|
||||||
|
className={`${textSize} break-words line-clamp-2 ellipsis text-strong leading-none font-bold`}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</h1>
|
</h1>
|
||||||
);
|
);
|
||||||
|
@ -56,7 +56,7 @@ export default function LogoType({
|
|||||||
>
|
>
|
||||||
<div className="max-w-[175px]">
|
<div className="max-w-[175px]">
|
||||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||||
<div>
|
<div className="w-full">
|
||||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||||
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
||||||
<p className="text-xs text-subtle">Powered by Danswer</p>
|
<p className="text-xs text-subtle">Powered by Danswer</p>
|
||||||
|
Reference in New Issue
Block a user