organify-ui 0.3.34 → 0.3.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2931,8 +2931,11 @@ function useChat(options = {}) {
|
|
|
2931
2931
|
useEffect(() => {
|
|
2932
2932
|
setUserCache((prev) => {
|
|
2933
2933
|
const next = new Map(prev);
|
|
2934
|
-
if (userId
|
|
2935
|
-
|
|
2934
|
+
if (userId) {
|
|
2935
|
+
const existingDisplay = prev.get(userId)?.displayName;
|
|
2936
|
+
const hasRealName = existingDisplay && !existingDisplay.startsWith("User ");
|
|
2937
|
+
const displayName = user?.name || user?.email?.split("@")[0] || (hasRealName ? existingDisplay : `User ${userId.substring(0, 5)}`);
|
|
2938
|
+
next.set(userId, { displayName, avatarUrl: user?.avatarUrl ?? prev.get(userId)?.avatarUrl });
|
|
2936
2939
|
}
|
|
2937
2940
|
if (options.workspaceMembers) {
|
|
2938
2941
|
for (const member of options.workspaceMembers) {
|
|
@@ -2957,7 +2960,8 @@ function useChat(options = {}) {
|
|
|
2957
2960
|
useEffect(() => {
|
|
2958
2961
|
if (!userId || isDemoMode) return;
|
|
2959
2962
|
const missingIds = Array.from(new Set(messages.map((m) => m.authorId))).filter(
|
|
2960
|
-
|
|
2963
|
+
// Skip: already cached, system messages, and the current user (handled by the cache-populate effect above)
|
|
2964
|
+
(id) => !userCache.has(id) && id !== "system" && id !== userId
|
|
2961
2965
|
);
|
|
2962
2966
|
if (missingIds.length === 0) return;
|
|
2963
2967
|
missingIds.forEach(async (id) => {
|
|
@@ -3165,7 +3169,7 @@ function useChat(options = {}) {
|
|
|
3165
3169
|
);
|
|
3166
3170
|
if (data?.sendMessage) {
|
|
3167
3171
|
setMessages(
|
|
3168
|
-
(prev) => prev.map((m) => m.id === tempId ? { ...
|
|
3172
|
+
(prev) => prev.map((m) => m.id === tempId ? { ...m, _status: "sent" } : m)
|
|
3169
3173
|
);
|
|
3170
3174
|
} else {
|
|
3171
3175
|
setMessages(
|
|
@@ -3639,18 +3643,20 @@ function useChat(options = {}) {
|
|
|
3639
3643
|
case "next":
|
|
3640
3644
|
if (msg.id === "sub_msg_created" && msg.payload?.data?.messageCreated) {
|
|
3641
3645
|
const newMsg = msg.payload.data.messageCreated;
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3646
|
+
setMessages((prev) => {
|
|
3647
|
+
if (prev.some((m) => m.id === newMsg.id)) return prev;
|
|
3648
|
+
if (String(newMsg.authorId) === String(userId)) {
|
|
3649
|
+
const ownIdx = prev.findIndex(
|
|
3650
|
+
(m) => (m._status === "pending" || m._status === "sent") && m.content === newMsg.content && String(m.authorId) === String(newMsg.authorId)
|
|
3651
|
+
);
|
|
3652
|
+
if (ownIdx !== -1) {
|
|
3653
|
+
const next = [...prev];
|
|
3654
|
+
next[ownIdx] = { ...newMsg, _status: "sent" };
|
|
3655
|
+
return next;
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
return [...prev, newMsg];
|
|
3659
|
+
});
|
|
3654
3660
|
}
|
|
3655
3661
|
if (msg.id === "sub_msg_updated" && msg.payload?.data?.messageUpdated) {
|
|
3656
3662
|
const updated = msg.payload.data.messageUpdated;
|
|
@@ -4743,5 +4749,5 @@ function useAiInline({ gatewayUrl, workspaceId, projectId }) {
|
|
|
4743
4749
|
}
|
|
4744
4750
|
|
|
4745
4751
|
export { AiChatSidebar, Alert, Button, ChatMessages, ChatSidebar, CommandBar, CreateRoomDialog, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, InlineAiButton, Input, Label, MOCK_PROJECTS, MOCK_USERS, MentionPopover, MessageBubble, MessageInput, OrgLoader, OrgLoaderInline, OrganifyChat, ResponsiveDialog, RoomManagementPanel, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TypingIndicatorMock, UserAvatar, UserDisplayName, alertVariants, buttonVariants, generateAutoReplies, getMockMentionOptions, getRoomPermissions, inputVariants, invalidateUserCache, orgLoaderVariants, resolveUser, seedUserCache, typingIndicator, useAiInline, useChat, useResolvedUser };
|
|
4746
|
-
//# sourceMappingURL=chunk-
|
|
4747
|
-
//# sourceMappingURL=chunk-
|
|
4752
|
+
//# sourceMappingURL=chunk-V3UZIPZA.js.map
|
|
4753
|
+
//# sourceMappingURL=chunk-V3UZIPZA.js.map
|