Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Radix-UI for UX Framework #44

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update docs
blrchen committed Dec 5, 2023
commit dd064c5cbf283adc2b264da8211e49efb794063a
22 changes: 14 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Duplicate this to .env.local for local development
# For more details, visit the following link: https://github.com/blrchen/chatgpt-lite#environment-variables
# Duplicate this file and rename as '.env.local' for local development.
# You must obtain OpenAI or Azure OpenAI credentials to run this application.
# For detailed instructions on using these variables, visit:
# https://github.com/blrchen/chatgpt-lite#environment-variables

# OpenAI API credentials. These are necessary if you intend to utilize the OpenAI API.
OPENAI_API_KEY=
# OpenAI API credentials (required for using the OpenAI API):
# Sign up at https://openai.com/api/ to get your API key.
OPENAI_API_KEY= # <-- Insert your OpenAI API key here
OPENAI_API_BASE_URL="https://api.openai.com"

# Azure OpenAI API credentials. These are necessary if you intend to utilize the Azure OpenAI API.
# AZURE_OPENAI_API_BASE_URL=
# AZURE_OPENAI_API_KEY=
# AZURE_OPENAI_DEPLOYMENT=
# Azure OpenAI API credentials (required for using the Azure OpenAI API):
# Sign up at https://azure.microsoft.com/en-us/services/cognitive-services/openai/ for Azure OpenAI credentials.
# Uncomment the following lines and insert your credentials if you're using Azure OpenAI.
# AZURE_OPENAI_API_BASE_URL= # <-- Insert your Azure OpenAI API base URL here
# AZURE_OPENAI_API_KEY= # <-- Insert your Azure OpenAI API key here
# AZURE_OPENAI_DEPLOYMENT= # <-- Insert your Azure OpenAI deployment name here

2 changes: 1 addition & 1 deletion app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ const getApiConfig = () => {
}
apiUrl = `${apiBaseUrl}/v1/chat/completions`
apiKey = process.env.OPENAI_API_KEY || ''
model = 'gpt-3.5-turbo' // todo: allow this to be passed through from client and support gpt-4
model = process.env.OPENAI_MODEL || 'gpt-3.5-turbo'
}

return { apiUrl, apiKey, model }
13 changes: 13 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -6,6 +6,19 @@ import { Header } from '@/components/Header'
import '@/styles/globals.scss'
import '@/styles/theme-config.css'

export const metadata = {
title: {
default: 'ChatGPT Lite',
template: `%s - ChatGPT Lite`
},
description: 'AI assistant powered by ChatGPT',
icons: {
icon: '/favicon.ico',
shortcut: '/favicon-16x16.png',
apple: '/apple-touch-icon.png'
}
}

const inter = Inter({ subsets: ['latin'], variable: '--font-inter' })

export default function RootLayout({ children }: { children: React.ReactNode }) {
8 changes: 3 additions & 5 deletions components/Chat/Message.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
'use client'

import { useContext } from 'react'
import { Avatar, Flex, Text } from '@radix-ui/themes'
import { Avatar, Flex } from '@radix-ui/themes'
import { SiOpenai } from 'react-icons/si'
import { HiUser } from 'react-icons/hi'
import cs from 'classnames'

import { Markdown } from '@/components'

import ChatContext from './chatContext'
import { ChatMessage } from './interface'

export interface MessageProps {
message: ChatMessage
}
@@ -22,7 +20,7 @@ const Message = (props: MessageProps) => {
return (
<Flex gap="4" className="mb-5">
<Avatar
fallback={<SiOpenai className="h-4 w-4" />}
fallback={isUser ? <HiUser className="h-4 w-4" /> : <SiOpenai className="h-4 w-4" />}
color={isUser ? undefined : 'green'}
size="2"
radius="full"
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/vercel.svg

This file was deleted.