public String replaceConversationLinks(String conversationBody, ResourceDescriptor targetResource, Map<String, String> attachmentsMapping) {
        JsonObject conversation = replaceResourceIdentity(conversationBody, targetResource);

        if (attachmentsMapping.isEmpty()) {
            return conversation.toString();
        }

        JsonArray messages = conversation.getJsonArray("messages");
        replaceAttachments(messages, attachmentsMapping);

        JsonObject playback = conversation.getJsonObject("playback");
        if (playback != null) {
            JsonArray messagesStack = playback.getJsonArray("messagesStack");
            replaceAttachments(messagesStack, attachmentsMapping);
        }

        JsonObject replay = conversation.getJsonObject("replay");
        if (replay != null) {
            JsonArray messagesStack = replay.getJsonArray("replayUserMessagesStack");
            replaceAttachments(messagesStack, attachmentsMapping);
        }

        return conversation.toString();
    }
Replaces conversation identity and attachment links after it has been copied from one location to another.
Replacing `id` and `folderId` - chat specific and may not be suitable for generic use-case.
Typical use-case: replace attachment links in conversation after publishing.

@param conversationBody   - source conversation body
@param targetResource     - target resource link
@param attachmentsMapping - attachments map (sourceUrl -> targetUrl) to replace
@return conversation body after replacement
server/src/main/java/com/epam/aidial/core/server/service/PublicationUtil.java