mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-09 12:30:49 +02:00
Add env variable to allow people to control what clicking on New Chat does
This commit is contained in:
parent
a8cc3d5a07
commit
563df1f952
@ -183,6 +183,7 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING:-false}
|
||||
- NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA=${NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA:-false}
|
||||
depends_on:
|
||||
- api_server
|
||||
restart: always
|
||||
|
@ -68,6 +68,7 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING:-false}
|
||||
- NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA=${NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA:-false}
|
||||
depends_on:
|
||||
- api_server
|
||||
restart: always
|
||||
|
@ -68,6 +68,7 @@ services:
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
- NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING:-false}
|
||||
- NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA=${NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA:-false}
|
||||
depends_on:
|
||||
- api_server
|
||||
restart: always
|
||||
|
@ -35,6 +35,9 @@ ENV NEXT_TELEMETRY_DISABLED 1
|
||||
ARG NEXT_PUBLIC_DISABLE_STREAMING
|
||||
ENV NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING}
|
||||
|
||||
ARG NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA
|
||||
ENV NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA=${NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA}
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Step 3. Production image, copy all the files and run next
|
||||
@ -70,6 +73,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
ARG NEXT_PUBLIC_DISABLE_STREAMING
|
||||
ENV NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING}
|
||||
|
||||
ARG NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA
|
||||
ENV NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA=${NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA}
|
||||
|
||||
# Note: Don't expose ports here, Compose will handle that for us if necessary.
|
||||
# If you want to run this without compose, specify the ports to
|
||||
# expose via cli
|
||||
|
@ -505,7 +505,9 @@ export const Chat = ({
|
||||
|
||||
{documentSidebarInitialWidth !== undefined ? (
|
||||
<>
|
||||
<div className="w-full sm:relative h-screen pb-[140px]">
|
||||
<div
|
||||
className={`w-full sm:relative h-screen ${retrievalDisabled ? "pb-[111px]" : "pb-[140px]"}`}
|
||||
>
|
||||
<div
|
||||
className={`w-full h-full ${HEADER_PADDING} flex flex-col overflow-y-auto overflow-x-hidden relative`}
|
||||
ref={scrollableDivRef}
|
||||
@ -697,7 +699,21 @@ export const Chat = ({
|
||||
selectedPersona &&
|
||||
messageHistory.length === 0 &&
|
||||
!isFetchingChatMessages && (
|
||||
<div className="mx-auto px-4 w-searchbar-xs 2xl:w-searchbar-sm 3xl:w-searchbar grid gap-4 grid-cols-1 grid-rows-1 mt-4 md:grid-cols-2">
|
||||
<div
|
||||
className={`
|
||||
mx-auto
|
||||
px-4
|
||||
w-searchbar-xs
|
||||
2xl:w-searchbar-sm
|
||||
3xl:w-searchbar
|
||||
grid
|
||||
gap-4
|
||||
grid-cols-1
|
||||
grid-rows-1
|
||||
mt-4
|
||||
md:grid-cols-2
|
||||
mb-6`}
|
||||
>
|
||||
{livePersona.starter_messages.map((starterMessage, i) => (
|
||||
<div key={i} className="w-full">
|
||||
<StarterMessage
|
||||
|
@ -48,7 +48,7 @@ export function ChatLayout({
|
||||
<div className="flex relative bg-background text-default overflow-x-hidden">
|
||||
<ChatSidebar
|
||||
existingChats={chatSessions}
|
||||
currentChatId={chatId}
|
||||
currentChatSession={selectedChatSession}
|
||||
user={user}
|
||||
/>
|
||||
|
||||
|
@ -14,21 +14,23 @@ import { useRouter } from "next/navigation";
|
||||
import { User } from "@/lib/types";
|
||||
import { logout } from "@/lib/user";
|
||||
import { BasicClickable, BasicSelectable } from "@/components/BasicClickable";
|
||||
import Image from "next/image";
|
||||
import { ChatSessionDisplay } from "./SessionDisplay";
|
||||
import { ChatSession } from "../interfaces";
|
||||
import { groupSessionsByDateRange } from "../lib";
|
||||
import { HEADER_PADDING } from "@/lib/constants";
|
||||
import {
|
||||
HEADER_PADDING,
|
||||
NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA,
|
||||
} from "@/lib/constants";
|
||||
|
||||
interface ChatSidebarProps {
|
||||
existingChats: ChatSession[];
|
||||
currentChatId: number | null;
|
||||
currentChatSession: ChatSession | null | undefined;
|
||||
user: User | null;
|
||||
}
|
||||
|
||||
export const ChatSidebar = ({
|
||||
existingChats,
|
||||
currentChatId,
|
||||
currentChatSession,
|
||||
user,
|
||||
}: ChatSidebarProps) => {
|
||||
const router = useRouter();
|
||||
@ -65,6 +67,8 @@ export const ChatSidebar = ({
|
||||
};
|
||||
}, []);
|
||||
|
||||
const currentChatId = currentChatSession?.id;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`
|
||||
@ -79,7 +83,15 @@ export const ChatSidebar = ({
|
||||
transition-transform`}
|
||||
id="chat-sidebar"
|
||||
>
|
||||
<Link href="/chat" className="mx-3 mt-5">
|
||||
<Link
|
||||
href={
|
||||
"/chat" +
|
||||
(NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA && currentChatSession
|
||||
? `?personaId=${currentChatSession.persona_id}`
|
||||
: "")
|
||||
}
|
||||
className="mx-3 mt-5"
|
||||
>
|
||||
<BasicClickable fullWidth>
|
||||
<div className="flex text-sm">
|
||||
<FiPlusSquare className="my-auto mr-2" /> New Chat
|
||||
|
@ -4,6 +4,10 @@ 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_NEW_CHAT_DIRECTS_TO_SAME_PERSONA =
|
||||
process.env.NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA?.toLowerCase() ===
|
||||
"true";
|
||||
|
||||
export const GMAIL_AUTH_IS_ADMIN_COOKIE_NAME = "gmail_auth_is_admin";
|
||||
|
||||
export const GOOGLE_DRIVE_AUTH_IS_ADMIN_COOKIE_NAME =
|
||||
|
Loading…
x
Reference in New Issue
Block a user