Skip to content

Commit

Permalink
fix: Resolve errors caused by Chrome's translation feature
Browse files Browse the repository at this point in the history
- Fix JavaScript errors occurring when Chrome's translation feature is enabled
- Resolve conflicts between elements inserted by the translation feature and application's DOM manipulation

References:
- facebook/react#11538 (comment)

Related Issue: aws-samples#518
  • Loading branch information
Ihara-kenta committed Jul 9, 2024
1 parent 8f31afa commit b511303
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/web/src/components/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,21 @@ const ChatMessage: React.FC<Props> = (props) => {
</div>
)}
{typingTextOutput.split('\n').map((c, idx) => (
<div key={idx}>{c}</div>
<div key={idx}>{c}</div>
))}
</div>
)}
{chatContent?.role === 'assistant' && (
<Markdown prefix={`${props.idx}`}>
{typingTextOutput +
`${
props.loading && (chatContent?.content ?? '') !== ''
? '▍'
: ''
}`}
</Markdown>
<span>
<Markdown prefix={`${props.idx}`}>
{typingTextOutput +
`${
props.loading && (chatContent?.content ?? '') !== ''
? '▍'
: ''
}`}
</Markdown>
</span>
)}
{chatContent?.role === 'system' && (
<div className="break-all">
Expand Down

0 comments on commit b511303

Please sign in to comment.