Skip to content

Commit 8f25813

Browse files
authored
Merge pull request #115 from RipeSeed/RIPES-10
[RIPES-10] Removed unnecessary code
2 parents c3f2e7d + f8e9636 commit 8f25813

File tree

41 files changed

+34
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+34
-189
lines changed

.vscode/extentions.json

-8
This file was deleted.

.vscode/settings.json

-14
This file was deleted.

public/ask-rs-landing.png

-565 KB
Binary file not shown.

public/assets/Avatar.png

-4.09 KB
Binary file not shown.

public/assets/Icon.svg

-5
This file was deleted.
File renamed without changes.

public/assets/knowledgebase/message-question.svg

-5
This file was deleted.

public/next.svg

-1
This file was deleted.

public/pencil.png

-367 Bytes
Binary file not shown.

public/vercel.svg

-1
This file was deleted.

src/apis/admin/knowledgeBase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { NextResponse } from 'next/server'
21
import axios from 'axios'
32

43
import axiosInstance from '@/utils/axios'
@@ -93,6 +92,7 @@ interface OPENAIDATA {
9392
xAccessKey?: string
9493
xBaseUrl?: string
9594
}
95+
9696
// add or update credentials
9797
export const AddOpenAIKey = async (data: OPENAIDATA) => {
9898
try {

src/app/(admin)/(auth)/register/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ type FormSchema = z.infer<typeof formSchema>
4444

4545
export default function Auth() {
4646
const router = useRouter()
47-
const { user, setUser } = useTokenStore()
4847
const form = useForm<FormSchema>({ resolver: zodResolver(formSchema) })
4948
const { handleSubmit, control, reset } = form
5049

src/app/(admin)/(auth)/token/page.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use client'
22

33
import Link from 'next/link'
4-
import { zodResolver } from '@hookform/resolvers/zod'
54
import { useForm } from 'react-hook-form'
65
import { z } from 'zod'
76

src/app/(admin)/dashboard/_components/DashboardSideBar/DashboardSideBar.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@ export default function DashboardSideBar() {
7979
className={`flex w-full cursor-pointer items-center space-x-2 rounded-lg p-3 ${item.url === url ? 'bg-dashboardActive' : ''} hover:bg-dashboardActive/80 transition-colors duration-200`}
8080
onClick={() => setIsMobileMenuOpen(false)}
8181
>
82-
<img
82+
<Image
8383
src={`${
8484
item.url === url
8585
? '/assets/knowledgebase/book-shadow.png'
8686
: '/assets/knowledgebase/book.png'
8787
}`}
88-
alt=''
89-
className='h-5 w-5'
88+
alt='book'
89+
width={20}
90+
height={20}
9091
/>
9192

9293
<span className='self-center text-dashboardSidebarFooter'>
@@ -119,7 +120,7 @@ export default function DashboardSideBar() {
119120
disabled={isLoggingOut}
120121
>
121122
<Image
122-
src='/assets/export.svg'
123+
src='/assets/knowledgebase/export.svg'
123124
width={20}
124125
height={20}
125126
alt='LogOut'
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useRef, useState } from 'react'
2+
import Image from 'next/image'
23
import { useMutation, useQueryClient } from '@tanstack/react-query'
34
import { X } from 'lucide-react'
45

@@ -92,9 +93,10 @@ export default function FileUpload({ boxOpen, setBoxOpen }: boxState) {
9293
onDragOver={handleDragOver}
9394
>
9495
<div className='flex h-14 w-14 items-center justify-center rounded-full border-4 border-gray-200 bg-gray-50'>
95-
<img
96+
<Image
9697
src='/assets/knowledgebase/document-upload.svg'
97-
className='h-6 w-6'
98+
height={23}
99+
width={23}
98100
alt='Upload Icon'
99101
/>
100102
</div>
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export default function KnowledgeBasePrompts() {
6262
setButtonDisabled(true)
6363
},
6464
})
65-
// ..........................
6665

6766
const handleClick = () => {
6867
mutate({ user, prompt, modelConfiguration })
@@ -95,10 +94,9 @@ export default function KnowledgeBasePrompts() {
9594
setButtonDisabled(true)
9695
}
9796
}, [PromptData])
98-
// .......................
97+
9998
return (
10099
<div className='flex h-full w-full'>
101-
{/* Left Side */}
102100
<div className='flex-[7] border-r-2 border-solid border-dashboardBorder py-4 pr-6'>
103101
<div className='mb-1 flex flex-col space-y-1 py-4'>
104102
<span className='text-lg font-medium text-dashboardHeading'>
@@ -133,7 +131,6 @@ export default function KnowledgeBasePrompts() {
133131
</div>
134132
</div>
135133

136-
{/* Right Side */}
137134
<div className='flex flex-[3] flex-col gap-6 p-5'>
138135
{/* Presets */}
139136
<div className='flex flex-col space-y-2'>
@@ -145,13 +142,11 @@ export default function KnowledgeBasePrompts() {
145142
</span>
146143
</div>
147144

148-
{/* Sliders */}
149145
<div className='flex flex-col space-y-2'>
150146
<span className='text-sm font-medium text-dashboardHeading'>
151147
Model Configuration
152148
</span>
153149

154-
{/* Temperature */}
155150
<div className='flex flex-col space-y-3'>
156151
<div className='flex justify-between'>
157152
<span className='text-sm text-dashboardSecondaryText'>
@@ -170,8 +165,6 @@ export default function KnowledgeBasePrompts() {
170165
onValueChange={handleTemperatureChange}
171166
/>
172167
</div>
173-
174-
{/* Top P */}
175168
<div className='flex flex-col space-y-3'>
176169
<div className='flex justify-between'>
177170
<span className='text-sm text-dashboardSecondaryText'>Top P</span>
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
import React, { useState } from 'react'
22
import Image from 'next/image'
3-
import { useQuery } from '@tanstack/react-query'
43

5-
import { GetKnowledegeBaseFiles } from '@/apis/admin/knowledgeBase'
64
import { Button } from '@/components/ui/button'
7-
import { useToast } from '@/hooks/use-toast'
85
import DocuementDataTable from './DocuementDataTable'
96
import FileUpload from './FileUpload'
107

118
export default function KnowledegeBaseDocuments() {
12-
const { toast } = useToast()
139
const [boxOpen, setBoxOpen] = useState(false)
1410

15-
// Get all files
16-
const { data: FileData, isLoading: FileLoading } = useQuery({
17-
queryKey: ['getAllFile'],
18-
queryFn: GetKnowledegeBaseFiles,
19-
})
20-
2111
const handleClickOutside = (e: any) => {
2212
if (e.target.id === 'modalOverlay') {
2313
setBoxOpen(false)
@@ -30,7 +20,6 @@ export default function KnowledegeBaseDocuments() {
3020
{boxOpen && <div className='fixed inset-0 z-10 bg-black bg-opacity-50' />}
3121

3222
<div className={`relative ${boxOpen ? 'pointer-events-none' : ''}`}>
33-
{/* Document upload button section */}
3423
<div className='flex flex-[1] items-center justify-between py-4'>
3524
<div className='flex flex-col space-y-1'>
3625
<span className='text-lg font-medium text-dashboardHeading'>
@@ -56,7 +45,6 @@ export default function KnowledegeBaseDocuments() {
5645
</Button>
5746
</div>
5847

59-
{/* Main Documents Table Section */}
6048
<div className='flex-[6.5]'>
6149
<DocuementDataTable />
6250
</div>

src/app/(admin)/dashboard/knowledgebase/_components/KnowledegeBaseTabs/KnowledegeBaseTabs.tsx src/app/(admin)/dashboard/knowledgebase/_components/KnowledegeBaseTabs.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import Image from 'next/image'
33

44
import { Separator } from '@/components/ui/separator'
55
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
6-
import KnowledegBasePrompts from './_components/KnowledegBasePrompts'
7-
import KnowledegeBaseDocuments from './_components/KnowledegeBaseDocuments'
6+
import KnowledegBasePrompts from './KnowledegBasePrompts'
7+
import KnowledegeBaseDocuments from './KnowledegeBaseDocuments'
88

99
export default function KnowledegeBaseTabs() {
1010
const [activeTab, setActiveTab] = React.useState('documents')

src/app/(admin)/dashboard/knowledgebase/page.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Button } from '@/components/ui/button'
1414
import { Label } from '@/components/ui/label'
1515
import { Separator } from '@/components/ui/separator'
1616
import { useToast } from '@/hooks/use-toast'
17-
import KnowledegeBaseTabs from './_components/KnowledegeBaseTabs/KnowledegeBaseTabs'
17+
import KnowledegeBaseTabs from './_components/KnowledegeBaseTabs'
1818

1919
const UpdateSchema = z
2020
.object({
@@ -56,7 +56,6 @@ export default function KnowledgeBase() {
5656
const { toast } = useToast()
5757

5858
const [buttonDisabled, setButtonDisabled] = useState(true)
59-
// Add credentials
6059
const {
6160
mutate,
6261
isPending: botPending,
@@ -73,7 +72,7 @@ export default function KnowledgeBase() {
7372
setButtonDisabled(true)
7473
},
7574
})
76-
// ...............................
75+
7776
const {
7877
register,
7978
handleSubmit,
@@ -87,7 +86,6 @@ export default function KnowledgeBase() {
8786
const { user } = useTokenStore()
8887
const { data } = useSession()
8988

90-
// get Credential
9189
const getData = async () => {
9290
let res = await GetOpenAIData()
9391
if (res?.bot?.[0]) {
@@ -123,7 +121,6 @@ export default function KnowledgeBase() {
123121
onSubmit={handleSubmit(handleClick)}
124122
className='flex flex-col gap-4 p-6'
125123
>
126-
{/* First Row */}
127124
<div className='flex flex-col gap-4 md:flex-row'>
128125
<div className='flex w-full flex-col space-y-2'>
129126
<Label className='flex items-center gap-2 text-dashboardText'>
@@ -161,7 +158,6 @@ export default function KnowledgeBase() {
161158
</Button>
162159
</div>
163160

164-
{/* Second Row */}
165161
<div className='flex flex-col gap-4'>
166162
<div className='flex flex-col gap-4 md:flex-row'>
167163
<div className='flex w-full flex-col space-y-2'>
@@ -228,7 +224,6 @@ export default function KnowledgeBase() {
228224
</div>
229225
</div>
230226

231-
{/* Third Row */}
232227
<div className='flex flex-col gap-4'>
233228
<div className='flex flex-col gap-4 md:flex-row'>
234229
<div className='flex w-full flex-col space-y-2'>

src/app/(admin)/dashboard/layout.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ import { auth } from '@/lib/auth'
44
import { AuthSession } from '../_components/AuthSession'
55
import DashboardSideBar from './_components/DashboardSideBar/DashboardSideBar'
66

7-
interface TSession {
8-
user?: {
9-
id: string
10-
email: string
11-
}
12-
}
13-
147
export default async function DashBoardLayout({
158
children,
169
}: Readonly<{

src/app/(admin)/layout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import React, { useEffect, useMemo } from 'react'
44
import { Manrope } from 'next/font/google'
55
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
6-
import { SessionProvider, useSession } from 'next-auth/react'
6+
import { SessionProvider } from 'next-auth/react'
77

88
import { useTokenStore } from '../(chat)/_utils/store/knowledge-store'
99

@@ -15,7 +15,7 @@ export default function AdminLayout({
1515
children: React.ReactNode
1616
}) {
1717
const queryClient = useMemo(() => new QueryClient(), [])
18-
const { user, setUser } = useTokenStore()
18+
const { setUser } = useTokenStore()
1919

2020
useEffect(() => {
2121
const storedUser = localStorage.getItem('user')

src/app/(chat)/_lib/db/askRSMessages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export async function appendMessageContent(id: number, content: string) {
3131
return await db.askRSMessages.put(message)
3232
}
3333

34-
// delet all messages
34+
// delete all messages
3535
export async function deleteAllMessages(): Promise<void> {
3636
return db.askRSMessages.clear()
3737
}

src/app/(chat)/_utils/store/knowledge-store.ts

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { create } from 'zustand'
22

3-
interface singleQuestion {
4-
title: string
5-
icon: File | null
6-
}
73
interface State {
84
prompt: string
95
modelConfiguration: {

src/app/(chat)/ask-anything/[chatId]/_components/ChatMessageInput.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export function ChatMessageInput({ isPending }: ChatMessageInputProps) {
9191
setMessage('')
9292
if (chatId) router.push(`/ask-anything/${chatId}`)
9393
} else {
94-
//setIsPending(true)
9594
updateStateMetadata({
9695
chatId,
9796
message,

src/app/(chat)/ask-anything/[chatId]/_components/MessageContainer.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { motion } from 'framer-motion'
21
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
32
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism'
43

src/app/(chat)/ask-anything/[chatId]/_components/UploadDocument.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,20 @@ export const UploadDocument = ({ isOpen, setIsOpen }: Props) => {
139139
type='file'
140140
name='file'
141141
multiple={false}
142-
className='w-full cursor-pointer'
142+
className='w-full cursor-pointer rounded-full'
143143
accept='.pdf, .txt'
144144
/>
145145
</div>
146146
</div>
147147
<AlertDialogFooter>
148-
<AlertDialogCancel disabled={isPending}>Cancel</AlertDialogCancel>
149-
<Button type='submit' disabled={isPending} className='bg-crayola'>
148+
<AlertDialogCancel disabled={isPending} className='rounded-full'>
149+
Cancel
150+
</AlertDialogCancel>
151+
<Button
152+
type='submit'
153+
disabled={isPending}
154+
className='rounded-full bg-mintGreen'
155+
>
150156
{isPending ? 'Submitting ...' : 'Add'}
151157
</Button>
152158
</AlertDialogFooter>

src/app/(chat)/ask-anything/_components/ChatList.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { cn } from '@/lib/utils'
2828
import chatICon from '../../../../public/chat.png'
2929

3030
export const ChatList = () => {
31-
const { selectedChat, chats, setSelectedChat, setChats } = useStore()
31+
const { selectedChat, chats, setSelectedChat } = useStore()
3232
const [allChats, setAllChats] = useState<Chat[]>([])
3333

3434
getAllChats().then((chats) => {
@@ -107,18 +107,16 @@ const SidebarChatComponent = ({ chat }: { chat: Chat }) => {
107107
<Button
108108
className={cn(
109109
buttonVariants({ variant: 'default', size: 'lg' }),
110-
`shrink bg-[#FBFBFB] text-gray-500 shadow-none transition-all hover:bg-[#ECECEC] ${variant && 'bg-[#ECECEC] text-primary'
110+
`shrink bg-[#FBFBFB] text-gray-500 shadow-none transition-all hover:bg-[#ECECEC] ${
111+
variant && 'bg-[#ECECEC] text-primary'
111112
}`,
112113
)}
113114
onClick={() => handleSelectedChatChange(chat)}
114115
>
115116
<div className='flex w-full flex-row justify-between'>
116117
<div className='flex justify-start gap-4 truncate'>
117-
{/* // icon */}
118118
<MessagesSquare className='h-4 w-4' />
119-
{/* <span>{truncateString(chat.name, 18)}</span> */}
120119
</div>
121-
{/* //delete scene */}
122120
<Dialog>
123121
<DialogTrigger asChild>
124122
<div className='flex justify-end' onClick={handleDelete}>

0 commit comments

Comments
 (0)