Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.11.2 #301

Merged
merged 2 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app",
"private": true,
"version": "1.11.1",
"version": "1.11.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
1 change: 1 addition & 0 deletions app/ui/src/@types/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type BotSettings = {
autoResetSession: boolean;
autoSyncDataSources: boolean;
internetSearchEnabled: boolean;
internalSearchEnabled: boolean;
};
chatModel: {
label: string;
Expand Down
137 changes: 82 additions & 55 deletions app/ui/src/Layout/BotLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,57 @@ import {
PuzzlePieceIcon,
EyeDropperIcon,
ChatBubbleLeftRightIcon,
//MagnifyingGlassIcon,
MagnifyingGlassIcon,
} from "@heroicons/react/24/outline";

import { Link, useParams, useLocation, useNavigate } from "react-router-dom";
import { useAuth } from "../context/AuthContext";
import { Tooltip } from "antd";
import { ApplicationMenu } from "./ApplicationMenu";
import { useSettings } from "../hooks/useSettings";

const navigation = [
{
name: "Playground",
href: "/bot/:id",
icon: SparklesIcon,
key: "playground",
},
// {
// name: "Search (Beta)",
// href: "/bot/:id/search",
// icon: MagnifyingGlassIcon,
// },
{
name: "Data Sources",
href: "/bot/:id/data-sources",
icon: CircleStackIcon,
key: "data-sources",
},
{
name: "Search (Beta)",
href: "/bot/:id/search",
icon: MagnifyingGlassIcon,
key: "search",
},
{
name: "Integrations",
href: "/bot/:id/integrations",
icon: PuzzlePieceIcon,
key: "integrations",
},
{
name: "Conversations",
href: "/bot/:id/conversations",
icon: ChatBubbleLeftRightIcon,
key: "conversations",
},
{
name: "Appearance",
href: "/bot/:id/appearance",
icon: EyeDropperIcon,
key: "appearance",
},
{
name: "Settings",
href: "/bot/:id/settings",
icon: CogIcon,
key: "settings",
},
];

Expand All @@ -75,6 +83,8 @@ export default function BotLayout({

const { isLogged } = useAuth();

const settings = useSettings();

React.useEffect(() => {
if (!isLogged) {
navigate("/login");
Expand Down Expand Up @@ -153,33 +163,41 @@ export default function BotLayout({
</Link>
<div className="mt-5 h-0 flex-1 overflow-y-auto">
<nav className="space-y-1 px-2">
{navigation.map((item) => (
<Link
key={item.name}
to={{
pathname: item.href.replace(":id", params.id!),
}}
className={classNames(
location.pathname ===
item.href.replace(":id", params.id!)
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
"group flex items-center px-2 py-2 text-base font-medium rounded-md"
)}
>
<item.icon
{navigation.map((item) => {
if (
item.key === "search" &&
!settings?.data?.internalSearchEnabled
) {
return null;
}
return (
<Link
key={item.name}
to={{
pathname: item.href.replace(":id", params.id!),
}}
className={classNames(
location.pathname ===
item.href.replace(":id", params.id!)
? "text-gray-500"
: "text-gray-400 group-hover:text-gray-500",
"mr-4 flex-shrink-0 h-6 w-6"
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
"group flex items-center px-2 py-2 text-base font-medium rounded-md"
)}
aria-hidden="true"
/>
{item.name}
</Link>
))}
>
<item.icon
className={classNames(
location.pathname ===
item.href.replace(":id", params.id!)
? "text-gray-500"
: "text-gray-400 group-hover:text-gray-500",
"mr-4 flex-shrink-0 h-6 w-6"
)}
aria-hidden="true"
/>
{item.name}
</Link>
);
})}
</nav>
</div>
</Dialog.Panel>
Expand Down Expand Up @@ -223,37 +241,46 @@ export default function BotLayout({
<div className="flex flex-grow flex-col overflow-y-auto border-r border-gray-200 bg-white pt-5 dark:bg-[#171717] dark:border-gray-600">
<div className="mt-14 flex flex-grow flex-col">
<nav className="flex-1 space-y-1 px-2 pb-4">
{navigation.map((item) => (
<Tooltip
placement="right"
key={item.name}
title={item.name}
>
<Link
to={{
pathname: item.href.replace(":id", params.id!),
}}
className={classNames(
location.pathname ===
item.href.replace(":id", params.id!)
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
"group flex items-center justify-center px-2 py-2 text-sm font-medium rounded-md"
)}
{navigation.map((item) => {
if (
item.key === "search" &&
!settings.data?.internalSearchEnabled
) {
return null;
}

return (
<Tooltip
placement="right"
key={item.name}
title={item.name}
>
<item.icon
<Link
to={{
pathname: item.href.replace(":id", params.id!),
}}
className={classNames(
location.pathname ===
item.href.replace(":id", params.id!)
? "text-gray-500 dark:text-white"
: "text-gray-400 group-hover:text-gray-500 dark:text-gray-400 dark:group-hover:text-white",
"flex-shrink-0 h-6 w-6"
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
"group flex items-center justify-center px-2 py-2 text-sm font-medium rounded-md"
)}
aria-hidden="true"
/>
</Link>
</Tooltip>
))}
>
<item.icon
className={classNames(
location.pathname ===
item.href.replace(":id", params.id!)
? "text-gray-500 dark:text-white"
: "text-gray-400 group-hover:text-gray-500 dark:text-gray-400 dark:group-hover:text-white",
"flex-shrink-0 h-6 w-6"
)}
aria-hidden="true"
/>
</Link>
</Tooltip>
);
})}
</nav>
</div>
</div>
Expand Down
Loading