Skip to content

Commit

Permalink
feat: add keyboard shortcuts for chat input
Browse files Browse the repository at this point in the history
- Press Enter to send message
- Press Shift+Enter for new line
- Prevent empty messages
  • Loading branch information
while-basic committed Dec 1, 2024
1 parent dc60d98 commit e420ff7
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 88 deletions.
124 changes: 72 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,66 +214,87 @@ Remember to:
4. Update SEO metadata for all pages
5. Remove placeholder content

## Todos should be completed starting from the most easiest to implement. The Todo list should be updated periodically and in order from easiest to most difficult for the AI to implement.

- [-] Initial setup
- [-] center navlinks
- [-] Navigation bar
- [-] About section
- [-] Projects section
- [-] Skills section
- [-] Experience section
- [-] Gallery section
- [-] Education section
- [-] Project tiles should be clickable
- [ ] Fix light/dark modes
- [-] Add resume page
- [-] add cover letter podcast clip
- [-] add resume podcast clip
- [ ] Light mode implementation
- [-] Add case studies
- [ ] Visitor counter
- [ ] Contact form
- [ ] Set up resend email
- [-] Add breadcrumbs
## Todo List

This list is prioritized from easiest to most challenging tasks. It should be updated regularly to reflect current progress and new requirements.

### Completed Tasks
- [x] Initial setup
- [x] Center navlinks
- [x] Navigation bar
- [x] About section
- [x] Projects section
- [x] Skills section
- [x] Experience section
- [x] Gallery section
- [x] Education section
- [x] Make project tiles clickable
- [x] Add resume page
- [x] Add cover letter podcast clip
- [x] Add resume podcast clip
- [x] Add case studies
- [x] Add breadcrumbs
- [x] Add breadcrumbs to chat page
- [ ] Add Supabase integration
- [-] Add animations
- [-] Add unit tests
- [ ] Add resume download
- [ ] Add social media links
- [ ] Image generation
- [ ] Audio section
- [-] Chatbot for users signed in
- [ ] Admin dashboard
- [-] Total visitors
- [ ] Total messages
- [ ] Total users
- [ ] Chat history
- [-] Add SEO
- [-] Add blog
- [-] Secret audio page
- [-] Responsive on mobile
- [-] Loading screen
- [-] Update README.md
- [-] Update all pages that have personal information that needs to be updated
- [x] Add animations
- [x] Add unit tests
- [x] Implement chatbot for signed-in users
- [x] Add SEO
- [x] Add blog
- [x] Create secret audio page
- [x] Make site responsive on mobile
- [x] Add loading screen
- [x] Update README.md
- [x] Update all pages with personal information
- [x] Style blog heading correctly
- [x] Add notice about chat for signed-in users only
- [x] Implement ChatGPT clone with Supabase integration
- [x] Add estimated cost to chat
- [x] Add total cost for chat

### High Priority Tasks
- [ ] Add footer to home page
- [-] Blog heading needs to be styled correctly
- [-] Chat should have a notice about it being used for signed in users only
- [ ] Ability to delete conversations
- [ ] Add avatar icons to chat
- [-] ChatGPT clone with supabase integration
- [ ] Add social media links
- [ ] Implement light mode
- [ ] Fix light/dark modes
- [ ] Add visitor counter
- [ ] Create contact form
- [ ] Set up Resend email
- [ ] Complete Supabase integration
- [ ] Add resume download functionality
- [ ] Add chat history to dashboard
- [-] Add estimated cost to chat
- [ ] Add streaming support to chat
- [ ] Make chat responsive on mobile
- [ ] Make chat rename the chat threads
- [ ] Correct styling on chat page
- [ ] Add avatars to chat
- [ ] Add system prompts to chat
- [ ] Add option to change models
- [ ] Add avatars to chat interface
- [ ] Implement system prompts in chat
- [ ] Add option to change AI models
- [ ] Add Markdown support to chat
- [ ] Implement code highlighting in chat
- [ ] Enhance admin dashboard
- [ ] Add total messages counter
- [ ] Add total users counter
- [ ] Implement chat history viewing
- [ ] Implement streaming support for chat
- [ ] Add chat thread renaming feature
- [ ] Add AI assistants to chat
- [ ] Add total message count to dashboard
- [ ] Implement image generation feature
- [ ] Develop audio section
- [ ] Add support voice chat

### Future Enhancements
- [ ] Optimize performance for large datasets
- [ ] Implement advanced search functionality
- [ ] Add multilingual support
- [ ] Integrate with additional third-party services
- [ ] Implement user feedback system
- [ ] Add interactive tutorials for new users


## Projects

- [ ] ChatGPT Clone
- [ ] Medchat
- [ ] Midisaber
- [ ] Law-GPT
Expand All @@ -293,7 +314,6 @@ Remember to:
- [ ] Gemini Chat
- [ ] Custom GPT
- [ ] Groq Chat
- [ ] Change carasoul in gallery

## License

Expand Down
2 changes: 1 addition & 1 deletion app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function OPTIONS() {

export async function POST(request: Request) {
try {
const { messages, model = 'gpt-4o', summarize = false } = await request.json()
const { messages, model = 'gpt-4', summarize = false } = await request.json()

if (summarize) {
const completion = await openai.chat.completions.create({
Expand Down
1 change: 0 additions & 1 deletion app/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ArrowLeft, Menu } from "lucide-react"
import Link from "next/link"
import { useAuth } from "@/lib/auth-context"
import { AuthDialog } from "@/components/chat/auth-dialog"
import { Breadcrumb } from "@/components/breadcrumb"
import { ChatInterface } from "@/components/chat/chat-interface"
import { Sidebar } from "@/components/chat/sidebar"
import { useEffect, useState, useCallback } from "react"
Expand Down
15 changes: 10 additions & 5 deletions components/chat/chat-interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import { Button } from "@/components/ui/button"
import { Textarea } from "@/components/ui/textarea"
import { useToast } from "@/components/ui/use-toast"
import { ScrollArea } from "@/components/ui/scroll-area"
import { MessageSquare, User, Send } from "lucide-react"
import { Send } from "lucide-react"
import { TokenDisplay } from './token-display'
import ReactMarkdown from 'react-markdown'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism'
import { cn } from '@/lib/utils'

interface ChatInterfaceProps {
Expand Down Expand Up @@ -113,7 +110,7 @@ export function ChatInterface({ conversation, onNewMessage }: ChatInterfaceProps
key={index}
onClick={() => {
setInputValue(prompt);
handleSubmit(new Event('submit') as any);
handleSubmit({ preventDefault: () => {} } as React.FormEvent);
}}
className="p-4 rounded-lg border border-gray-800 bg-black hover:bg-gray-900 transition-colors text-white text-left"
>
Expand Down Expand Up @@ -153,6 +150,14 @@ export function ChatInterface({ conversation, onNewMessage }: ChatInterfaceProps
placeholder="Ask AI..."
className="flex-1 bg-black border-gray-800 text-white resize-none"
rows={1}
onKeyDown={(e) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
if (inputValue.trim()) {
handleSubmit(e);
}
}
}}
/>
<Button
type="submit"
Expand Down
5 changes: 4 additions & 1 deletion components/chat/message-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Brain, UserCircle2 } from "lucide-react"
import { cn } from "@/lib/utils"
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
import Image from "next/image"

export type Message = {
role: "user" | "assistant"
Expand Down Expand Up @@ -39,9 +40,11 @@ export function MessageList({ messages, isLoading }: MessageListProps) {
: "bg-emerald-600 text-white border-emerald-400"
)}>
{message.avatar ? (
<img
<Image
src={message.avatar}
alt={`${message.role} avatar`}
width={48}
height={48}
className="h-full w-full object-cover rounded-full"
/>
) : (
Expand Down
10 changes: 0 additions & 10 deletions components/chat/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ export const Sidebar: React.FC<SidebarProps> = ({

const updated = await renameConversation(id, editTitle.trim())
setEditingId(null)

// Update the conversation in the list
const updatedConversations = conversations.map(conv =>
conv.id === updated.id ? updated : conv
)
onSelectConversation(updated)

toast({
Expand All @@ -104,11 +99,6 @@ export const Sidebar: React.FC<SidebarProps> = ({
}

const updated = await renameConversation(conversation.id, summary)

// Update the conversation in the list
const updatedConversations = conversations.map(conv =>
conv.id === updated.id ? updated : conv
)
onSelectConversation(updated)

toast({
Expand Down
2 changes: 1 addition & 1 deletion data/visitor-count.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"count":7}
{"count":8}
34 changes: 17 additions & 17 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://chriscelaya.com/blog/hello-world</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/blog</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/case-studies</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://chriscelaya.com/about</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>
<url><loc>https://chriscelaya.com/audio-recorder</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/auth/sign-in</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/chat</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/audio</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/gallery</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url>
<url><loc>https://chriscelaya.com/auth/sign-up</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/resume</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/projects</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://chriscelaya.com/profile</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/skills</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/dashboard</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/experience</loc><lastmod>2024-12-01T22:12:12.407Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>
<url><loc>https://chriscelaya.com/auth/sign-in</loc><lastmod>2024-12-01T23:03:08.635Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/chat</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/blog</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/about</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>
<url><loc>https://chriscelaya.com/dashboard</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/audio</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/auth/sign-up</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/experience</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url>
<url><loc>https://chriscelaya.com/gallery</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/case-studies</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://chriscelaya.com/projects</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url>
<url><loc>https://chriscelaya.com/skills</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/blog/hello-world</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url>
<url><loc>https://chriscelaya.com/resume</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/profile</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://chriscelaya.com/audio-recorder</loc><lastmod>2024-12-01T23:03:08.637Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url>
</urlset>

0 comments on commit e420ff7

Please sign in to comment.