mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-02 08:58:11 +02:00
Misc bug fixes (#1895)
This commit is contained in:
parent
f91b92a898
commit
1276732409
@ -64,7 +64,7 @@ class DiscourseConnector(PollConnector):
|
||||
self.permissions: DiscoursePerms | None = None
|
||||
self.active_categories: set | None = None
|
||||
|
||||
@rate_limit_builder(max_calls=100, period=60)
|
||||
@rate_limit_builder(max_calls=50, period=60)
|
||||
def _make_request(self, endpoint: str, params: dict | None = None) -> Response:
|
||||
if not self.permissions:
|
||||
raise ConnectorMissingCredentialError("Discourse")
|
||||
|
@ -14,15 +14,18 @@ export function ChatBanner() {
|
||||
return (
|
||||
<div
|
||||
className={`
|
||||
z-[39]
|
||||
h-[30px]
|
||||
bg-background-100
|
||||
shadow-sm
|
||||
m-2
|
||||
rounded
|
||||
border-border
|
||||
border
|
||||
flex`}
|
||||
mt-8
|
||||
mb-2
|
||||
mx-2
|
||||
z-[39]
|
||||
w-full
|
||||
h-[30px]
|
||||
bg-background-100
|
||||
shadow-sm
|
||||
rounded
|
||||
border-border
|
||||
border
|
||||
flex`}
|
||||
>
|
||||
<div className="mx-auto text-emphasis text-sm flex flex-col">
|
||||
<div className="my-auto">
|
||||
|
@ -1203,6 +1203,23 @@ export function ChatPage({
|
||||
currentChatSession={selectedChatSession}
|
||||
/>
|
||||
)}
|
||||
<div className="w-full flex">
|
||||
<div
|
||||
style={{ transition: "width 0.30s ease-out" }}
|
||||
className={`
|
||||
flex-none
|
||||
overflow-y-hidden
|
||||
bg-background-100
|
||||
transition-all
|
||||
bg-opacity-80
|
||||
duration-300
|
||||
ease-in-out
|
||||
h-full
|
||||
${toggledSidebar || showDocSidebar ? "w-[300px]" : "w-[0px]"}
|
||||
`}
|
||||
/>
|
||||
<ChatBanner />
|
||||
</div>
|
||||
{documentSidebarInitialWidth !== undefined ? (
|
||||
<Dropzone onDrop={handleImageUpload} noClick>
|
||||
{({ getRootProps }) => (
|
||||
@ -1231,8 +1248,7 @@ export function ChatPage({
|
||||
ref={scrollableDivRef}
|
||||
>
|
||||
{/* ChatBanner is a custom banner that displays a admin-specified message at
|
||||
the top of the chat page. Only used in the EE version of the app. */}
|
||||
<ChatBanner />
|
||||
the top of the chat page. Oly used in the EE version of the app. */}
|
||||
|
||||
{messageHistory.length === 0 &&
|
||||
!isFetchingChatMessages &&
|
||||
|
@ -99,22 +99,28 @@ export const HistorySidebar = forwardRef<HTMLDivElement, HistorySidebarProps>(
|
||||
h-screen
|
||||
transition-transform`}
|
||||
>
|
||||
<div className="ml-4 mr-3 flex flex gap-x-1 items-center mt-2 my-auto text-text-700 text-xl">
|
||||
<div className="mr-1 my-auto h-6 w-6">
|
||||
<div className="max-w-full ml-3 mr-3 mt-2 flex flex gap-x-1 items-center my-auto text-text-700 text-xl">
|
||||
<div className="mr-1 mb-auto h-6 w-6">
|
||||
<Logo height={24} width={24} />
|
||||
</div>
|
||||
|
||||
<div className="invisible">
|
||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||
<div>
|
||||
<HeaderTitle>
|
||||
{enterpriseSettings.application_name}
|
||||
</HeaderTitle>
|
||||
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
||||
<p className="text-xs text-subtle">Powered by Danswer</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<HeaderTitle>Danswer</HeaderTitle>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{toggleSidebar && (
|
||||
<Tooltip delayDuration={1000} content={`${commandSymbol}E show`}>
|
||||
<button className="ml-auto" onClick={toggleSidebar}>
|
||||
<button className="mb-auto ml-auto" onClick={toggleSidebar}>
|
||||
{!toggled ? <RightToLineIcon /> : <LefToLineIcon />}
|
||||
</button>
|
||||
</Tooltip>
|
||||
|
@ -3,6 +3,7 @@
|
||||
import { HeaderTitle } from "@/components/header/Header";
|
||||
import { Logo } from "@/components/Logo";
|
||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||
import { NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED } from "@/lib/constants";
|
||||
import { useContext } from "react";
|
||||
|
||||
export default function FixedLogo() {
|
||||
@ -11,17 +12,24 @@ export default function FixedLogo() {
|
||||
const enterpriseSettings = combinedSettings?.enterpriseSettings;
|
||||
|
||||
return (
|
||||
<div className="absolute flex z-40 left-4 top-2">
|
||||
{" "}
|
||||
<a href="/chat" className="ml-7 text-text-700 text-xl">
|
||||
<div>
|
||||
<div className="absolute flex z-40 left-2.5 top-2">
|
||||
<div className="max-w-[200px] flex gap-x-1 my-auto">
|
||||
<div className="flex-none invisible mb-auto">
|
||||
<Logo />
|
||||
</div>
|
||||
<div className="">
|
||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||
<div>
|
||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
||||
<p className="text-xs text-subtle">Powered by Danswer</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<HeaderTitle>Danswer</HeaderTitle>
|
||||
)}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -10,12 +10,11 @@ const ToggleSwitch = () => {
|
||||
const commandSymbol = KeyboardSymbol();
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
|
||||
const [activeTab, setActiveTab] = useState(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
return localStorage.getItem("activeTab") || "chat";
|
||||
}
|
||||
return "chat";
|
||||
return pathname == "/search" ? "search" : "chat";
|
||||
});
|
||||
|
||||
const [isInitialLoad, setIsInitialLoad] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -178,7 +178,7 @@ export default async function Home() {
|
||||
: false;
|
||||
|
||||
const agenticSearchEnabled = agenticSearchToggle
|
||||
? agenticSearchToggle.value.toLocaleLowerCase() == "true" || true
|
||||
? agenticSearchToggle.value.toLocaleLowerCase() == "true" || false
|
||||
: false;
|
||||
|
||||
return (
|
||||
|
@ -31,7 +31,10 @@ export function Logo({
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height, width }} className={`relative ${className}`}>
|
||||
<div
|
||||
style={{ height, width }}
|
||||
className={`flex-none relative ${className}`}
|
||||
>
|
||||
{/* TODO: figure out how to use Next Image here */}
|
||||
<img
|
||||
src="/api/enterprise-settings/logo"
|
||||
|
@ -91,7 +91,7 @@ export async function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="h-screen overflow-y-hidden">
|
||||
<div className="flex h-full">
|
||||
<div className="w-64 z-20 bg-background-100 pt-4 pb-8 h-full border-r border-border miniscroll overflow-auto">
|
||||
<div className="w-64 z-20 bg-background-100 pt-3 pb-8 h-full border-r border-border miniscroll overflow-auto">
|
||||
<AdminSidebar
|
||||
collections={[
|
||||
{
|
||||
|
@ -28,9 +28,9 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) {
|
||||
|
||||
return (
|
||||
<aside className="pl-0">
|
||||
<nav className="space-y-2 pl-4">
|
||||
<div className="pb-12 flex">
|
||||
<div className="fixed left-0 top-0 py-2 pl-4 bg-background-100 w-[200px]">
|
||||
<nav className="space-y-2 pl-2">
|
||||
<div className="mb-4 flex">
|
||||
<div className="bg-background-100">
|
||||
<Link
|
||||
className="flex flex-col"
|
||||
href={
|
||||
@ -39,8 +39,8 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) {
|
||||
: "/search"
|
||||
}
|
||||
>
|
||||
<div className="flex gap-x-1 my-auto">
|
||||
<div className="my-auto">
|
||||
<div className="max-w-[200px] flex gap-x-1 my-auto">
|
||||
<div className="flex-none mb-auto">
|
||||
<Logo />
|
||||
</div>
|
||||
<div className="my-auto">
|
||||
@ -50,7 +50,7 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) {
|
||||
{enterpriseSettings.application_name}
|
||||
</HeaderTitle>
|
||||
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
||||
<p className="text-xs text-subtle -mt-1.5">
|
||||
<p className="text-xs text-subtle">
|
||||
Powered by Danswer
|
||||
</p>
|
||||
)}
|
||||
@ -63,14 +63,16 @@ export function AdminSidebar({ collections }: { collections: Collection[] }) {
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<Link href={"/chat"}>
|
||||
<button className="text-sm block w-48 py-2.5 flex px-2 text-left bg-background-200 hover:bg-background-200/80 cursor-pointer rounded">
|
||||
<BackIcon size={20} className="text-neutral" />
|
||||
<p className="ml-1">Back to Danswer</p>
|
||||
</button>
|
||||
</Link>
|
||||
<div className="px-3">
|
||||
<Link href={"/chat"}>
|
||||
<button className="text-sm block w-48 py-2.5 flex px-2 text-left bg-background-200 hover:bg-background-200/80 cursor-pointer rounded">
|
||||
<BackIcon size={20} className="text-neutral" />
|
||||
<p className="ml-1">Back to Danswer</p>
|
||||
</button>
|
||||
</Link>
|
||||
</div>
|
||||
{collections.map((collection, collectionInd) => (
|
||||
<div key={collectionInd}>
|
||||
<div className="px-3" key={collectionInd}>
|
||||
<h2 className="text-xs text-strong font-bold pb-2">
|
||||
<div>{collection.name}</div>
|
||||
</h2>
|
||||
|
@ -59,18 +59,23 @@ export default function FunctionalHeader({
|
||||
<div className="pb-6 left-0 sticky top-0 z-10 w-full relative flex">
|
||||
<div className="mt-2 mx-4 text-text-700 flex w-full">
|
||||
<div className="absolute z-[100] my-auto flex items-center text-xl font-bold">
|
||||
<FiSidebar size={20} />
|
||||
<div className="ml-2 text-text-700 text-xl">
|
||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||
) : (
|
||||
<HeaderTitle>Danswer</HeaderTitle>
|
||||
)}
|
||||
<div className="pt-[2px] mb-auto">
|
||||
<FiSidebar size={20} />
|
||||
</div>
|
||||
<div className="break-words inline-block w-fit ml-2 text-text-700 text-xl">
|
||||
<div className="max-w-[200px]">
|
||||
{enterpriseSettings && enterpriseSettings.application_name ? (
|
||||
<HeaderTitle>{enterpriseSettings.application_name}</HeaderTitle>
|
||||
) : (
|
||||
<HeaderTitle>Danswer</HeaderTitle>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{page == "chat" && (
|
||||
<Tooltip delayDuration={1000} content={`${commandSymbol}U`}>
|
||||
<Link
|
||||
className="mb-auto pt-[2px]"
|
||||
href={
|
||||
`/${page}` +
|
||||
(NEXT_PUBLIC_NEW_CHAT_DIRECTS_TO_SAME_PERSONA &&
|
||||
@ -79,10 +84,9 @@ export default function FunctionalHeader({
|
||||
: "")
|
||||
}
|
||||
>
|
||||
<NewChatIcon
|
||||
size={20}
|
||||
className="ml-2 my-auto cursor-pointer text-text-700 hover:text-text-600 transition-colors duration-300"
|
||||
/>
|
||||
<div className="cursor-pointer ml-2 flex-none text-text-700 hover:text-text-600 transition-colors duration-300">
|
||||
<NewChatIcon size={20} className="" />
|
||||
</div>
|
||||
</Link>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
@ -11,7 +11,11 @@ import { Logo } from "../Logo";
|
||||
import { NEXT_PUBLIC_DO_NOT_USE_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>;
|
||||
return (
|
||||
<h1 className="flex text-2xl text-strong leading-none font-bold">
|
||||
{children}
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
interface HeaderProps {
|
||||
@ -36,8 +40,8 @@ export function Header({ user, page }: HeaderProps) {
|
||||
settings && settings.default_page === "chat" ? "/chat" : "/search"
|
||||
}
|
||||
>
|
||||
<div className="flex my-auto">
|
||||
<div className="mr-1 my-auto">
|
||||
<div className="max-w-[200px] bg-black flex my-auto">
|
||||
<div className="mr-1 mb-auto">
|
||||
<Logo />
|
||||
</div>
|
||||
<div className="my-auto">
|
||||
@ -47,9 +51,7 @@ export function Header({ user, page }: HeaderProps) {
|
||||
{enterpriseSettings.application_name}
|
||||
</HeaderTitle>
|
||||
{!NEXT_PUBLIC_DO_NOT_USE_TOGGLE_OFF_DANSWER_POWERED && (
|
||||
<p className="text-xs text-subtle -mt-1.5">
|
||||
Powered by Danswer
|
||||
</p>
|
||||
<p className="text-xs text-subtle">Powered by Danswer</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
|
Loading…
x
Reference in New Issue
Block a user