Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
refactor(routes): convert to TS
Danny Avila8b4d3c2c2170
diff --git a/client/src/routes/Chat.jsx b/client/src/routes/Chat.tsxsimilarity index 89%rename from client/src/routes/Chat.jsxrename to client/src/routes/Chat.tsxindex 9fbc02452e..8453fbb171 100644--- a/client/src/routes/Chat.jsx+++ b/client/src/routes/Chat.tsx@@ -1,11 +1,11 @@import { useState, useEffect } from 'react';-import { useAuthContext } from '~/hooks/AuthContext';+import { useAuthContext } from '~/hooks';import { useNavigate, useParams } from 'react-router-dom';import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';-import Landing from '../components/ui/Landing';-import Messages from '../components/Messages';-import TextChat from '../components/Input/TextChat';+import Landing from '~/components/ui/Landing';+import Messages from '~/components/Messages';+import TextChat from '~/components/Input/TextChat';import store from '~/store';import {@@ -27,12 +27,12 @@ export default function Chat() {const navigate = useNavigate();//disabled by default, we only enable it when messagesTree is null- const messagesQuery = useGetMessagesByConvoId(conversationId, { enabled: false });- const getConversationMutation = useGetConversationByIdMutation(conversationId);+ const messagesQuery = useGetMessagesByConvoId(conversationId ?? '', { enabled: false });+ const getConversationMutation = useGetConversationByIdMutation(conversationId ?? '');const { data: config } = useGetStartupConfig();useEffect(() => {- let timeout = setTimeout(() => {+ const timeout = setTimeout(() => {if (!isAuthenticated) {navigate('/login', { replace: true });}@@ -97,11 +97,12 @@ export default function Chat() {}}document.title = conversation?.title || config?.appTitle || 'Chat';+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [conversation, conversationId, config]);useEffect(() => {if (messagesTree === null && conversation?.conversationId) {- messagesQuery.refetch(conversation?.conversationId);+ messagesQuery.refetch({ queryKey: [conversation?.conversationId] });}}, [conversation?.conversationId, messagesQuery, messagesTree]);@@ -113,6 +114,7 @@ export default function Chat() {console.error(messagesQuery.error);setMessages(null);}+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [messagesQuery.data, messagesQuery.isError, setMessages]);if (!isAuthenticated) {diff --git a/client/src/routes/Search.jsx b/client/src/routes/Search.tsxsimilarity index 90%rename from client/src/routes/Search.jsxrename to client/src/routes/Search.tsxindex b4204b713f..882d5a5ec9 100644--- a/client/src/routes/Search.jsx+++ b/client/src/routes/Search.tsx@@ -2,8 +2,8 @@ import React, { useEffect } from 'react';import { useNavigate, useParams } from 'react-router-dom';import { useRecoilState, useRecoilValue } from 'recoil';-import Messages from '../components/Messages';-import TextChat from '../components/Input/TextChat';+import Messages from '~/components/Messages';+import TextChat from '~/components/Input/TextChat';import store from '~/store';@@ -34,6 +34,7 @@ export default function Search() {// conversationId (in url) should always follow conversation?.conversationId, unless conversation is nullnavigate(`/chat/${conversation?.conversationId}`);}+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [conversation, query, searchQuery]);// if not a searchdiff --git a/client/src/routes/index.jsx b/client/src/routes/index.tsxsimilarity index 82%rename from client/src/routes/index.jsxrename to client/src/routes/index.tsxindex a23686e90f..62df1a0acd 100644--- a/client/src/routes/index.jsx+++ b/client/src/routes/index.tsx@@ -2,9 +2,14 @@ import { createBrowserRouter, Navigate, Outlet } from 'react-router-dom';import Root from './Root';import Chat from './Chat';import Search from './Search';-import { Login, Registration, RequestPasswordReset, ResetPassword } from '../components/Auth';-import { AuthContextProvider } from '../hooks/AuthContext';-import ApiErrorWatcher from '../components/Auth/ApiErrorWatcher';+import {+ Login,+ Registration,+ RequestPasswordReset,+ ResetPassword,+ ApiErrorWatcher,+} from '~/components/Auth';+import { AuthContextProvider } from '~/hooks/AuthContext';const AuthLayout = () => (<AuthContextProvider>