mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 18:27:15 +00:00
fix(comment): fix reply UI race condition and normalize session routing on agent reply
This commit is contained in:
@@ -35,7 +35,12 @@ type UploadingFile = {
|
||||
|
||||
interface ChatInputProps {
|
||||
projectId: string
|
||||
onSendMessage: (text: string, attachmentIds: string[], annotations?: Annotation[]) => void
|
||||
onSendMessage: (
|
||||
text: string,
|
||||
attachmentIds: string[],
|
||||
annotations?: Annotation[],
|
||||
replyToId?: string | null,
|
||||
) => void
|
||||
replyingTo?: CommentInfo | null
|
||||
onCancelReply?: () => void
|
||||
users?: UserInfo[]
|
||||
@@ -376,7 +381,7 @@ export const ChatInput = React.forwardRef<HTMLDivElement, ChatInputProps>(
|
||||
// Allow sending if annotations exist, even if text is empty
|
||||
if (!processedText && successfulAttachmentIds.length === 0 && annotations.length === 0) return
|
||||
|
||||
onSendMessage(processedText, successfulAttachmentIds, annotations)
|
||||
onSendMessage(processedText, successfulAttachmentIds, annotations, replyingTo?.id)
|
||||
|
||||
// Reset editor
|
||||
editorRef.current.innerHTML = ''
|
||||
|
||||
@@ -52,6 +52,7 @@ export function FileViewerRightSidebar({
|
||||
text: string
|
||||
attachmentIds: string[]
|
||||
annotations?: Annotation[]
|
||||
replyToId?: string | null
|
||||
} | null>(null)
|
||||
|
||||
const { data: apiFields } = useQuery({
|
||||
@@ -135,11 +136,13 @@ export function FileViewerRightSidebar({
|
||||
text,
|
||||
attachmentIds,
|
||||
annotations,
|
||||
replyToId,
|
||||
guestUserId,
|
||||
}: {
|
||||
text: string
|
||||
attachmentIds: string[]
|
||||
annotations?: Annotation[]
|
||||
replyToId?: string | null
|
||||
guestUserId?: string
|
||||
}) => {
|
||||
if (isPublic) {
|
||||
@@ -150,7 +153,7 @@ export function FileViewerRightSidebar({
|
||||
json: {
|
||||
message: text,
|
||||
attachmentIds: attachmentIds,
|
||||
replyToId: replyingTo?.id,
|
||||
replyToId: replyToId ?? undefined,
|
||||
annotations: annotations,
|
||||
},
|
||||
},
|
||||
@@ -169,7 +172,7 @@ export function FileViewerRightSidebar({
|
||||
json: {
|
||||
message: text,
|
||||
attachmentIds: attachmentIds,
|
||||
replyToId: replyingTo?.id,
|
||||
replyToId: replyToId ?? undefined,
|
||||
annotations: annotations,
|
||||
},
|
||||
})
|
||||
@@ -220,6 +223,7 @@ export function FileViewerRightSidebar({
|
||||
text: string,
|
||||
attachmentIds: string[],
|
||||
annotations?: Annotation[],
|
||||
replyToId?: string | null,
|
||||
) => {
|
||||
if (!file?.id) return
|
||||
|
||||
@@ -235,16 +239,16 @@ export function FileViewerRightSidebar({
|
||||
console.log('[handleSendMessage] guestUserId from storage:', guestUserId)
|
||||
if (!guestUserId) {
|
||||
console.log('[handleSendMessage] no guest ID, opening popup')
|
||||
setPendingComment({ text, attachmentIds, annotations })
|
||||
setPendingComment({ text, attachmentIds, annotations, replyToId })
|
||||
setIsGuestPopupOpen(true)
|
||||
return
|
||||
}
|
||||
createComment({ text, attachmentIds, annotations, guestUserId })
|
||||
createComment({ text, attachmentIds, annotations, replyToId, guestUserId })
|
||||
} else {
|
||||
createComment({ text, attachmentIds, annotations })
|
||||
createComment({ text, attachmentIds, annotations, replyToId })
|
||||
}
|
||||
} else {
|
||||
createComment({ text, attachmentIds, annotations })
|
||||
createComment({ text, attachmentIds, annotations, replyToId })
|
||||
}
|
||||
setReplyingTo(null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user