mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 04:18:35 +02:00
Minor/ee optional branding (#105)
This commit is contained in:
committed by
Chris Weaver
parent
98a58337a7
commit
010ce5395f
@@ -248,7 +248,6 @@ async def lifespan(app: FastAPI) -> AsyncGenerator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
optional_telemetry(record_type=RecordType.VERSION, data={"version": __version__})
|
optional_telemetry(record_type=RecordType.VERSION, data={"version": __version__})
|
||||||
|
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@@ -207,6 +207,8 @@ services:
|
|||||||
- NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT:-}
|
- NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT:-}
|
||||||
- NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME:-}
|
- NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME:-}
|
||||||
- NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES=${NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES:-true}
|
- NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES=${NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES:-true}
|
||||||
|
# Leave off unless absolutely necessary
|
||||||
|
- NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED=${NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED:-false}
|
||||||
depends_on:
|
depends_on:
|
||||||
- api_server
|
- api_server
|
||||||
restart: always
|
restart: always
|
||||||
|
@@ -52,6 +52,10 @@ ENV NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME}
|
|||||||
ARG NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES
|
ARG NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES
|
||||||
ENV NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES=${NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES}
|
ENV NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES=${NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES}
|
||||||
|
|
||||||
|
|
||||||
|
ARG NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED
|
||||||
|
ENV NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED=${NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED}
|
||||||
|
|
||||||
ARG NEXT_PUBLIC_DISABLE_LOGOUT
|
ARG NEXT_PUBLIC_DISABLE_LOGOUT
|
||||||
ENV NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT}
|
ENV NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT}
|
||||||
|
|
||||||
@@ -106,6 +110,9 @@ ENV NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME}
|
|||||||
ARG NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES
|
ARG NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES
|
||||||
ENV NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES=${NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES}
|
ENV NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES=${NEXT_PUBLIC_ENABLE_PAID_EE_FEATURES}
|
||||||
|
|
||||||
|
ARG NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED
|
||||||
|
ENV NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED=${NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED}
|
||||||
|
|
||||||
ARG NEXT_PUBLIC_DISABLE_LOGOUT
|
ARG NEXT_PUBLIC_DISABLE_LOGOUT
|
||||||
ENV NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT}
|
ENV NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT}
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -7,7 +7,10 @@ import Image from "next/image";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { BasicClickable, BasicSelectable } from "@/components/BasicClickable";
|
import { BasicClickable, BasicSelectable } from "@/components/BasicClickable";
|
||||||
import { ChatSession } from "../interfaces";
|
import { ChatSession } from "../interfaces";
|
||||||
import { NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA } from "@/lib/constants";
|
import {
|
||||||
|
NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA,
|
||||||
|
NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED,
|
||||||
|
} from "@/lib/constants";
|
||||||
import { ChatTab } from "./ChatTab";
|
import { ChatTab } from "./ChatTab";
|
||||||
import { Folder } from "../folders/interfaces";
|
import { Folder } from "../folders/interfaces";
|
||||||
import { createFolder } from "../folders/FolderManagement";
|
import { createFolder } from "../folders/FolderManagement";
|
||||||
@@ -79,9 +82,12 @@ export const ChatSidebar = ({
|
|||||||
<HeaderTitle>
|
<HeaderTitle>
|
||||||
{enterpriseSettings.application_name}
|
{enterpriseSettings.application_name}
|
||||||
</HeaderTitle>
|
</HeaderTitle>
|
||||||
|
|
||||||
|
{!NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED && (
|
||||||
<p className="text-xs text-subtle -mt-1.5">
|
<p className="text-xs text-subtle -mt-1.5">
|
||||||
Powered by Danswer
|
Powered by Danswer
|
||||||
</p>
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<HeaderTitle>Danswer</HeaderTitle>
|
<HeaderTitle>Danswer</HeaderTitle>
|
||||||
|
@@ -1,19 +1,36 @@
|
|||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
import { Inter } from "next/font/google";
|
import { Inter } from "next/font/google";
|
||||||
import { fetchSettingsSS } from "@/components/settings/lib";
|
import {
|
||||||
|
fetchSettingsSS,
|
||||||
|
getCombinedSettings,
|
||||||
|
} from "@/components/settings/lib";
|
||||||
import { CUSTOM_ANALYTICS_ENABLED } from "@/lib/constants";
|
import { CUSTOM_ANALYTICS_ENABLED } from "@/lib/constants";
|
||||||
import { SettingsProvider } from "@/components/settings/SettingsProvider";
|
import { SettingsProvider } from "@/components/settings/SettingsProvider";
|
||||||
|
import { Metadata } from "next";
|
||||||
|
import { buildClientUrl } from "@/lib/utilsSS";
|
||||||
|
|
||||||
const inter = Inter({
|
const inter = Inter({
|
||||||
subsets: ["latin"],
|
subsets: ["latin"],
|
||||||
variable: "--font-inter",
|
variable: "--font-inter",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const metadata = {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
title: "Danswer",
|
const dynamicSettings = await getCombinedSettings({ forceRetrieval: true });
|
||||||
|
const logoLocation =
|
||||||
|
dynamicSettings.enterpriseSettings &&
|
||||||
|
dynamicSettings.enterpriseSettings?.use_custom_logo
|
||||||
|
? "/api/enterprise-settings/logo"
|
||||||
|
: buildClientUrl("/danswer.ico");
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: dynamicSettings.enterpriseSettings?.application_name ?? "Danswer",
|
||||||
description: "Question answering for your documents",
|
description: "Question answering for your documents",
|
||||||
|
icons: {
|
||||||
|
icon: logoLocation,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
@@ -22,7 +39,7 @@ export default async function RootLayout({
|
|||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const combinedSettings = await fetchSettingsSS();
|
const combinedSettings = await getCombinedSettings({});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
@@ -5,8 +5,10 @@ export function DanswerInitializingLoader() {
|
|||||||
return (
|
return (
|
||||||
<div className="mx-auto animate-pulse">
|
<div className="mx-auto animate-pulse">
|
||||||
<Logo height={96} width={96} className="mx-auto mb-3" />
|
<Logo height={96} width={96} className="mx-auto mb-3" />
|
||||||
|
<Bold>
|
||||||
<Bold>Initializing Danswer</Bold>
|
Initializing{" "}
|
||||||
|
{combinedSettings?.enterpriseSettings?.application_name ?? "Danswer"}
|
||||||
|
</Bold>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { User } from "@/lib/types";
|
import { User } from "@/lib/types";
|
||||||
import { logout } from "@/lib/user";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import React, { useContext } from "react";
|
||||||
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
||||||
import { CustomDropdown, DefaultDropdownElement } from "../Dropdown";
|
|
||||||
import { FiMessageSquare, FiSearch } from "react-icons/fi";
|
import { FiMessageSquare, FiSearch } from "react-icons/fi";
|
||||||
import { HeaderWrapper } from "./HeaderWrapper";
|
import { HeaderWrapper } from "./HeaderWrapper";
|
||||||
import { SettingsContext } from "../settings/SettingsProvider";
|
import { SettingsContext } from "../settings/SettingsProvider";
|
||||||
import { UserDropdown } from "../UserDropdown";
|
import { UserDropdown } from "../UserDropdown";
|
||||||
import { Logo } from "../Logo";
|
import { Logo } from "../Logo";
|
||||||
|
import { NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants";
|
||||||
|
|
||||||
export function HeaderTitle({ children }: { children: JSX.Element | string }) {
|
export function HeaderTitle({ children }: { children: JSX.Element | string }) {
|
||||||
return <h1 className="flex text-2xl text-strong font-bold">{children}</h1>;
|
return <h1 className="flex text-2xl text-strong font-bold">{children}</h1>;
|
||||||
@@ -47,9 +45,11 @@ export function Header({ user }: HeaderProps) {
|
|||||||
<HeaderTitle>
|
<HeaderTitle>
|
||||||
{enterpriseSettings.application_name}
|
{enterpriseSettings.application_name}
|
||||||
</HeaderTitle>
|
</HeaderTitle>
|
||||||
|
{!NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED && (
|
||||||
<p className="text-xs text-subtle -mt-1.5">
|
<p className="text-xs text-subtle -mt-1.5">
|
||||||
Powered by Danswer
|
Powered by Danswer
|
||||||
</p>
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<HeaderTitle>Danswer</HeaderTitle>
|
<HeaderTitle>Danswer</HeaderTitle>
|
||||||
|
@@ -20,7 +20,7 @@ export async function fetchSettingsSS() {
|
|||||||
tasks.length > 2 ? await results[2].json() : null
|
tasks.length > 2 ? await results[2].json() : null
|
||||||
) as string | null;
|
) as string | null;
|
||||||
|
|
||||||
const combinedSettings = {
|
const combinedSettings: CombinedSettings = {
|
||||||
settings,
|
settings,
|
||||||
enterpriseSettings,
|
enterpriseSettings,
|
||||||
customAnalyticsScript,
|
customAnalyticsScript,
|
||||||
@@ -28,3 +28,22 @@ export async function fetchSettingsSS() {
|
|||||||
|
|
||||||
return combinedSettings;
|
return combinedSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CombinedSettings {
|
||||||
|
settings: Settings;
|
||||||
|
enterpriseSettings: EnterpriseSettings | null;
|
||||||
|
customAnalyticsScript: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedSettings: CombinedSettings;
|
||||||
|
|
||||||
|
export async function getCombinedSettings({
|
||||||
|
forceRetrieval,
|
||||||
|
}: {
|
||||||
|
forceRetrieval?: boolean;
|
||||||
|
}): Promise<CombinedSettings> {
|
||||||
|
if (!cachedSettings || forceRetrieval) {
|
||||||
|
cachedSettings = await fetchSettingsSS();
|
||||||
|
}
|
||||||
|
return cachedSettings;
|
||||||
|
}
|
||||||
|
@@ -1,9 +1,13 @@
|
|||||||
export type AuthType = "disabled" | "basic" | "google_oauth" | "oidc" | "saml";
|
export type AuthType = "disabled" | "basic" | "google_oauth" | "oidc" | "saml";
|
||||||
|
|
||||||
|
export const HOST_URL = process.env.WEB_DOMAIN || "http://127.0.0.1:3000";
|
||||||
export const INTERNAL_URL = process.env.INTERNAL_URL || "http://127.0.0.1:8080";
|
export const INTERNAL_URL = process.env.INTERNAL_URL || "http://127.0.0.1:8080";
|
||||||
export const NEXT_PUBLIC_DISABLE_STREAMING =
|
export const NEXT_PUBLIC_DISABLE_STREAMING =
|
||||||
process.env.NEXT_PUBLIC_DISABLE_STREAMING?.toLowerCase() === "true";
|
process.env.NEXT_PUBLIC_DISABLE_STREAMING?.toLowerCase() === "true";
|
||||||
|
|
||||||
|
export const NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED =
|
||||||
|
process.env.NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED?.toLowerCase() === "true";
|
||||||
|
|
||||||
export const NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA =
|
export const NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA =
|
||||||
process.env.NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA?.toLowerCase() ===
|
process.env.NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA?.toLowerCase() ===
|
||||||
"true";
|
"true";
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { INTERNAL_URL } from "./constants";
|
import { HOST_URL, INTERNAL_URL } from "./constants";
|
||||||
|
|
||||||
|
export function buildClientUrl(path: string) {
|
||||||
|
if (path.startsWith("/")) {
|
||||||
|
return `${HOST_URL}${path}`;
|
||||||
|
}
|
||||||
|
return `${HOST_URL}/${path}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function buildUrl(path: string) {
|
export function buildUrl(path: string) {
|
||||||
if (path.startsWith("/")) {
|
if (path.startsWith("/")) {
|
||||||
|
Reference in New Issue
Block a user