Skip to content

Commit

Permalink
Add HTML metadata in the application layout file (#31)
Browse files Browse the repository at this point in the history
Refactor code for readability, linting, and package updates

- Update multiple packages for project dependency
- Alter TypeScript compilation target from `es5` to `ES2015`
- Improve HTML metadata in the application layout file
- Optimize code formatting and eslint configuration across various files
  • Loading branch information
blrchen committed Jul 16, 2023
1 parent f7b6ea0 commit b40170e
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 192 deletions.
21 changes: 1 addition & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
{
"extends": "next/core-web-vitals",
"rules": {
"react/react-in-jsx-scope": 0,
"import/no-extraneous-dependencies": 0,
"no-sparse-arrays": 1,
"import/extensions": 0,
"no-shadow": 0,
"no-nested-ternary": 0,
"no-restricted-globals": 0,
"@typescript-eslint/ban-types": 0,
"react/static-property-placement": [
"warn",
"property assignment",
{
"contextTypes": "static public field",
"contextType": "static public field",
"displayName": "static public field"
}
]
}
"extends": "next/core-web-vitals"
}
2 changes: 1 addition & 1 deletion app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface Message {
}
export async function POST(req: NextRequest) {
try {
const { prompt, messages,input } = (await req.json()) as {
const { prompt, messages, input } = (await req.json()) as {
prompt: string
messages: Message[]
input: string
Expand Down
9 changes: 9 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@ import './globals.css'
import { Inter } from 'next/font/google'
import { Toaster } from 'react-hot-toast'
import { ThemeProvider } from '@material-tailwind/react'

const inter = Inter({ subsets: ['latin'] })

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<title>ChatGPT Lite</title>
<meta name="description" content="AI assistant powered by ChatGPT" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1"
/>
</head>
<body className={inter.className}>
<ThemeProvider>
<Toaster
Expand Down
4 changes: 1 addition & 3 deletions components/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,7 @@ const Chat = (props: ChatProps, ref: any) => {
{currentChat?.persona?.name}
</div>
<div className="flex-1 overflow-auto">
{conversation?.map((item, index) => (
<Message key={index} message={item} />
))}
{conversation?.map((item, index) => <Message key={index} message={item} />)}
{currentMessage && <Message message={{ content: currentMessage, role: 'assistant' }} />}
<div ref={bottomOfChatRef}></div>
</div>
Expand Down
1 change: 1 addition & 0 deletions components/personaModal/NormalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const NormalForm = (props: NormalFormProps, ref: any) => {
setValue('name', detail.name, { shouldTouch: true })
setValue('prompt', detail.prompt, { shouldTouch: true })
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [detail])

return (
Expand Down
1 change: 1 addition & 0 deletions components/personaPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const PersonaPanel = (props: PersonaPanelProps) => {
const [promptList, setPromptList] = useState<Persona[]>([])
const [searchText, setSearchText] = useState('')

// eslint-disable-next-line react-hooks/exhaustive-deps
const handleSearch = useCallback(
debounce((type: string, list: Persona[], searchText: string) => {
setPromptList(
Expand Down
1 change: 1 addition & 0 deletions hooks/useChatHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const useChatHook = () => {
document.body.removeAttribute('style')
localStorage.setItem(StorageKeys.Chat_List, JSON.stringify(chatList))
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

useEffect(() => {
Expand Down
Loading

1 comment on commit b40170e

@vercel
Copy link

@vercel vercel bot commented on b40170e Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

gptlite – ./

gptlite-git-main-blrchen.vercel.app
gptlite.vercel.app
gptlite-blrchen.vercel.app

Please sign in to comment.