Skip to content

Commit 748d609

Browse files
committed
cleanup and rag use only for admin
1 parent b742f10 commit 748d609

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { useParams } from 'react-router-dom'
22
import useCourse from '../../hooks/useCourse'
33
import useUserStatus from '../../hooks/useUserStatus'
4-
import { useRef, useState, useContext, useEffect } from 'react'
4+
import { useRef, useState, useContext } from 'react'
55
import useLocalStorageState from '../../hooks/useLocalStorageState'
66
import { DEFAULT_MODEL } from '../../../config'
77
import useInfoTexts from '../../hooks/useInfoTexts'
88
import { Message } from '../../types'
9-
import { FileCitation, FileSearchResult, ResponseStreamEventData } from '../../../shared/types'
9+
import { FileSearchResult, ResponseStreamEventData } from '../../../shared/types'
1010
import useRetryTimeout from '../../hooks/useRetryTimeout'
1111
import { useTranslation } from 'react-i18next'
1212
import { handleCompletionStreamError } from './error'
13-
import { Box, Button, IconButton, Modal, Typography } from '@mui/material'
13+
import { Box, Button, IconButton } from '@mui/material'
1414
import { Disclaimer } from './Disclaimer'
1515
import { Conversation } from './Conversation'
1616
import { ChatBox } from './ChatBox'
1717
import { getCompletionStream } from './util'
1818
import { SystemPrompt } from './System'
1919
import { AppContext } from '../../util/context'
20-
import { Close, Settings } from '@mui/icons-material'
20+
import { Settings } from '@mui/icons-material'
2121
import { SettingsModal } from './SettingsModal'
2222
import { Link } from 'react-router-dom'
2323
import { useScrollToBottom } from './useScrollToBottom'

src/client/components/ChatV2/Conversation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Message } from '../../types'
33
import ReactMarkdown from 'react-markdown'
44
import remarkGfm from 'remark-gfm'
55
import { Assistant } from '@mui/icons-material'
6-
import { FileCitation, FileSearchResult } from '../../../shared/types'
6+
import { FileSearchResult } from '../../../shared/types'
77

88
const MessageItem = ({ message }: { message: Message }) => (
99
<Paper

src/client/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FileSearchResult } from "../shared/types"
1+
import { FileSearchResult } from '../shared/types'
22

33
export type SetState<T> = React.Dispatch<React.SetStateAction<T>>
44

src/server/routes/openai.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ openaiRouter.post('/stream/v2', upload.single('file'), async (r, res) => {
155155
let vectorStoreId: string | undefined = undefined
156156
let instructions: string | undefined = undefined
157157

158-
if (ragIndexId) {
158+
if (ragIndexId && user.isAdmin) {
159159
const ragIndex = await RagIndex.findByPk(ragIndexId)
160160
if (ragIndex) {
161161
if (courseId && ragIndex.courseId !== courseId) {

0 commit comments

Comments
 (0)