copy tags of the specified entry

Hi all!

I need to implement copying all tags of the selected record from the specified folder to the specified property of the current record. The record selection is done through a modal window

I couldn’t find a solution to this problem on the forum, I tried to get a solution through Anthropic Sonnet

Sonnet copes quite well with most of the functions that are required when working with notes, problems arise when you need to copy the tags of the found record and paste

I can provide the javascript code and dataviewjs snippet below, which the neural network worked on

What I’m trying to do

Things I have tried