Remove unused dependencies and update routing

This commit is contained in:
n4ze3m
2024-02-17 00:01:07 +05:30
parent 8e6cd7eca8
commit d763c286c1
9 changed files with 57 additions and 83 deletions

View File

@@ -24,8 +24,8 @@ export default function Markdown({ message }: { message: string }) {
<React.Fragment>
<ReactMarkdown
className="prose break-words dark:prose-invert text-sm prose-p:leading-relaxed prose-pre:p-0 dark:prose-dark"
// remarkPlugins={[remarkGfm, remarkMath]}
// rehypePlugins={[rehypeMathjax]}
remarkPlugins={[remarkGfm, remarkMath]}
rehypePlugins={[rehypeMathjax]}
components={{
code({ node, inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || "")

View File

@@ -1,51 +1,20 @@
import React, { Fragment, useState } from "react"
import { Dialog, Menu, Transition } from "@headlessui/react"
import {
Bars3BottomLeftIcon,
XMarkIcon,
TagIcon,
CircleStackIcon,
CogIcon,
ChatBubbleLeftIcon,
Bars3Icon,
Bars4Icon,
ArrowPathIcon
} from "@heroicons/react/24/outline"
import logoImage from "data-base64:~assets/icon.png"
import React, { useState } from "react"
import { CogIcon } from "@heroicons/react/24/outline"
import { Link, useParams, useLocation, useNavigate } from "react-router-dom"
import { useLocation, NavLink } from "react-router-dom"
import { Sidebar } from "./Sidebar"
import { Drawer, Layout, Modal, Select } from "antd"
import { Drawer, Layout, Modal, Select, Tooltip } from "antd"
import { useQuery } from "@tanstack/react-query"
import { fetchModels } from "~services/ollama"
import { useMessageOption } from "~hooks/useMessageOption"
import { GithubIcon, PanelLeftIcon, Settings2, SquarePen } from "lucide-react"
import {
GithubIcon,
PanelLeftIcon,
BrainCircuit,
SquarePen,
ChevronLeft
} from "lucide-react"
import { Settings } from "./Settings"
import { useDarkMode } from "~hooks/useDarkmode"
const navigation = [
{ name: "Embed", href: "/bot/:id", icon: TagIcon },
{
name: "Preview",
href: "/bot/:id/preview",
icon: ChatBubbleLeftIcon
},
{
name: "Data Sources",
href: "/bot/:id/data-sources",
icon: CircleStackIcon
},
{
name: "Settings",
href: "/bot/:id/settings",
icon: CogIcon
}
]
//@ts-ignore -
function classNames(...classes) {
return classes.filter(Boolean).join(" ")
}
export default function OptionLayout({
children
@@ -58,19 +27,29 @@ export default function OptionLayout({
const {
data: models,
isLoading: isModelsLoading,
refetch: refetchModels,
isFetching: isModelsFetching
} = useQuery({
queryKey: ["fetchModel"],
queryFn: fetchModels
queryFn: fetchModels,
refetchInterval: 15000
})
const { pathname } = useLocation()
const { selectedModel, setSelectedModel, clearChat } = useMessageOption()
return (
<Layout className="bg-white dark:bg-[#171717] md:flex">
<div className="flex items-center p-3 fixed flex-row justify-between border-b border-gray-200 dark:border-gray-600 bg-white dark:bg-[#171717] w-full z-10">
<div className="flex items-center flex-row gap-3">
{pathname !== "/" && (
<div>
<NavLink
to="/"
className="text-gray-500 items-center dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">
<ChevronLeft className="w-6 h-6" />
</NavLink>
</div>
)}
<div>
<button
className="text-gray-500 dark:text-gray-400"
@@ -109,13 +88,22 @@ export default function OptionLayout({
/>
</div>
</div>
<div className="flex gap-3 items-center">
<a
href="https://github.com/n4ze3m/page-assist"
target="_blank"
className="text-gray-500 dark:text-gray-400">
<GithubIcon className="w-6 h-6" />
</a>
<div className="flex gap-4 items-center">
<Tooltip title="Github Repository">
<a
href="https://github.com/n4ze3m/page-assist"
target="_blank"
className="text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">
<GithubIcon className="w-6 h-6" />
</a>
</Tooltip>
<Tooltip title="Manage Ollama Models">
<NavLink
to="/models"
className="text-gray-500 dark:text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">
<BrainCircuit className="w-6 h-6" />
</NavLink>
</Tooltip>
<button
onClick={() => setOpen(true)}
className="text-gray-500 dark:text-gray-400">

View File

@@ -4,7 +4,6 @@ import { useMessage } from "../../../hooks/useMessage"
export const PlaygroundNewChat = () => {
const { setHistory, setMessages, setHistoryId } = useMessage()
const handleClick = () => {
setHistoryId(null)
setMessages([])