refactors server route for brevity, state working, styling matching to chatgpt

This commit is contained in:
Danny Avila 2023-02-13 13:32:54 -05:00
parent dcf4f2a524
commit acaef39d12
10 changed files with 75 additions and 53 deletions

View file

@ -14,6 +14,8 @@ export default function Message({ sender, text, last = false, error = false }) {
'w-full border-b border-black/10 dark:border-gray-900/50 text-gray-800 dark:text-gray-100 group bg-gray-100 dark:bg-[#444654]';
}
const blinker = isSubmitting && last && sender === 'GPT';
return (
<div {...props}>
<div className="m-auto flex gap-4 p-4 text-base md:max-w-2xl md:gap-6 md:py-6 lg:max-w-2xl lg:px-0 xl:max-w-3xl">
@ -32,7 +34,7 @@ export default function Message({ sender, text, last = false, error = false }) {
<div className="relative flex w-[calc(100%-50px)] flex-col gap-1 whitespace-pre-wrap md:gap-3 lg:w-[calc(100%-115px)]">
<div className="flex flex-grow flex-col gap-3">
{!!error ? (
<div className="flex flex min-h-[20px] flex-row flex-col items-start gap-4 gap-2 whitespace-pre-wrap text-red-500">
<div className="flex flex min-h-[20px] flex-row flex-col items-start gap-4 gap-2 whitespace-pre-wrap text-red-500" >
<div className="rounded-md border border-red-500 bg-red-500/10 py-2 px-3 text-sm text-gray-600 dark:text-gray-100">
{text}
</div>
@ -40,7 +42,7 @@ export default function Message({ sender, text, last = false, error = false }) {
) : (
<span>
{text}
{isSubmitting && last && sender === 'GPT' && <span className="cursorBlink"></span>}
{blinker && <span className="result-streaming"></span>}
</span>
)}
</div>