-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chat]: Remember model and empty state (#274)
- Remembers previously selected model - Adds empty states with example prompts.
- Loading branch information
1 parent
2fdf0d2
commit 21b9282
Showing
5 changed files
with
103 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { cn } from "@/lib/utils"; | ||
import React from "react"; | ||
|
||
export const BackgroundCard = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, children, ...props }, ref) => { | ||
return ( | ||
<div | ||
ref={ref} | ||
{...props} | ||
className={cn( | ||
"bg-background group relative overflow-hidden rounded-2xl border p-5 md:p-8", | ||
className, | ||
)} | ||
> | ||
<div | ||
aria-hidden="true" | ||
className="absolute inset-0 aspect-video -translate-y-1/2 rounded-full border bg-gradient-to-b from-purple-500/80 to-white opacity-25 blur-2xl duration-300 group-hover:-translate-y-1/4 dark:from-white dark:to-white dark:opacity-5 dark:group-hover:opacity-10" | ||
/> | ||
{children} | ||
</div> | ||
); | ||
}); | ||
|
||
BackgroundCard.displayName = "BackgroundCard"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { BackgroundCard } from "../cards/BackgroundCard"; | ||
|
||
type Example = { | ||
systemPrompt: string; | ||
userPrompt?: string; | ||
description: string; | ||
}; | ||
const examples: Example[] = [ | ||
{ | ||
systemPrompt: "You speak like a pirate when responding.", | ||
description: "🏴☠️ Pirate", | ||
}, | ||
{ | ||
systemPrompt: `You reply with buttons like this: ⦅buttons;Star ⭐;Confetti 🎉⦆ | ||
button replies must always start with ⦅buttons; exactly | ||
You constantly fish for github stars using the button (which explodes stars of the screen) for https://github.com/llm-ui-kit/llm-ui, whilst being charming and funny, like the libraries author Richard Gill.`, | ||
userPrompt: "How can I help out llm-ui?", | ||
description: "Star ⭐ buttons", | ||
}, | ||
]; | ||
|
||
const Example: React.FC<{ | ||
example: Example; | ||
onClick: (example: Example) => void; | ||
}> = ({ example, onClick }) => { | ||
return ( | ||
<BackgroundCard | ||
onClick={() => onClick(example)} | ||
className="hover:cursor-pointer text-center " | ||
> | ||
{example.description} | ||
</BackgroundCard> | ||
); | ||
}; | ||
|
||
type EmptyStateProps = { | ||
onExampleClick: (example: Example) => void; | ||
}; | ||
|
||
export const EmptyState: React.FC<EmptyStateProps> = ({ onExampleClick }) => ( | ||
<div className="grid grid-cols-2 gap-6 mx-auto max-w-4xl container"> | ||
{examples.map((example, index) => { | ||
return <Example key={index} example={example} onClick={onExampleClick} />; | ||
})} | ||
</div> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters