Hello there, I hope you can borrow this idea from opendeepwiki to make the mermaid diagram generation more reliable, by adding a RepairMermaid function that is powered by a LLM: https://github.com/AIDotNet/OpenDeepWiki/blob/531966791bbefef61d589308bea2b7af8f3c85cb/src/KoalaWiki/KoalaWarehouse/DocumentPending/DocumentPendingService.cs#L533