mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-26 17:51:54 +01:00
parent
e94ffbc2a1
commit
1613a8ba4f
@ -1,21 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import useSWR from "swr";
|
||||
import { useState } from "react";
|
||||
import { useContext, useState } from "react";
|
||||
|
||||
import { PopupSpec } from "@/components/admin/connectors/Popup";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { NEXT_PUBLIC_WEB_DOMAIN } from "@/lib/constants";
|
||||
import { ClipboardIcon } from "@/components/icons/icons";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { ThreeDotsLoader } from "@/components/Loading";
|
||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||
|
||||
export function AnonymousUserPath({
|
||||
setPopup,
|
||||
}: {
|
||||
setPopup: (popup: PopupSpec) => void;
|
||||
}) {
|
||||
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
||||
const settings = useContext(SettingsContext);
|
||||
const [customPath, setCustomPath] = useState<string | null>(null);
|
||||
|
||||
const {
|
||||
@ -116,7 +116,7 @@ export function AnonymousUserPath({
|
||||
<div className="flex flex-col gap-2 justify-center items-start">
|
||||
<div className="w-full flex-grow flex items-center rounded-md shadow-sm">
|
||||
<span className="inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-3 text-gray-500 sm:text-sm h-10">
|
||||
{NEXT_PUBLIC_WEB_DOMAIN}/anonymous/
|
||||
{settings?.webDomain}/anonymous/
|
||||
</span>
|
||||
<Input
|
||||
type="text"
|
||||
@ -141,7 +141,7 @@ export function AnonymousUserPath({
|
||||
className="h-10 px-4"
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(
|
||||
`${NEXT_PUBLIC_WEB_DOMAIN}/anonymous/${anonymousUserPath}`
|
||||
`${settings?.webDomain}/anonymous/${anonymousUserPath}`
|
||||
);
|
||||
setPopup({
|
||||
message: "Invite link copied!",
|
||||
|
@ -62,4 +62,5 @@ export interface CombinedSettings {
|
||||
customAnalyticsScript: string | null;
|
||||
isMobile?: boolean;
|
||||
webVersion: string | null;
|
||||
webDomain: string | null;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import React, { useState, useEffect, useRef, useContext } from "react";
|
||||
import { useUser } from "@/components/user/UserProvider";
|
||||
import { usePopup } from "@/components/admin/connectors/Popup";
|
||||
import {
|
||||
@ -31,11 +31,12 @@ import { useNRFPreferences } from "@/components/context/NRFPreferencesContext";
|
||||
import { SettingsPanel } from "../../components/nrf/SettingsPanel";
|
||||
import { ShortcutsDisplay } from "../../components/nrf/ShortcutsDisplay";
|
||||
import LoginPage from "../../auth/login/LoginPage";
|
||||
import { AuthType, NEXT_PUBLIC_WEB_DOMAIN } from "@/lib/constants";
|
||||
import { AuthType } from "@/lib/constants";
|
||||
import { sendSetDefaultNewTabMessage } from "@/lib/extension/utils";
|
||||
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
|
||||
import { CHROME_MESSAGE } from "@/lib/extension/constants";
|
||||
import { ApiKeyModal } from "@/components/llm/ApiKeyModal";
|
||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||
|
||||
export default function NRFPage({
|
||||
requestCookies,
|
||||
@ -56,6 +57,7 @@ export default function NRFPage({
|
||||
const { isNight } = useNightTime();
|
||||
const { user } = useUser();
|
||||
const { ccPairs, documentSets, tags, llmProviders } = useChatContext();
|
||||
const settings = useContext(SettingsContext);
|
||||
|
||||
const { popup, setPopup } = usePopup();
|
||||
|
||||
@ -196,7 +198,7 @@ export default function NRFPage({
|
||||
}
|
||||
|
||||
const newHref =
|
||||
`${NEXT_PUBLIC_WEB_DOMAIN}/chat?send-on-load=true&user-prompt=` +
|
||||
`${settings?.webDomain}/chat?send-on-load=true&user-prompt=` +
|
||||
encodeURIComponent(userMessage) +
|
||||
filterString;
|
||||
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
} from "@/app/admin/settings/interfaces";
|
||||
import {
|
||||
CUSTOM_ANALYTICS_ENABLED,
|
||||
HOST_URL,
|
||||
SERVER_SIDE_ONLY__PAID_ENTERPRISE_FEATURES_ENABLED,
|
||||
} from "@/lib/constants";
|
||||
import { fetchSS } from "@/lib/utilsSS";
|
||||
@ -99,6 +100,7 @@ export async function fetchSettingsSS(): Promise<CombinedSettings | null> {
|
||||
enterpriseSettings,
|
||||
customAnalyticsScript,
|
||||
webVersion,
|
||||
webDomain: HOST_URL,
|
||||
};
|
||||
|
||||
return combinedSettings;
|
||||
|
@ -175,7 +175,14 @@ export async function fetchChatData(searchParams: {
|
||||
);
|
||||
const sidebarToggled = requestCookies.get(SIDEBAR_TOGGLED_COOKIE_NAME);
|
||||
|
||||
const toggleSidebar = sidebarToggled
|
||||
// IF user is an anoymous user, we don't want to show the sidebar (they have no access to chat history)
|
||||
const toggleSidebar =
|
||||
!user?.is_anonymous_user &&
|
||||
(sidebarToggled
|
||||
? sidebarToggled.value.toLocaleLowerCase() == "true" || false
|
||||
: NEXT_PUBLIC_DEFAULT_SIDEBAR_OPEN);
|
||||
|
||||
sidebarToggled
|
||||
? sidebarToggled.value.toLocaleLowerCase() == "true" || false
|
||||
: NEXT_PUBLIC_DEFAULT_SIDEBAR_OPEN;
|
||||
|
||||
|
@ -89,6 +89,3 @@ export const NEXT_PUBLIC_DELETE_ALL_CHATS_ENABLED =
|
||||
|
||||
export const NEXT_PUBLIC_ENABLE_CHROME_EXTENSION =
|
||||
process.env.NEXT_PUBLIC_ENABLE_CHROME_EXTENSION?.toLowerCase() === "true";
|
||||
|
||||
export const NEXT_PUBLIC_WEB_DOMAIN =
|
||||
process.env.NEXT_PUBLIC_WEB_DOMAIN || "http://127.0.0.1:3000";
|
||||
|
@ -112,6 +112,7 @@ export const getAuthUrlSS = async (
|
||||
nextUrl: string | null
|
||||
): Promise<string> => {
|
||||
// Returns the auth url for the given auth type
|
||||
|
||||
switch (authType) {
|
||||
case "disabled":
|
||||
return "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user