mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-06 21:19:54 +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
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING:-false}
|
- 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:
|
depends_on:
|
||||||
- api_server
|
- api_server
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -68,6 +68,7 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING:-false}
|
- 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:
|
depends_on:
|
||||||
- api_server
|
- api_server
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -68,6 +68,7 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- NEXT_PUBLIC_DISABLE_STREAMING=${NEXT_PUBLIC_DISABLE_STREAMING:-false}
|
- 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:
|
depends_on:
|
||||||
- api_server
|
- api_server
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -35,6 +35,9 @@ ENV NEXT_TELEMETRY_DISABLED 1
|
|||||||
ARG NEXT_PUBLIC_DISABLE_STREAMING
|
ARG NEXT_PUBLIC_DISABLE_STREAMING
|
||||||
ENV NEXT_PUBLIC_DISABLE_STREAMING=${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
|
RUN npm run build
|
||||||
|
|
||||||
# Step 3. Production image, copy all the files and run next
|
# 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
|
ARG NEXT_PUBLIC_DISABLE_STREAMING
|
||||||
ENV NEXT_PUBLIC_DISABLE_STREAMING=${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.
|
# 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
|
# If you want to run this without compose, specify the ports to
|
||||||
# expose via cli
|
# expose via cli
|
||||||
|
@ -505,7 +505,9 @@ export const Chat = ({
|
|||||||
|
|
||||||
{documentSidebarInitialWidth !== undefined ? (
|
{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
|
<div
|
||||||
className={`w-full h-full ${HEADER_PADDING} flex flex-col overflow-y-auto overflow-x-hidden relative`}
|
className={`w-full h-full ${HEADER_PADDING} flex flex-col overflow-y-auto overflow-x-hidden relative`}
|
||||||
ref={scrollableDivRef}
|
ref={scrollableDivRef}
|
||||||
@ -697,7 +699,21 @@ export const Chat = ({
|
|||||||
selectedPersona &&
|
selectedPersona &&
|
||||||
messageHistory.length === 0 &&
|
messageHistory.length === 0 &&
|
||||||
!isFetchingChatMessages && (
|
!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) => (
|
{livePersona.starter_messages.map((starterMessage, i) => (
|
||||||
<div key={i} className="w-full">
|
<div key={i} className="w-full">
|
||||||
<StarterMessage
|
<StarterMessage
|
||||||
|
@ -48,7 +48,7 @@ export function ChatLayout({
|
|||||||
<div className="flex relative bg-background text-default overflow-x-hidden">
|
<div className="flex relative bg-background text-default overflow-x-hidden">
|
||||||
<ChatSidebar
|
<ChatSidebar
|
||||||
existingChats={chatSessions}
|
existingChats={chatSessions}
|
||||||
currentChatId={chatId}
|
currentChatSession={selectedChatSession}
|
||||||
user={user}
|
user={user}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -14,21 +14,23 @@ import { useRouter } from "next/navigation";
|
|||||||
import { User } from "@/lib/types";
|
import { User } from "@/lib/types";
|
||||||
import { logout } from "@/lib/user";
|
import { logout } from "@/lib/user";
|
||||||
import { BasicClickable, BasicSelectable } from "@/components/BasicClickable";
|
import { BasicClickable, BasicSelectable } from "@/components/BasicClickable";
|
||||||
import Image from "next/image";
|
|
||||||
import { ChatSessionDisplay } from "./SessionDisplay";
|
import { ChatSessionDisplay } from "./SessionDisplay";
|
||||||
import { ChatSession } from "../interfaces";
|
import { ChatSession } from "../interfaces";
|
||||||
import { groupSessionsByDateRange } from "../lib";
|
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 {
|
interface ChatSidebarProps {
|
||||||
existingChats: ChatSession[];
|
existingChats: ChatSession[];
|
||||||
currentChatId: number | null;
|
currentChatSession: ChatSession | null | undefined;
|
||||||
user: User | null;
|
user: User | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ChatSidebar = ({
|
export const ChatSidebar = ({
|
||||||
existingChats,
|
existingChats,
|
||||||
currentChatId,
|
currentChatSession,
|
||||||
user,
|
user,
|
||||||
}: ChatSidebarProps) => {
|
}: ChatSidebarProps) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -65,6 +67,8 @@ export const ChatSidebar = ({
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const currentChatId = currentChatSession?.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`
|
className={`
|
||||||
@ -79,7 +83,15 @@ export const ChatSidebar = ({
|
|||||||
transition-transform`}
|
transition-transform`}
|
||||||
id="chat-sidebar"
|
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>
|
<BasicClickable fullWidth>
|
||||||
<div className="flex text-sm">
|
<div className="flex text-sm">
|
||||||
<FiPlusSquare className="my-auto mr-2" /> New Chat
|
<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 =
|
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_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 GMAIL_AUTH_IS_ADMIN_COOKIE_NAME = "gmail_auth_is_admin";
|
||||||
|
|
||||||
export const GOOGLE_DRIVE_AUTH_IS_ADMIN_COOKIE_NAME =
|
export const GOOGLE_DRIVE_AUTH_IS_ADMIN_COOKIE_NAME =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user