;
+}) {
+ const params = await props.params;
const tool = await fetchToolByIdSS(params.toolId);
let body;
diff --git a/web/src/app/api/[...path]/route.ts b/web/src/app/api/[...path]/route.ts
index 6ca13aba146..0ebd8210a81 100644
--- a/web/src/app/api/[...path]/route.ts
+++ b/web/src/app/api/[...path]/route.ts
@@ -6,50 +6,57 @@ each request type >:( */
export async function GET(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
export async function POST(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
export async function PUT(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
export async function PATCH(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
export async function DELETE(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
export async function HEAD(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
export async function OPTIONS(
request: NextRequest,
- { params }: { params: { path: string[] } }
+ props: { params: Promise<{ path: string[] }> }
) {
+ const params = await props.params;
return handleRequest(request, params.path);
}
diff --git a/web/src/app/assistants/edit/[id]/page.tsx b/web/src/app/assistants/edit/[id]/page.tsx
index e57a32acc0c..e8dedb80a8e 100644
--- a/web/src/app/assistants/edit/[id]/page.tsx
+++ b/web/src/app/assistants/edit/[id]/page.tsx
@@ -9,7 +9,8 @@ import { DeletePersonaButton } from "@/app/admin/assistants/[id]/DeletePersonaBu
import { LargeBackButton } from "../../LargeBackButton";
import Title from "@/components/ui/title";
-export default async function Page({ params }: { params: { id: string } }) {
+export default async function Page(props: { params: Promise<{ id: string }> }) {
+ const params = await props.params;
const [values, error] = await fetchAssistantEditorInfoSS(params.id);
let body;
diff --git a/web/src/app/assistants/gallery/page.tsx b/web/src/app/assistants/gallery/page.tsx
index fd261fbcae8..538ab5d60a9 100644
--- a/web/src/app/assistants/gallery/page.tsx
+++ b/web/src/app/assistants/gallery/page.tsx
@@ -5,14 +5,15 @@ import { unstable_noStore as noStore } from "next/cache";
import { redirect } from "next/navigation";
import WrappedAssistantsGallery from "./WrappedAssistantsGallery";
import { AssistantsProvider } from "@/components/context/AssistantsContext";
+import { cookies } from "next/headers";
-export default async function GalleryPage({
- searchParams,
-}: {
- searchParams: { [key: string]: string };
+export default async function GalleryPage(props: {
+ searchParams: Promise<{ [key: string]: string }>;
}) {
noStore();
+ const searchParams = await props.searchParams;
+ const requestCookies = await cookies();
const data = await fetchChatData(searchParams);
if ("redirect" in data) {
@@ -30,7 +31,9 @@ export default async function GalleryPage({
return (
<>
- {shouldShowWelcomeModal &&
}
+ {shouldShowWelcomeModal && (
+
+ )}
diff --git a/web/src/app/assistants/mine/page.tsx b/web/src/app/assistants/mine/page.tsx
index 5761a8c48e5..7058e7d3db2 100644
--- a/web/src/app/assistants/mine/page.tsx
+++ b/web/src/app/assistants/mine/page.tsx
@@ -5,13 +5,14 @@ import { unstable_noStore as noStore } from "next/cache";
import { redirect } from "next/navigation";
import WrappedAssistantsMine from "./WrappedAssistantsMine";
import { WelcomeModal } from "@/components/initialSetup/welcome/WelcomeModalWrapper";
+import { cookies } from "next/headers";
-export default async function GalleryPage({
- searchParams,
-}: {
- searchParams: { [key: string]: string };
+export default async function GalleryPage(props: {
+ searchParams: Promise<{ [key: string]: string }>;
}) {
noStore();
+ const requestCookies = await cookies();
+ const searchParams = await props.searchParams;
const data = await fetchChatData(searchParams);
@@ -30,7 +31,9 @@ export default async function GalleryPage({
return (
<>
- {shouldShowWelcomeModal &&
}
+ {shouldShowWelcomeModal && (
+
+ )}
;
}) => {
+ const searchParams = await props.searchParams;
const autoRedirectDisabled = searchParams?.disableAutoRedirect === "true";
// catch cases where the backend is completely unreachable here
diff --git a/web/src/app/chat/page.tsx b/web/src/app/chat/page.tsx
index 05207ea9282..7894ce651fc 100644
--- a/web/src/app/chat/page.tsx
+++ b/web/src/app/chat/page.tsx
@@ -5,14 +5,14 @@ import { WelcomeModal } from "@/components/initialSetup/welcome/WelcomeModalWrap
import { ChatProvider } from "@/components/context/ChatContext";
import { fetchChatData } from "@/lib/chat/fetchChatData";
import WrappedChat from "./WrappedChat";
+import { cookies } from "next/headers";
-export default async function Page({
- searchParams,
-}: {
- searchParams: { [key: string]: string };
+export default async function Page(props: {
+ searchParams: Promise<{ [key: string]: string }>;
}) {
+ const searchParams = await props.searchParams;
noStore();
-
+ const requestCookies = await cookies();
const data = await fetchChatData(searchParams);
if ("redirect" in data) {
@@ -37,7 +37,9 @@ export default async function Page({
return (
<>
- {shouldShowWelcomeModal && }
+ {shouldShowWelcomeModal && (
+
+ )}
;
+}) {
+ const params = await props.params;
const tasks = [
getAuthTypeMetadataSS(),
getCurrentUserSS(),
@@ -58,6 +61,7 @@ export default async function Page({ params }: { params: { chatId: string } }) {
if (user && !user.is_verified && authTypeMetadata?.requiresVerification) {
return redirect("/auth/waiting-on-verification");
}
+ // prettier-ignore
const persona: Persona =
chatSession?.persona_id && availableAssistants?.length
? (availableAssistants.find((p) => p.id === chatSession.persona_id) ??
diff --git a/web/src/app/ee/admin/groups/[groupId]/page.tsx b/web/src/app/ee/admin/groups/[groupId]/page.tsx
index 82e9d747118..f378473f597 100644
--- a/web/src/app/ee/admin/groups/[groupId]/page.tsx
+++ b/web/src/app/ee/admin/groups/[groupId]/page.tsx
@@ -1,4 +1,5 @@
"use client";
+import { use } from "react";
import { GroupsIcon } from "@/components/icons/icons";
import { GroupDisplay } from "./GroupDisplay";
@@ -9,7 +10,8 @@ import { useRouter } from "next/navigation";
import { BackButton } from "@/components/BackButton";
import { AdminPageTitle } from "@/components/admin/Title";
-const Page = ({ params }: { params: { groupId: string } }) => {
+const Page = (props: { params: Promise<{ groupId: string }> }) => {
+ const params = use(props.params);
const router = useRouter();
const {
diff --git a/web/src/app/ee/admin/performance/query-history/[id]/page.tsx b/web/src/app/ee/admin/performance/query-history/[id]/page.tsx
index 3f924267cb2..ee5a03f28f6 100644
--- a/web/src/app/ee/admin/performance/query-history/[id]/page.tsx
+++ b/web/src/app/ee/admin/performance/query-history/[id]/page.tsx
@@ -1,4 +1,5 @@
"use client";
+import { use } from "react";
import Text from "@/components/ui/text";
import Title from "@/components/ui/title";
@@ -63,7 +64,8 @@ function MessageDisplay({ message }: { message: MessageSnapshot }) {
);
}
-export default function QueryPage({ params }: { params: { id: string } }) {
+export default function QueryPage(props: { params: Promise<{ id: string }> }) {
+ const params = use(props.params);
const {
data: chatSessionSnapshot,
isLoading,
diff --git a/web/src/app/ee/admin/standard-answer/[id]/page.tsx b/web/src/app/ee/admin/standard-answer/[id]/page.tsx
index 772b1507d33..edacd785b31 100644
--- a/web/src/app/ee/admin/standard-answer/[id]/page.tsx
+++ b/web/src/app/ee/admin/standard-answer/[id]/page.tsx
@@ -6,7 +6,8 @@ import { BackButton } from "@/components/BackButton";
import { ClipboardIcon } from "@/components/icons/icons";
import { StandardAnswer, StandardAnswerCategory } from "@/lib/types";
-async function Page({ params }: { params: { id: string } }) {
+async function Page(props: { params: Promise<{ id: string }> }) {
+ const params = await props.params;
const tasks = [
fetchSS("/manage/admin/standard-answer"),
fetchSS(`/manage/admin/standard-answer/category`),
diff --git a/web/src/app/layout.tsx b/web/src/app/layout.tsx
index 07592b2fda6..8918aa5a636 100644
--- a/web/src/app/layout.tsx
+++ b/web/src/app/layout.tsx
@@ -17,13 +17,10 @@ import { Logo } from "@/components/Logo";
import { fetchAssistantData } from "@/lib/chat/fetchAssistantdata";
import { AppProvider } from "@/components/context/AppProvider";
import { PHProvider } from "./providers";
-import { default as dynamicImport } from "next/dynamic";
import { getCurrentUserSS } from "@/lib/userSS";
import CardSection from "@/components/admin/CardSection";
-
-const PostHogPageView = dynamicImport(() => import("./PostHogPageView"), {
- ssr: false,
-});
+import { Suspense } from "react";
+import PostHogPageView from "./PostHogPageView";
const inter = Inter({
subsets: ["latin"],
@@ -181,7 +178,9 @@ export default async function RootLayout({
hasAnyConnectors={hasAnyConnectors}
hasImageCompatibleModel={hasImageCompatibleModel}
>
-
+
+
+
{children}
);
diff --git a/web/src/app/prompts/page.tsx b/web/src/app/prompts/page.tsx
index 20c9038ac2e..5591e26b7b3 100644
--- a/web/src/app/prompts/page.tsx
+++ b/web/src/app/prompts/page.tsx
@@ -3,11 +3,10 @@ import { unstable_noStore as noStore } from "next/cache";
import { redirect } from "next/navigation";
import WrappedPrompts from "../assistants/mine/WrappedInputPrompts";
-export default async function GalleryPage({
- searchParams,
-}: {
- searchParams: { [key: string]: string };
+export default async function GalleryPage(props: {
+ searchParams: Promise<{ [key: string]: string }>;
}) {
+ const searchParams = await props.searchParams;
noStore();
const data = await fetchChatData(searchParams);
diff --git a/web/src/app/search/page.tsx b/web/src/app/search/page.tsx
index 8bd743fe763..3572d7cbe40 100644
--- a/web/src/app/search/page.tsx
+++ b/web/src/app/search/page.tsx
@@ -30,23 +30,21 @@ import WrappedSearch from "./WrappedSearch";
import { SearchProvider } from "@/components/context/SearchContext";
import { fetchLLMProvidersSS } from "@/lib/llm/fetchLLMs";
import { LLMProviderDescriptor } from "../admin/configuration/llm/interfaces";
-import { AssistantsProvider } from "@/components/context/AssistantsContext";
import { headers } from "next/headers";
import {
hasCompletedWelcomeFlowSS,
WelcomeModal,
} from "@/components/initialSetup/welcome/WelcomeModalWrapper";
-export default async function Home({
- searchParams,
-}: {
- searchParams: { [key: string]: string | string[] | undefined };
+export default async function Home(props: {
+ searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}) {
+ const searchParams = await props.searchParams;
// Disable caching so we always get the up to date connector / document set / persona info
// importantly, this prevents users from adding a connector, going back to the main page,
// and then getting hit with a "No Connectors" popup
noStore();
-
+ const requestCookies = await cookies();
const tasks = [
getAuthTypeMetadataSS(),
getCurrentUserSS(),
@@ -88,7 +86,7 @@ export default async function Home({
const authDisabled = authTypeMetadata?.authType === "disabled";
if (!authDisabled && !user) {
- const headersList = headers();
+ const headersList = await headers();
const fullUrl = headersList.get("x-url") || "/search";
const searchParamsString = new URLSearchParams(
searchParams as unknown as Record
@@ -146,7 +144,7 @@ export default async function Home({
}
// needs to be done in a non-client side component due to nextjs
- const storedSearchType = cookies().get("searchType")?.value as
+ const storedSearchType = requestCookies.get("searchType")?.value as
| string
| undefined;
const searchTypeDefault: SearchType =
@@ -159,7 +157,7 @@ export default async function Home({
const shouldShowWelcomeModal =
!llmProviders.length &&
- !hasCompletedWelcomeFlowSS() &&
+ !hasCompletedWelcomeFlowSS(requestCookies) &&
!hasAnyConnectors &&
(!user || user.role === "admin");
@@ -168,8 +166,10 @@ export default async function Home({
ccPairs.length === 0 &&
!shouldShowWelcomeModal;
- const sidebarToggled = cookies().get(SIDEBAR_TOGGLED_COOKIE_NAME);
- const agenticSearchToggle = cookies().get(AGENTIC_SEARCH_TYPE_COOKIE_NAME);
+ const sidebarToggled = requestCookies.get(SIDEBAR_TOGGLED_COOKIE_NAME);
+ const agenticSearchToggle = requestCookies.get(
+ AGENTIC_SEARCH_TYPE_COOKIE_NAME
+ );
const toggleSidebar = sidebarToggled
? sidebarToggled.value.toLocaleLowerCase() == "true" || false
@@ -183,7 +183,9 @@ export default async function Home({
<>
- {shouldShowWelcomeModal && }
+ {shouldShowWelcomeModal && (
+
+ )}
{/* ChatPopup is a custom popup that displays a admin-specified message on initial user visit.
Only used in the EE version of the app. */}
diff --git a/web/src/components/context/AppProvider.tsx b/web/src/components/context/AppProvider.tsx
index 66d8a0eff15..eda873214a2 100644
--- a/web/src/components/context/AppProvider.tsx
+++ b/web/src/components/context/AppProvider.tsx
@@ -1,4 +1,3 @@
-"use server";
import { CombinedSettings } from "@/app/admin/settings/interfaces";
import { UserProvider } from "../user/UserProvider";
import { ProviderContextProvider } from "../chat_search/ProviderContext";
diff --git a/web/src/components/icons/icons.tsx b/web/src/components/icons/icons.tsx
index 30f6f0bdccc..120d5807485 100644
--- a/web/src/components/icons/icons.tsx
+++ b/web/src/components/icons/icons.tsx
@@ -15,7 +15,6 @@ import {
ArrowSquareOut,
} from "@phosphor-icons/react";
import {
- FiCheck,
FiChevronsDown,
FiChevronsUp,
FiEdit2,
@@ -30,17 +29,10 @@ import {
FiChevronRight,
FiChevronLeft,
FiAlertTriangle,
- FiZoomIn,
FiCopy,
- FiBookmark,
FiCpu,
FiInfo,
- FiUploadCloud,
- FiUser,
- FiUsers,
FiBarChart2,
- FiDatabase,
- FiSlack,
} from "react-icons/fi";
import { SiBookstack } from "react-icons/si";
import Image, { StaticImageData } from "next/image";
diff --git a/web/src/components/initialSetup/welcome/WelcomeModalWrapper.tsx b/web/src/components/initialSetup/welcome/WelcomeModalWrapper.tsx
index 7355990f22e..3deaab06508 100644
--- a/web/src/components/initialSetup/welcome/WelcomeModalWrapper.tsx
+++ b/web/src/components/initialSetup/welcome/WelcomeModalWrapper.tsx
@@ -5,17 +5,25 @@ import {
} from "./WelcomeModal";
import { COMPLETED_WELCOME_FLOW_COOKIE } from "./constants";
import { User } from "@/lib/types";
+import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
-export function hasCompletedWelcomeFlowSS() {
- const cookieStore = cookies();
+export function hasCompletedWelcomeFlowSS(
+ requestCookies: ReadonlyRequestCookies
+) {
return (
- cookieStore.get(COMPLETED_WELCOME_FLOW_COOKIE)?.value?.toLowerCase() ===
+ requestCookies.get(COMPLETED_WELCOME_FLOW_COOKIE)?.value?.toLowerCase() ===
"true"
);
}
-export function WelcomeModal({ user }: { user: User | null }) {
- const hasCompletedWelcomeFlow = hasCompletedWelcomeFlowSS();
+export function WelcomeModal({
+ user,
+ requestCookies,
+}: {
+ user: User | null;
+ requestCookies: ReadonlyRequestCookies;
+}) {
+ const hasCompletedWelcomeFlow = hasCompletedWelcomeFlowSS(requestCookies);
if (hasCompletedWelcomeFlow) {
return <_CompletedWelcomeFlowDummyComponent />;
}
diff --git a/web/src/lib/chat/fetchChatData.ts b/web/src/lib/chat/fetchChatData.ts
index 32838aeac6f..751aa4d005a 100644
--- a/web/src/lib/chat/fetchChatData.ts
+++ b/web/src/lib/chat/fetchChatData.ts
@@ -19,16 +19,13 @@ import { Settings } from "@/app/admin/settings/interfaces";
import { fetchLLMProvidersSS } from "@/lib/llm/fetchLLMs";
import { LLMProviderDescriptor } from "@/app/admin/configuration/llm/interfaces";
import { Folder } from "@/app/chat/folders/interfaces";
-import { personaComparator } from "@/app/admin/assistants/lib";
import { cookies, headers } from "next/headers";
import {
SIDEBAR_TOGGLED_COOKIE_NAME,
DOCUMENT_SIDEBAR_WIDTH_COOKIE_NAME,
} from "@/components/resizable/constants";
import { hasCompletedWelcomeFlowSS } from "@/components/initialSetup/welcome/WelcomeModalWrapper";
-import { fetchAssistantsSS } from "../assistants/fetchAssistantsSS";
import { NEXT_PUBLIC_DEFAULT_SIDEBAR_OPEN } from "../constants";
-import { checkLLMSupportsImageInput } from "../llm/utils";
import { redirect } from "next/navigation";
interface FetchChatDataResult {
@@ -51,6 +48,7 @@ interface FetchChatDataResult {
export async function fetchChatData(searchParams: {
[key: string]: string;
}): Promise {
+ const requestCookies = await cookies();
const tasks = [
getAuthTypeMetadataSS(),
getCurrentUserSS(),
@@ -93,7 +91,7 @@ export async function fetchChatData(searchParams: {
const authDisabled = authTypeMetadata?.authType === "disabled";
if (!authDisabled && !user) {
- const headersList = headers();
+ const headersList = await headers();
const fullUrl = headersList.get("x-url") || "/chat";
const searchParamsString = new URLSearchParams(
searchParams as unknown as Record
@@ -165,10 +163,10 @@ export async function fetchChatData(searchParams: {
? parseInt(defaultAssistantIdRaw)
: undefined;
- const documentSidebarCookieInitialWidth = cookies().get(
+ const documentSidebarCookieInitialWidth = requestCookies.get(
DOCUMENT_SIDEBAR_WIDTH_COOKIE_NAME
);
- const sidebarToggled = cookies().get(SIDEBAR_TOGGLED_COOKIE_NAME);
+ const sidebarToggled = requestCookies.get(SIDEBAR_TOGGLED_COOKIE_NAME);
const toggleSidebar = sidebarToggled
? sidebarToggled.value.toLocaleLowerCase() == "true" || false
@@ -181,7 +179,7 @@ export async function fetchChatData(searchParams: {
const hasAnyConnectors = ccPairs.length > 0;
const shouldShowWelcomeModal =
!llmProviders.length &&
- !hasCompletedWelcomeFlowSS() &&
+ !hasCompletedWelcomeFlowSS(requestCookies) &&
!hasAnyConnectors &&
(!user || user.role === "admin");
@@ -195,7 +193,7 @@ export async function fetchChatData(searchParams: {
console.log(`Failed to fetch folders - ${foldersResponse?.status}`);
}
- const openedFoldersCookie = cookies().get("openedFolders");
+ const openedFoldersCookie = requestCookies.get("openedFolders");
const openedFolders = openedFoldersCookie
? JSON.parse(openedFoldersCookie.value)
: {};
diff --git a/web/src/lib/chat/fetchSomeChatData.ts b/web/src/lib/chat/fetchSomeChatData.ts
index fdfa55b5ea1..47c4c22465d 100644
--- a/web/src/lib/chat/fetchSomeChatData.ts
+++ b/web/src/lib/chat/fetchSomeChatData.ts
@@ -14,8 +14,6 @@ import {
import { ChatSession } from "@/app/chat/interfaces";
import { Persona } from "@/app/admin/assistants/interfaces";
import { InputPrompt } from "@/app/admin/prompt-library/interfaces";
-import { FullEmbeddingModelResponse } from "@/components/embedding/interfaces";
-import { Settings } from "@/app/admin/settings/interfaces";
import { fetchLLMProvidersSS } from "@/lib/llm/fetchLLMs";
import { LLMProviderDescriptor } from "@/app/admin/configuration/llm/interfaces";
import { Folder } from "@/app/chat/folders/interfaces";
@@ -67,6 +65,7 @@ export async function fetchSomeChatData(
searchParams: { [key: string]: string },
fetchOptions: FetchOption[] = []
): Promise {
+ const requestCookies = await cookies();
const tasks: Promise[] = [];
const taskMap: Record Promise> = {
user: getCurrentUserSS,
@@ -196,7 +195,7 @@ export async function fetchSomeChatData(
}
if (fetchOptions.includes("folders")) {
- const openedFoldersCookie = cookies().get("openedFolders");
+ const openedFoldersCookie = requestCookies.get("openedFolders");
result.openedFolders = openedFoldersCookie
? JSON.parse(openedFoldersCookie.value)
: {};
@@ -207,10 +206,10 @@ export async function fetchSomeChatData(
? parseInt(defaultAssistantIdRaw)
: undefined;
- const documentSidebarCookieInitialWidth = cookies().get(
+ const documentSidebarCookieInitialWidth = requestCookies.get(
DOCUMENT_SIDEBAR_WIDTH_COOKIE_NAME
);
- const sidebarToggled = cookies().get(SIDEBAR_TOGGLED_COOKIE_NAME);
+ const sidebarToggled = requestCookies.get(SIDEBAR_TOGGLED_COOKIE_NAME);
result.toggleSidebar = sidebarToggled
? sidebarToggled.value.toLowerCase() === "true"
@@ -223,7 +222,7 @@ export async function fetchSomeChatData(
if (fetchOptions.includes("ccPairs") && result.ccPairs) {
const hasAnyConnectors = result.ccPairs.length > 0;
result.shouldShowWelcomeModal =
- !hasCompletedWelcomeFlowSS() &&
+ !hasCompletedWelcomeFlowSS(requestCookies) &&
!hasAnyConnectors &&
(!user || user.role === "admin");
diff --git a/web/src/lib/userSS.ts b/web/src/lib/userSS.ts
index 8ce25555b2f..55b916d34b3 100644
--- a/web/src/lib/userSS.ts
+++ b/web/src/lib/userSS.ts
@@ -143,7 +143,7 @@ export const getCurrentUserSS = async (): Promise => {
credentials: "include",
next: { revalidate: 0 },
headers: {
- cookie: cookies()
+ cookie: (await cookies())
.getAll()
.map((cookie) => `${cookie.name}=${cookie.value}`)
.join("; "),
diff --git a/web/src/lib/utilsSS.ts b/web/src/lib/utilsSS.ts
index 862804b9261..b54bb1a2be3 100644
--- a/web/src/lib/utilsSS.ts
+++ b/web/src/lib/utilsSS.ts
@@ -15,12 +15,12 @@ export function buildUrl(path: string) {
return `${INTERNAL_URL}/${path}`;
}
-export function fetchSS(url: string, options?: RequestInit) {
+export async function fetchSS(url: string, options?: RequestInit) {
const init = options || {
credentials: "include",
cache: "no-store",
headers: {
- cookie: cookies()
+ cookie: (await cookies())
.getAll()
.map((cookie) => `${cookie.name}=${cookie.value}`)
.join("; "),
diff --git a/web/src/middleware.ts b/web/src/middleware.ts
index 06c106fffc4..a98f24b5f52 100644
--- a/web/src/middleware.ts
+++ b/web/src/middleware.ts
@@ -4,24 +4,26 @@ import { SERVER_SIDE_ONLY__PAID_ENTERPRISE_FEATURES_ENABLED } from "./lib/consta
// NOTE: have to have the "/:path*" here since NextJS doesn't allow any real JS to
// be run before the config is defined e.g. if we try and do a .map it will complain
-const eePaths = [
- "/admin/groups/:path*",
- "/admin/api-key/:path*",
- "/admin/performance/usage/:path*",
- "/admin/performance/query-history/:path*",
- "/admin/whitelabeling/:path*",
- "/admin/performance/custom-analytics/:path*",
- "/admin/standard-answer/:path*",
- ...(process.env.NEXT_PUBLIC_CLOUD_ENABLED
- ? ["/admin/cloud-settings/:path*"]
- : []),
-];
+export const config = {
+ matcher: [
+ "/admin/groups/:path*",
+ "/admin/api-key/:path*",
+ "/admin/performance/usage/:path*",
+ "/admin/performance/query-history/:path*",
+ "/admin/whitelabeling/:path*",
+ "/admin/performance/custom-analytics/:path*",
+ "/admin/standard-answer/:path*",
+
+ // Cloud only
+ "/admin/cloud-settings/:path*",
+ ],
+};
// removes the "/:path*" from the end
const stripPath = (path: string) =>
path.replace(/(.*):\path\*$/, "$1").replace(/\/$/, "");
-const strippedEEPaths = eePaths.map(stripPath);
+const strippedEEPaths = config.matcher.map(stripPath);
export async function middleware(request: NextRequest) {
if (SERVER_SIDE_ONLY__PAID_ENTERPRISE_FEATURES_ENABLED) {
@@ -43,8 +45,3 @@ export async function middleware(request: NextRequest) {
// Continue with the response if no rewrite is needed
return NextResponse.next();
}
-
-// Specify the paths that the middleware should run for
-export const config = {
- matcher: eePaths,
-};
diff --git a/web/tailwind.config.js b/web/tailwind.config.js
index 2cf0ca98aa4..4917e66c6ff 100644
--- a/web/tailwind.config.js
+++ b/web/tailwind.config.js
@@ -1,11 +1,18 @@
var merge = require("lodash/merge");
+// Use relative paths for imports
const baseThemes = require("./tailwind-themes/tailwind.config.js");
-const customThemes = process.env.NEXT_PUBLIC_THEME
- ? require(
+
+let customThemes = null;
+try {
+ if (process.env.NEXT_PUBLIC_THEME) {
+ customThemes = require(
`./tailwind-themes/custom/${process.env.NEXT_PUBLIC_THEME}/tailwind.config.js`
- )
- : null;
+ );
+ }
+} catch (error) {
+ console.warn(`Custom theme not found for: ${process.env.NEXT_PUBLIC_THEME}`);
+}
/** @type {import('tailwindcss').Config} */
module.exports = customThemes ? merge(baseThemes, customThemes) : baseThemes;