fix: prevent ai detail sync render loop
This commit is contained in:
parent
c823910185
commit
b62926cf6e
@ -236,6 +236,36 @@ function arePickedAttachmentsEqual(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function areAttachmentValuesEqual(
|
||||||
|
left:
|
||||||
|
| PickedAttachment
|
||||||
|
| {
|
||||||
|
url?: string | null;
|
||||||
|
name?: string | null;
|
||||||
|
contentType?: string | null;
|
||||||
|
assetId?: string | null;
|
||||||
|
}
|
||||||
|
| null
|
||||||
|
| undefined,
|
||||||
|
right:
|
||||||
|
| PickedAttachment
|
||||||
|
| {
|
||||||
|
url?: string | null;
|
||||||
|
name?: string | null;
|
||||||
|
contentType?: string | null;
|
||||||
|
assetId?: string | null;
|
||||||
|
}
|
||||||
|
| null
|
||||||
|
| undefined
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
String(left?.url || "").trim() === String(right?.url || "").trim() &&
|
||||||
|
String(left?.name || "").trim() === String(right?.name || "").trim() &&
|
||||||
|
String(left?.contentType || "").trim() === String(right?.contentType || "").trim() &&
|
||||||
|
String(left?.assetId || "").trim() === String(right?.assetId || "").trim()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function mergePersistedHistoryMessages(
|
function mergePersistedHistoryMessages(
|
||||||
currentMessages: ChatMessage[],
|
currentMessages: ChatMessage[],
|
||||||
persistedMessages: ChatMessage[]
|
persistedMessages: ChatMessage[]
|
||||||
@ -2639,7 +2669,10 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
contentType: attachment.contentType || "image/jpeg",
|
contentType: attachment.contentType || "image/jpeg",
|
||||||
assetId: attachment.assetId || null,
|
assetId: attachment.assetId || null,
|
||||||
};
|
};
|
||||||
if (!currentSlot || currentIsPreviousAutoSelection) {
|
if (
|
||||||
|
(!currentSlot || currentIsPreviousAutoSelection) &&
|
||||||
|
!areAttachmentValuesEqual(currentSlot, nextAttachment)
|
||||||
|
) {
|
||||||
nextSlots[slotIndex] = nextAttachment;
|
nextSlots[slotIndex] = nextAttachment;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -2667,7 +2700,10 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
contentType: selectedModelAttachment.contentType || "image/jpeg",
|
contentType: selectedModelAttachment.contentType || "image/jpeg",
|
||||||
assetId: selectedModelAttachment.assetId || null,
|
assetId: selectedModelAttachment.assetId || null,
|
||||||
};
|
};
|
||||||
if (!currentSlot || currentIsPreviousAutoSelection) {
|
if (
|
||||||
|
(!currentSlot || currentIsPreviousAutoSelection) &&
|
||||||
|
!areAttachmentValuesEqual(currentSlot, nextAttachment)
|
||||||
|
) {
|
||||||
nextSlots[AGENT_DETAIL_MODEL_SLOT_INDEX] = nextAttachment;
|
nextSlots[AGENT_DETAIL_MODEL_SLOT_INDEX] = nextAttachment;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
@ -2701,7 +2737,10 @@ export function AgentGenerationWorkspaceDarkV2({
|
|||||||
contentType: image.mimeType || "image/jpeg",
|
contentType: image.mimeType || "image/jpeg",
|
||||||
assetId: image.assetId || null,
|
assetId: image.assetId || null,
|
||||||
};
|
};
|
||||||
if (!currentSlot || currentIsPreviousAutoSelection) {
|
if (
|
||||||
|
(!currentSlot || currentIsPreviousAutoSelection) &&
|
||||||
|
!areAttachmentValuesEqual(currentSlot, nextAttachment)
|
||||||
|
) {
|
||||||
nextSlots[slotIndex] = nextAttachment;
|
nextSlots[slotIndex] = nextAttachment;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user