| 157 | // reply's parent needs to be found by checking every non isReply entry and |
| 158 | // see if it's included in the replies array of the parent |
| 159 | updateParentOfReply(replyPath) { |
| 160 | const reply = this.index.get(replyPath); |
| 161 | if (reply.isReply) { |
| 162 | for (let [filePath, metadata] of this.index) { |
| 163 | if (!metadata.isReply) { |
| 164 | if (metadata.replies.includes(replyPath)) { |
| 165 | // this is the parent |
| 166 | metadata.replies = metadata.replies.filter((p) => { |
| 167 | return p !== replyPath; |
| 168 | }); |
| 169 | metadata.replies.push(filePath); |
| 170 | this.index.set(filePath, metadata); |
| 171 | this.save(); |
| 172 | } |
| 173 | } |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | regenerateEmbeddings() { |
| 179 | pileEmbeddings.regenerateEmbeddings(this.index); |