-
Notifications
You must be signed in to change notification settings - Fork 119
feat(assistant): assistant improvements #4214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
c0306ee
a7f97ce
8c5203e
9c2f827
41c55c0
deb5441
4d47a2d
9fe763e
5da2ce1
eb848b2
4db67af
f5070e1
3d8bf27
a7e7f4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import React from "react"; | |
|
||
const Window: React.FC<React.PropsWithChildren> = ({ children }) => { | ||
return ( | ||
<Box display="grid" gridTemplateColumns="400px 1fr" height="100svh" width="100%"> | ||
<Box display="grid" gridTemplateColumns="300px 1fr" height="100svh" width="100%"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found this was taking too much space on medium displays |
||
{children} | ||
</Box> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
import { AIChatMessage, AIChatMessageAuthor, AIChatMessageBody } from "@twilio-paste/ai-chat-log"; | ||
import { | ||
AIChatMessage, | ||
AIChatMessageAuthor, | ||
AIChatMessageBody, | ||
AIChatMessageBodyProps, | ||
} from "@twilio-paste/ai-chat-log"; | ||
import { compiler } from "markdown-to-jsx"; | ||
import { type Message } from "openai/resources/beta/threads/messages"; | ||
import * as React from "react"; | ||
|
||
import { formatTimestamp } from "../../utils/formatTimestamp"; | ||
import { AssistantMarkdown } from "./AssistantMarkdown"; | ||
import { assistantMarkdownOptions } from "./AssistantMarkdown"; | ||
|
||
export const AssistantMessage: React.FC<{ threadMessage: Message }> = ({ threadMessage }) => { | ||
interface AssistantMessageProps extends AIChatMessageBodyProps { | ||
threadMessage: Message; | ||
} | ||
|
||
export const AssistantMessage: React.FC<AssistantMessageProps> = ({ threadMessage, ...props }) => { | ||
return ( | ||
<AIChatMessage variant="bot"> | ||
<AIChatMessageAuthor aria-label={`said by paste assistant at ${formatTimestamp(threadMessage.created_at)}`}> | ||
PasteBot | ||
</AIChatMessageAuthor> | ||
<AIChatMessageBody> | ||
{threadMessage.content[0].type === "text" && ( | ||
<AssistantMarkdown key={threadMessage.id}>{threadMessage.content[0].text.value}</AssistantMarkdown> | ||
)} | ||
<AIChatMessageBody {...props}> | ||
{threadMessage.content.length > 0 && | ||
threadMessage.content[0]?.type === "text" && | ||
compiler(threadMessage.content[0].text.value, assistantMarkdownOptions)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Vercel issue where it would sometimes throw the 500 Sarah was talking about was due to deleting a thread the |
||
</AIChatMessageBody> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to use compiler because the animated children was causing the component in the library to throw errors. I also added some information to our docs for how to overcome this. |
||
</AIChatMessage> | ||
); | ||
|
Uh oh!
There was an error while loading. Please reload this page.