Add attribution to Mckay Wrigley

This commit is contained in:
Jared Palmer 2023-07-31 19:21:38 -04:00
parent 1b5811df53
commit 807ad666c2
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,6 @@
// Inspired by Chatbot-UI and modified to fit the needs of this project
// @see https://github.com/mckaywrigley/chatbot-ui/blob/main/components/Chat/ChatMessage.tsx
import { Message } from 'ai' import { Message } from 'ai'
import remarkGfm from 'remark-gfm' import remarkGfm from 'remark-gfm'
import remarkMath from 'remark-math' import remarkMath from 'remark-math'
@ -28,7 +31,7 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
> >
{message.role === 'user' ? <IconUser /> : <IconOpenAI />} {message.role === 'user' ? <IconUser /> : <IconOpenAI />}
</div> </div>
<div className="ml-4 flex-1 space-y-2 overflow-hidden px-1"> <div className="flex-1 px-1 ml-4 space-y-2 overflow-hidden">
<MemoizedReactMarkdown <MemoizedReactMarkdown
className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0" className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0"
remarkPlugins={[remarkGfm, remarkMath]} remarkPlugins={[remarkGfm, remarkMath]}
@ -40,7 +43,7 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
if (children.length) { if (children.length) {
if (children[0] == '▍') { if (children[0] == '▍') {
return ( return (
<span className="mt-1 animate-pulse cursor-default"></span> <span className="mt-1 cursor-default animate-pulse"></span>
) )
} }

View file

@ -1,3 +1,6 @@
// Inspired by Chatbot-UI and modified to fit the needs of this project
// @see https://github.com/mckaywrigley/chatbot-ui/blob/main/components/Markdown/CodeBlock.tsx
'use client' 'use client'
import { FC, memo } from 'react' import { FC, memo } from 'react'
@ -90,8 +93,8 @@ const CodeBlock: FC<Props> = memo(({ language, value }) => {
} }
return ( return (
<div className="codeblock relative w-full bg-zinc-950 font-sans"> <div className="relative w-full font-sans codeblock bg-zinc-950">
<div className="flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100"> <div className="flex items-center justify-between w-full px-6 py-2 pr-4 bg-zinc-800 text-zinc-100">
<span className="text-xs lowercase">{language}</span> <span className="text-xs lowercase">{language}</span>
<div className="flex items-center space-x-1"> <div className="flex items-center space-x-1">
<Button <Button