Skip to content

Commit 62cdb3b

Browse files
authored
Merge pull request #301 from n4ze3m/next
v1.11.2
2 parents 9def27a + 5193c58 commit 62cdb3b

File tree

17 files changed

+216
-116
lines changed

17 files changed

+216
-116
lines changed

app/ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "app",
33
"private": true,
4-
"version": "1.11.1",
4+
"version": "1.11.2",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

app/ui/src/@types/bot.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type BotSettings = {
2323
autoResetSession: boolean;
2424
autoSyncDataSources: boolean;
2525
internetSearchEnabled: boolean;
26+
internalSearchEnabled: boolean;
2627
};
2728
chatModel: {
2829
label: string;

app/ui/src/Layout/BotLayout.tsx

+82-55
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,57 @@ import {
99
PuzzlePieceIcon,
1010
EyeDropperIcon,
1111
ChatBubbleLeftRightIcon,
12-
//MagnifyingGlassIcon,
12+
MagnifyingGlassIcon,
1313
} from "@heroicons/react/24/outline";
1414

1515
import { Link, useParams, useLocation, useNavigate } from "react-router-dom";
1616
import { useAuth } from "../context/AuthContext";
1717
import { Tooltip } from "antd";
1818
import { ApplicationMenu } from "./ApplicationMenu";
19+
import { useSettings } from "../hooks/useSettings";
1920

2021
const navigation = [
2122
{
2223
name: "Playground",
2324
href: "/bot/:id",
2425
icon: SparklesIcon,
26+
key: "playground",
2527
},
26-
// {
27-
// name: "Search (Beta)",
28-
// href: "/bot/:id/search",
29-
// icon: MagnifyingGlassIcon,
30-
// },
3128
{
3229
name: "Data Sources",
3330
href: "/bot/:id/data-sources",
3431
icon: CircleStackIcon,
32+
key: "data-sources",
33+
},
34+
{
35+
name: "Search (Beta)",
36+
href: "/bot/:id/search",
37+
icon: MagnifyingGlassIcon,
38+
key: "search",
3539
},
3640
{
3741
name: "Integrations",
3842
href: "/bot/:id/integrations",
3943
icon: PuzzlePieceIcon,
44+
key: "integrations",
4045
},
4146
{
4247
name: "Conversations",
4348
href: "/bot/:id/conversations",
4449
icon: ChatBubbleLeftRightIcon,
50+
key: "conversations",
4551
},
4652
{
4753
name: "Appearance",
4854
href: "/bot/:id/appearance",
4955
icon: EyeDropperIcon,
56+
key: "appearance",
5057
},
5158
{
5259
name: "Settings",
5360
href: "/bot/:id/settings",
5461
icon: CogIcon,
62+
key: "settings",
5563
},
5664
];
5765

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

7684
const { isLogged } = useAuth();
7785

86+
const settings = useSettings();
87+
7888
React.useEffect(() => {
7989
if (!isLogged) {
8090
navigate("/login");
@@ -153,33 +163,41 @@ export default function BotLayout({
153163
</Link>
154164
<div className="mt-5 h-0 flex-1 overflow-y-auto">
155165
<nav className="space-y-1 px-2">
156-
{navigation.map((item) => (
157-
<Link
158-
key={item.name}
159-
to={{
160-
pathname: item.href.replace(":id", params.id!),
161-
}}
162-
className={classNames(
163-
location.pathname ===
164-
item.href.replace(":id", params.id!)
165-
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
166-
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
167-
"group flex items-center px-2 py-2 text-base font-medium rounded-md"
168-
)}
169-
>
170-
<item.icon
166+
{navigation.map((item) => {
167+
if (
168+
item.key === "search" &&
169+
!settings?.data?.internalSearchEnabled
170+
) {
171+
return null;
172+
}
173+
return (
174+
<Link
175+
key={item.name}
176+
to={{
177+
pathname: item.href.replace(":id", params.id!),
178+
}}
171179
className={classNames(
172180
location.pathname ===
173181
item.href.replace(":id", params.id!)
174-
? "text-gray-500"
175-
: "text-gray-400 group-hover:text-gray-500",
176-
"mr-4 flex-shrink-0 h-6 w-6"
182+
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
183+
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
184+
"group flex items-center px-2 py-2 text-base font-medium rounded-md"
177185
)}
178-
aria-hidden="true"
179-
/>
180-
{item.name}
181-
</Link>
182-
))}
186+
>
187+
<item.icon
188+
className={classNames(
189+
location.pathname ===
190+
item.href.replace(":id", params.id!)
191+
? "text-gray-500"
192+
: "text-gray-400 group-hover:text-gray-500",
193+
"mr-4 flex-shrink-0 h-6 w-6"
194+
)}
195+
aria-hidden="true"
196+
/>
197+
{item.name}
198+
</Link>
199+
);
200+
})}
183201
</nav>
184202
</div>
185203
</Dialog.Panel>
@@ -223,37 +241,46 @@ export default function BotLayout({
223241
<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">
224242
<div className="mt-14 flex flex-grow flex-col">
225243
<nav className="flex-1 space-y-1 px-2 pb-4">
226-
{navigation.map((item) => (
227-
<Tooltip
228-
placement="right"
229-
key={item.name}
230-
title={item.name}
231-
>
232-
<Link
233-
to={{
234-
pathname: item.href.replace(":id", params.id!),
235-
}}
236-
className={classNames(
237-
location.pathname ===
238-
item.href.replace(":id", params.id!)
239-
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
240-
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
241-
"group flex items-center justify-center px-2 py-2 text-sm font-medium rounded-md"
242-
)}
244+
{navigation.map((item) => {
245+
if (
246+
item.key === "search" &&
247+
!settings.data?.internalSearchEnabled
248+
) {
249+
return null;
250+
}
251+
252+
return (
253+
<Tooltip
254+
placement="right"
255+
key={item.name}
256+
title={item.name}
243257
>
244-
<item.icon
258+
<Link
259+
to={{
260+
pathname: item.href.replace(":id", params.id!),
261+
}}
245262
className={classNames(
246263
location.pathname ===
247264
item.href.replace(":id", params.id!)
248-
? "text-gray-500 dark:text-white"
249-
: "text-gray-400 group-hover:text-gray-500 dark:text-gray-400 dark:group-hover:text-white",
250-
"flex-shrink-0 h-6 w-6"
265+
? "bg-gray-100 text-gray-900 dark:bg-[#262626] dark:text-white"
266+
: "text-gray-600 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white dark:hover:bg-[#262626]",
267+
"group flex items-center justify-center px-2 py-2 text-sm font-medium rounded-md"
251268
)}
252-
aria-hidden="true"
253-
/>
254-
</Link>
255-
</Tooltip>
256-
))}
269+
>
270+
<item.icon
271+
className={classNames(
272+
location.pathname ===
273+
item.href.replace(":id", params.id!)
274+
? "text-gray-500 dark:text-white"
275+
: "text-gray-400 group-hover:text-gray-500 dark:text-gray-400 dark:group-hover:text-white",
276+
"flex-shrink-0 h-6 w-6"
277+
)}
278+
aria-hidden="true"
279+
/>
280+
</Link>
281+
</Tooltip>
282+
);
283+
})}
257284
</nav>
258285
</div>
259286
</div>

0 commit comments

Comments
 (0)