Skip to content

Commit

Permalink
Merge pull request #174 from n4ze3m/next
Browse files Browse the repository at this point in the history
v1.5.0
  • Loading branch information
n4ze3m authored Dec 14, 2023
2 parents 43287ba + f5e4536 commit b1524e5
Show file tree
Hide file tree
Showing 65 changed files with 1,092 additions and 1,776 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:18-slim as server
WORKDIR /app

RUN apt update && apt -y install g++ make python3
RUN npm install -g node-gyp
# RUN npm install -g node-gyp

COPY ./server/ .

Expand Down Expand Up @@ -32,7 +32,7 @@ RUN yarn config set network-timeout 1200000

RUN apt update && apt -y install --no-install-recommends ca-certificates git git-lfs openssh-client curl jq cmake sqlite3 openssl psmisc python3
RUN apt -y install g++ make
RUN npm install -g node-gyp
# RUN npm install -g node-gyp
RUN apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
RUN npm --no-update-notifier --no-fund --global install pnpm
# Copy API
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ and more...
### Embedding models

- [x] OpenAI
- [x] TensorFlow
- [x] TensorFlow (removed)
- [x] Hugging Face
- [x] Cohere
- [x] all-MiniLM-L6-v2 using [xenova/transformers.js](https://github.com/xenova/transformers.js/)
Expand Down
4 changes: 2 additions & 2 deletions app/ui/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html class="h-full bg-gray-100">
<html class="h-full">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dialoqbase</title>
</head>
<body class="h-full">
<body class="h-full bg-gray-100 dark:bg-black">
<div id="root" class="h-full"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
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.4.6",
"version": "1.5.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
194 changes: 194 additions & 0 deletions app/ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
import { createHashRouter, RouterProvider } from "react-router-dom";
import Root from "./routes/root";
import DashboardLayout from "./Layout";
import NewRoot from "./routes/new/root";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import BotLayout from "./Layout/BotLayout";
import BotEmbedRoot from "./routes/bot/embed";
import BotPreviewRoot from "./routes/bot/playground";
import BotDSRoot from "./routes/bot/ds";
import BotSettingsRoot from "./routes/bot/settings";
import LoginRoot from "./routes/login/root";
import { AuthProvider } from "./context/AuthContext";
import SettingsRoot from "./routes/settings/root";
import BotIntegrationRoot from "./routes/bot/integrations";
import BotAppearanceRoot from "./routes/bot/appearance";
import { ConfigProvider, theme } from "antd";
import { StyleProvider } from "@ant-design/cssinjs";
import BotPlaygroundLayout from "./Layout/BotPlaygroundLayout";
import BotConversationsRoot from "./routes/bot/conversations";
import RegisterRoot from "./routes/register";
import { QueryBoundaries } from "./components/Common/QueryBoundaries";
import SettingsApplicationRoot from "./routes/settings/application";
import SettingsTeamsRoot from "./routes/settings/teams";
import BotIntegrationAPIRoot from "./routes/bot/api";
import SettingsModelRoot from "./routes/settings/model";
import { useDarkMode } from "./hooks/useDarkmode";

const router = createHashRouter([
{
element: (
<DashboardLayout>
<Root />
</DashboardLayout>
),
path: "/",
},
{
element: (
<DashboardLayout>
<NewRoot />
</DashboardLayout>
),
path: "/new",
},
{
path: "/bot/:id/embed",
element: (
<BotLayout>
<BotEmbedRoot />
</BotLayout>
),
},
{
path: "/bot/:id",
element: (
<BotLayout>
<BotPreviewRoot />
</BotLayout>
),
},
{
path: "/bot/:id/playground/:history_id",
element: (
<BotLayout>
<BotPreviewRoot />
</BotLayout>
),
},
{
path: "/bot/:id/conversations",
element: (
<BotPlaygroundLayout>
<BotConversationsRoot />
</BotPlaygroundLayout>
),
},
{
path: "/bot/:id/conversations/:type/:conversation_id",
element: (
<BotPlaygroundLayout>
<BotConversationsRoot />
</BotPlaygroundLayout>
),
},
{
path: "/bot/:id/data-sources",
element: (
<BotLayout>
<BotDSRoot />
</BotLayout>
),
},
{
path: "/bot/:id/settings",
element: (
<BotLayout>
<BotSettingsRoot />
</BotLayout>
),
},
{
path: "/bot/:id/integrations",
element: (
<BotLayout>
<BotIntegrationRoot />
</BotLayout>
),
},
{
path: "/bot/:id/integrations/api",
element: (
<BotLayout>
<BotIntegrationAPIRoot />
</BotLayout>
),
},
{
path: "/bot/:id/appearance",
element: (
<BotLayout>
<BotAppearanceRoot />
</BotLayout>
),
},
{
path: "/login",
element: <LoginRoot />,
},
{
path: "/settings",
element: (
<DashboardLayout>
<QueryBoundaries>
<SettingsRoot />
</QueryBoundaries>
</DashboardLayout>
),
},
{
path: "/settings/application",
element: (
<DashboardLayout>
<QueryBoundaries>
<SettingsApplicationRoot />
</QueryBoundaries>
</DashboardLayout>
),
},
{
path: "/settings/teams",
element: (
<DashboardLayout>
<QueryBoundaries>
<SettingsTeamsRoot />
</QueryBoundaries>
</DashboardLayout>
),
},
{
path: "/settings/model",
element: (
<DashboardLayout>
<QueryBoundaries>
<SettingsModelRoot />
</QueryBoundaries>
</DashboardLayout>
),
},
{
path: "/register",
element: <RegisterRoot />,
},
]);
const queryClient = new QueryClient({});

export default function App() {
const { mode } = useDarkMode();
return (
<ConfigProvider
theme={{
algorithm:
mode === "dark" ? theme.darkAlgorithm : theme.defaultAlgorithm,
}}
>
<StyleProvider hashPriority="high">
<AuthProvider>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
</QueryClientProvider>
</AuthProvider>
</StyleProvider>
</ConfigProvider>
);
}
92 changes: 92 additions & 0 deletions app/ui/src/Layout/ApplicationMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { Menu } from "@headlessui/react";
import { Transition } from "@headlessui/react";
import { Fragment } from "react";
import { useAuth } from "../context/AuthContext";
import Avatar from "../components/Common/Avatar";
import { Link, useNavigate } from "react-router-dom";
import { SunIcon, MoonIcon } from "@heroicons/react/24/outline";
import { useDarkMode } from "../hooks/useDarkmode";

//@ts-ignore
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}

export const ApplicationMenu = () => {
const { profile, logout } = useAuth();
const { mode, toggleDarkMode } = useDarkMode();
const navigate = useNavigate();
return (
<Menu as="div" className="relative ml-3">
<div>
<Menu.Button className="flex max-w-xs items-center rounded-full bg-white text-sm dark:bg-black">
<span className="sr-only">Open user menu</span>
<Avatar username={profile?.username || "admin"} />
</Menu.Button>
</div>
<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
leave="transition ease-in duration-75"
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items className="absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-black dark:border dark:border-gray-800 divide-y divide-gray-100 dark:divide-gray-800">
<Menu.Item>
{({ active }) => (
<Link
className={classNames(
active ? "bg-gray-100" : "",
"block px-4 py-2 text-sm text-gray-700 dark:text-white dark:hover:bg-gray-800 "
)}
to="/settings"
>
Settings
</Link>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<div
className={classNames(
active ? "bg-gray-100" : "",
"block px-4 py-2 text-sm text-gray-700 dark:text-white dark:hover:bg-gray-800 cursor-pointer"
)}
onClick={() => {
toggleDarkMode();
}}
>
<span className="flex items-center">
{mode === "dark" ? (
<SunIcon className="w-5 h-5 mr-2" />
) : (
<MoonIcon className="w-5 h-5 mr-2" />
)}
{mode === "dark" ? "Light mode" : "Dark mode"}
</span>
</div>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<span
className={classNames(
active ? "bg-gray-100" : "",
"block px-4 py-2 text-sm text-red-700 dark:text-red-600 cursor-pointer dark:hover:bg-gray-800"
)}
onClick={() => {
logout();
navigate("/login");
}}
>
Sign out
</span>
)}
</Menu.Item>
</Menu.Items>
</Transition>
</Menu>
);
};
Loading

0 comments on commit b1524e5

Please sign in to comment.