mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 20:08:36 +02:00
Minor/ee optional branding (#105)
This commit is contained in:
parent
98a58337a7
commit
010ce5395f
@ -248,7 +248,6 @@ async def lifespan(app: FastAPI) -> AsyncGenerator:
|
||||
)
|
||||
|
||||
optional_telemetry(record_type=RecordType.VERSION, data={"version": __version__})
|
||||
|
||||
yield
|
||||
|
||||
|
||||
|
@ -207,6 +207,8 @@ services:
|
||||
- NEXT_PUBLIC_DISABLE_LOGOUT=${NEXT_PUBLIC_DISABLE_LOGOUT:-}
|
||||
- NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME:-}
|
||||
- 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:
|
||||
- api_server
|
||||
restart: always
|
||||
|
@ -52,6 +52,10 @@ ENV NEXT_PUBLIC_THEME=${NEXT_PUBLIC_THEME}
|
||||
ARG 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
|
||||
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
|
||||
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
|
||||
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 { BasicClickable, BasicSelectable } from "@/components/BasicClickable";
|
||||
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 { Folder } from "../folders/interfaces";
|
||||
import { createFolder } from "../folders/FolderManagement";
|
||||
@ -79,9 +82,12 @@ export const ChatSidebar = ({
|
||||
<HeaderTitle>
|
||||
{enterpriseSettings.application_name}
|
||||
</HeaderTitle>
|
||||
<p className="text-xs text-subtle -mt-1.5">
|
||||
Powered by Danswer
|
||||
</p>
|
||||
|
||||
{!NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED && (
|
||||
<p className="text-xs text-subtle -mt-1.5">
|
||||
Powered by Danswer
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<HeaderTitle>Danswer</HeaderTitle>
|
||||
|
@ -1,19 +1,36 @@
|
||||
import "./globals.css";
|
||||
|
||||
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 { SettingsProvider } from "@/components/settings/SettingsProvider";
|
||||
import { Metadata } from "next";
|
||||
import { buildClientUrl } from "@/lib/utilsSS";
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ["latin"],
|
||||
variable: "--font-inter",
|
||||
});
|
||||
|
||||
export const metadata = {
|
||||
title: "Danswer",
|
||||
description: "Question answering for your documents",
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
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",
|
||||
icons: {
|
||||
icon: logoLocation,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@ -22,7 +39,7 @@ export default async function RootLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const combinedSettings = await fetchSettingsSS();
|
||||
const combinedSettings = await getCombinedSettings({});
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
|
@ -5,8 +5,10 @@ export function DanswerInitializingLoader() {
|
||||
return (
|
||||
<div className="mx-auto animate-pulse">
|
||||
<Logo height={96} width={96} className="mx-auto mb-3" />
|
||||
|
||||
<Bold>Initializing Danswer</Bold>
|
||||
<Bold>
|
||||
Initializing{" "}
|
||||
{combinedSettings?.enterpriseSettings?.application_name ?? "Danswer"}
|
||||
</Bold>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { User } from "@/lib/types";
|
||||
import { logout } from "@/lib/user";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||
import { CustomDropdown, DefaultDropdownElement } from "../Dropdown";
|
||||
import React, { useContext } from "react";
|
||||
import { FiMessageSquare, FiSearch } from "react-icons/fi";
|
||||
import { HeaderWrapper } from "./HeaderWrapper";
|
||||
import { SettingsContext } from "../settings/SettingsProvider";
|
||||
import { UserDropdown } from "../UserDropdown";
|
||||
import { Logo } from "../Logo";
|
||||
import { NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants";
|
||||
|
||||
export function HeaderTitle({ children }: { children: JSX.Element | string }) {
|
||||
return <h1 className="flex text-2xl text-strong font-bold">{children}</h1>;
|
||||
@ -47,9 +45,11 @@ export function Header({ user }: HeaderProps) {
|
||||
<HeaderTitle>
|
||||
{enterpriseSettings.application_name}
|
||||
</HeaderTitle>
|
||||
<p className="text-xs text-subtle -mt-1.5">
|
||||
Powered by Danswer
|
||||
</p>
|
||||
{!NEXT_PUBLIC_TOGGLE_OFF_DANSWER_POWERED && (
|
||||
<p className="text-xs text-subtle -mt-1.5">
|
||||
Powered by Danswer
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<HeaderTitle>Danswer</HeaderTitle>
|
||||
|
@ -20,7 +20,7 @@ export async function fetchSettingsSS() {
|
||||
tasks.length > 2 ? await results[2].json() : null
|
||||
) as string | null;
|
||||
|
||||
const combinedSettings = {
|
||||
const combinedSettings: CombinedSettings = {
|
||||
settings,
|
||||
enterpriseSettings,
|
||||
customAnalyticsScript,
|
||||
@ -28,3 +28,22 @@ export async function fetchSettingsSS() {
|
||||
|
||||
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 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 NEXT_PUBLIC_DISABLE_STREAMING =
|
||||
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 =
|
||||
process.env.NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA?.toLowerCase() ===
|
||||
"true";
|
||||
|
@ -1,5 +1,12 @@
|
||||
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) {
|
||||
if (path.startsWith("/")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user