forked from vercel/ai-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add image block type (vercel#709)
- Loading branch information
1 parent
6c23a8a
commit df449a4
Showing
13 changed files
with
229 additions
and
92 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
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
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
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,50 @@ | ||
import { LoaderIcon } from './icons'; | ||
import cn from 'classnames'; | ||
|
||
interface ImageEditorProps { | ||
title: string; | ||
content: string; | ||
isCurrentVersion: boolean; | ||
currentVersionIndex: number; | ||
status: string; | ||
isInline: boolean; | ||
} | ||
|
||
export function ImageEditor({ | ||
title, | ||
content, | ||
isCurrentVersion, | ||
currentVersionIndex, | ||
status, | ||
isInline, | ||
}: ImageEditorProps) { | ||
return ( | ||
<div | ||
className={cn('flex flex-row items-center justify-center w-full', { | ||
'h-[calc(100dvh-60px)]': !isInline, | ||
'h-[200px]': isInline, | ||
})} | ||
> | ||
{status === 'streaming' ? ( | ||
<div className="flex flex-row gap-4 items-center"> | ||
{!isInline && ( | ||
<div className="animate-spin"> | ||
<LoaderIcon /> | ||
</div> | ||
)} | ||
<div>Generating Image...</div> | ||
</div> | ||
) : ( | ||
<picture> | ||
<img | ||
className={cn('w-full h-fit max-w-[800px]', { | ||
'p-0 md:p-20': !isInline, | ||
})} | ||
src={`data:image/png;base64,${content}`} | ||
alt={title} | ||
/> | ||
</picture> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.