Skip to content

Commit ce2e65b

Browse files
committed
feat: force chat v2 usage and remove chat preference
1 parent 9e45a5b commit ce2e65b

File tree

6 files changed

+8
-57
lines changed

6 files changed

+8
-57
lines changed

src/client/Router.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { createBrowserRouter, createRoutesFromElements, Navigate, Route, RouterP
44
import { PUBLIC_URL } from '../config'
55
import App from './App'
66
import Admin from './components/Admin'
7-
import Chat from './components/Chat'
87
import Chats from './components/Chats'
98
import { ChatV2 } from './components/ChatV2/ChatV2'
109
import Courses from './components/Courses'
@@ -16,28 +15,24 @@ import Rag from './components/Rag/Rag'
1615
import { RagFile } from './components/Rag/RagFile'
1716
import { RagIndex } from './components/Rag/RagIndex'
1817
import Statistics from './components/Statistics'
19-
import useCurrentUser from './hooks/useCurrentUser'
2018

2119
const sentryCreateBrowserRouter = Sentry.wrapCreateBrowserRouterV6(createBrowserRouter)
2220

2321
const PreferenceRedirect = () => {
24-
const { user } = useCurrentUser()
2522
const { courseId } = useParams()
26-
const chatVersion = user?.preferences?.chatVersion ?? 1
27-
return <Navigate to={(chatVersion === 1 ? '/v1' : '/v2') + (courseId ? `/${courseId}` : '')} replace />
23+
return <Navigate to={'/v2' + (courseId ? `/${courseId}` : '')} replace />
2824
}
2925

3026
const router = sentryCreateBrowserRouter(
3127
createRoutesFromElements(
3228
<Route path="/" element={<App />} ErrorBoundary={ErrorPage}>
3329
<Route index element={<PreferenceRedirect />} />
34-
<Route path="/v1" element={<Chat />} />
30+
<Route path="/v1" element={<Navigate to="/v2" replace />} />
3531
<Route path="/v2" element={<ChatV2 />} />
3632

3733
<Route path="/:courseId" element={<PreferenceRedirect />} />
3834
<Route path="/v2/:courseId" element={<ChatV2 />} />
39-
<Route path="/v1/:courseId" element={<Chat />} />
40-
35+
<Route path="/v1/:courseId" element={<Navigate to="/v2:courseId" replace />} />
4136
<Route path="/courses" element={<Courses />} />
4237
<Route path="/courses/:id/*" element={<Course />} />
4338
<Route path="/admin/*" element={<Admin />} />

src/client/components/Chat/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import useUserStatus from '../../hooks/useUserStatus'
2121
import { handleCompletionStreamError } from './error'
2222
import PromptSelector from './PromptSelector'
2323
import TokenUsageWarning from './TokenUsageWarning'
24-
import { TestUseInfoV1 } from '../ChatV2/TestUseInfo'
2524
import useCurrentUser from '../../hooks/useCurrentUser'
2625

2726
const WAIT_FOR_STREAM_TIMEOUT = 4000
@@ -298,11 +297,11 @@ const Chat = () => {
298297
userConsent
299298
? []
300299
: [
301-
{
302-
role: 'user',
303-
content: message + (file ? '\n\nFile content:\n\n' : ''),
304-
},
305-
],
300+
{
301+
role: 'user',
302+
content: message + (file ? '\n\nFile content:\n\n' : ''),
303+
},
304+
],
306305
),
307306
model,
308307
formData,
@@ -364,7 +363,6 @@ const Chat = () => {
364363
<Container sx={{ mt: '4rem', mb: '10rem' }} maxWidth="xl">
365364
<Banner disclaimer={disclaimer} />
366365
{course && <CourseInfo course={course} />}
367-
{(user?.preferences?.chatVersion ?? 1) !== 1 && <TestUseInfoV1 />}
368366
<Box sx={{ mb: 3 }} />
369367

370368
{hasPrompts && <PromptSelector prompts={course.prompts} activePrompt={activePromptId} setActivePrompt={handleChangePrompt} />}

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import { OutlineButtonBlack } from './general/Buttons'
3333
import { ChatInfo } from './general/ChatInfo'
3434
import RagSelector from './RagSelector'
3535
import { SettingsModal } from './SettingsModal'
36-
import { TestUseInfoV2 } from './TestUseInfo'
3736
import { useChatStream } from './useChatStream'
3837
import { getCompletionStreamV3 } from './util'
3938

@@ -435,8 +434,6 @@ export const ChatV2 = () => {
435434
}}
436435
ref={scrollRef}
437436
>
438-
{user?.preferences?.chatVersion !== 2 && <TestUseInfoV2 />}
439-
440437
{course?.saveDiscussions && (
441438
<Paper
442439
variant="outlined"

src/client/components/ChatV2/TestUseInfo.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/client/components/NavBar/index.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,6 @@ const NavItems = ({ user, t, languages, handleLanguageChange, language, vertical
117117

118118
return (
119119
<>
120-
{user.preferences?.chatVersion !== 2 && (
121-
<NavItemButton to="/v2" path="v2/*" current={pathname} icon={<GradeOutlined sx={styles.icon} />} vertical={vertical}>
122-
{t('tryNew')}
123-
</NavItemButton>
124-
)}
125-
{user.preferences?.chatVersion !== 1 && (
126-
<NavItemButton to="/v1" path="v1/*" current={pathname} icon={<GradeOutlined sx={styles.icon} />} vertical={vertical}>
127-
{t('useOld')}
128-
</NavItemButton>
129-
)}
130120
{user.enrolledCourses.length > 0 && (
131121
<NavItemButton to="/chats" path="chats/*" current={pathname} icon={<BookmarksOutlined sx={styles.icon} />} vertical={vertical}>
132122
{t('chats')}

src/shared/user.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { z } from 'zod/v4'
22

33
export const UserPreferencesSchema = z
44
.object({
5-
chatVersion: z.number().min(1).max(2).default(1),
65
sendShortcutMode: z.enum(['shift+enter', 'enter']).default('shift+enter'),
76
})
87
.partial()

0 commit comments

Comments
 (0)