Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed May 17, 2024
1 parent db9f530 commit b203591
Showing 1 changed file with 39 additions and 42 deletions.
81 changes: 39 additions & 42 deletions src/components/Chat/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,10 @@ export const ChatMessage: FC<Props> = memo(

return (
<div
className={`group md:px-4 ${
message.role === 'assistant'
? 'border-b border-black/10 bg-gray-50/50 text-gray-800 dark:border-[rgba(42,42,120,0.50)] dark:bg-[#202134] dark:text-gray-100'
: 'border-b border-black/10 bg-white/50 text-gray-800 dark:border-[rgba(42,42,120,0.50)] dark:bg-[#15162B] dark:text-gray-100'
}`}
className={`group md:px-4 ${message.role === 'assistant'
? 'border-b border-black/10 bg-gray-50/50 text-gray-800 dark:border-[rgba(42,42,120,0.50)] dark:bg-[#202134] dark:text-gray-100'
: 'border-b border-black/10 bg-white/50 text-gray-800 dark:border-[rgba(42,42,120,0.50)] dark:bg-[#15162B] dark:text-gray-100'
}`}
style={{ overflowWrap: 'anywhere' }}
>
<div className="relative m-auto flex p-4 text-base md:max-w-2xl md:gap-6 md:py-6 lg:max-w-5xl lg:px-0 xl:max-w-3xl">
Expand Down Expand Up @@ -558,10 +557,10 @@ export const ChatMessage: FC<Props> = memo(
{isImg2TextLoading &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand All @@ -585,10 +584,10 @@ export const ChatMessage: FC<Props> = memo(
{isImg2TextLoading === false &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand All @@ -613,10 +612,10 @@ export const ChatMessage: FC<Props> = memo(
{isRetrievalLoading &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand All @@ -640,10 +639,10 @@ export const ChatMessage: FC<Props> = memo(
{isRetrievalLoading === false &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand All @@ -668,10 +667,10 @@ export const ChatMessage: FC<Props> = memo(
{isRouting &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand All @@ -696,10 +695,10 @@ export const ChatMessage: FC<Props> = memo(
routingResponse &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand Down Expand Up @@ -733,8 +732,7 @@ export const ChatMessage: FC<Props> = memo(
Arguments:{' '}
<pre>
{/* @ts-ignore -- idk */}
{JSON.stringify(
routingResponse[0].arguments,
{JSON.stringify(routingResponse[0].arguments,
null,
2,
)}
Expand All @@ -748,10 +746,10 @@ export const ChatMessage: FC<Props> = memo(
{isRunningTool &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{
display: 'flex',
Expand Down Expand Up @@ -781,10 +779,10 @@ export const ChatMessage: FC<Props> = memo(
{isRunningTool === false &&
(messageIndex ===
(selectedConversation?.messages.length ?? 0) -
1 ||
1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<>
{/* <IconCheck size={25} /> */}
<div
Expand Down Expand Up @@ -838,7 +836,7 @@ export const ChatMessage: FC<Props> = memo(
parsedResult &&
parsedResult.data &&
typeof parsedResult.data ===
'string'
'string'
) {
return parsedResult.data
.replace(/\\r\\n/g, '\n')
Expand Down Expand Up @@ -870,8 +868,8 @@ export const ChatMessage: FC<Props> = memo(
(messageIndex ===
(selectedConversation?.messages.length ?? 0) - 1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{ display: 'flex', alignItems: 'center' }}
>
Expand All @@ -892,8 +890,8 @@ export const ChatMessage: FC<Props> = memo(
(messageIndex ===
(selectedConversation?.messages.length ?? 0) - 1 ||
messageIndex ===
(selectedConversation?.messages.length ?? 0) -
2) && (
(selectedConversation?.messages.length ?? 0) -
2) && (
<div
style={{ display: 'flex', alignItems: 'center' }}
>
Expand Down Expand Up @@ -1029,13 +1027,12 @@ export const ChatMessage: FC<Props> = memo(
},
}}
>
{`${message.content}${
messageIsStreaming &&
{`${message.content}${messageIsStreaming &&
messageIndex ==
(selectedConversation?.messages.length ?? 0) - 1
? '`▍`'
: ''
}`}
(selectedConversation?.messages.length ?? 0) - 1
? '`▍`'
: ''
}`}
</MemoizedReactMarkdown>
{/* {message.contexts && message.contexts.length > 0 && (
<Group variant="row" spacing="xs">
Expand Down

0 comments on commit b203591

Please sign in to comment.