This repository has been archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from tipisai/improve/message-list
Improve/message list
- Loading branch information
Showing
25 changed files
with
265 additions
and
110 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
apps/agent/src/components/PreviewChat/MessageList/components/MessageListItem/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { FC } from "react" | ||
import AIAgentMessage from "@/page/WorkSpace/AI/components/AIAgentMessage" | ||
import GroupAgentMessage from "@/page/WorkSpace/AI/components/GroupAgentMessage" | ||
import UserMessage from "@/page/WorkSpace/AI/components/UserMessage" | ||
import { isGroupMessage } from "@/utils/agent/typeHelper" | ||
import { SenderType } from "../../../interface" | ||
import { IMessageListItemProps } from "./interface" | ||
|
||
const MessageListItem: FC<IMessageListItemProps> = ({ | ||
message, | ||
currentUserID, | ||
isReceiving, | ||
isLastMessage, | ||
}) => { | ||
if (isGroupMessage(message)) { | ||
return ( | ||
<GroupAgentMessage | ||
key={message.threadID} | ||
message={message} | ||
disableTrigger={isReceiving && isLastMessage} | ||
/> | ||
) | ||
} else if ( | ||
message.sender.senderType === SenderType.USER && | ||
message.sender.senderID === currentUserID | ||
) { | ||
return ( | ||
<UserMessage | ||
key={message.threadID} | ||
message={message} | ||
disableTrigger={isReceiving && isLastMessage} | ||
/> | ||
) | ||
} else { | ||
return ( | ||
<AIAgentMessage | ||
key={message.threadID} | ||
message={message} | ||
isLastMessage={isLastMessage} | ||
isReceiving={isReceiving} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
export default MessageListItem |
8 changes: 8 additions & 0 deletions
8
apps/agent/src/components/PreviewChat/MessageList/components/MessageListItem/interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ChatMessage, IGroupMessage } from "../../../interface" | ||
|
||
export interface IMessageListItemProps { | ||
message: IGroupMessage | ChatMessage | ||
isReceiving: boolean | ||
isLastMessage: boolean | ||
currentUserID: string | ||
} |
65 changes: 27 additions & 38 deletions
65
apps/agent/src/components/PreviewChat/MessageList/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/agent/src/page/WorkSpace/AI/components/SyncMessageCard/interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.