Thank you for your submission, an automated scan of your plugin code's revealed the following issues:

### Required

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L156)][[2](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L318)][[3](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L335)][[4](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L392)][[5](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L416)][[6](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L509)][[7](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L511)][[8](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L667)][[9](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L673)][[10](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L65)][[11](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L68)][[12](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L74)][[13](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L207)][[14](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L234)][[15](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L366)][[16](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L549)][[17](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L550)][[18](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L307)][[19](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L328)][[20](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L495)][[21](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L504)][[22](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L505)][[23](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L506)][[24](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L510)][[25](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L511)][[26](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L516)][[27](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L517)][[28](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L543)][[29](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L549)][[30](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L555)] and more :You should avoid assigning styles via JavaScript or in HTML and instead move all these styles into CSS so that they are more easily adaptable by themes and snippets.


[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/settings/GeneralSettingTab.ts#L594)][[2](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/implementations/OpenAI/OpenAIProvider.ts#L50)][[3](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/implementations/OpenRouter/OpenRouterProvider.ts#L74)][[4](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L1010)][[5](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L1011)]:Using `innerHTML`, `outerHTML` or similar API's is a security risk. Instead, use the DOM API or the Obsidian helper functions: <https://docs.obsidian.md/Plugins/User+interface/HTML+elements>

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/history/ChatHistoryManager.ts#L410)]:You should not cast this, instead use a `instanceof` check to make sure that it's actually a file/folder.

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L131)]:Do not detach leaves with your custom view in `onunload`, this is an antipattern, see: <https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines#Don't+detach+leaves+in+%60onunload%60>

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L620)][[2](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L625)][[3](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L1126)][[4](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L1159)][[5](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L1285)][[6](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L1425)][[7](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L1770)][[8](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/aiChatView.ts#L1795)][[9](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/implementations/OpenAI/OpenAIProvider.ts#L208)][[10](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/ProviderManager.ts#L486)][[11](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/ProviderManager.ts#L515)][[12](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/ProviderManager.ts#L548)][[13](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/ProviderManager.ts#L583)][[14](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/implementations/Ollama/OllamaProvider.ts#L181)][[15](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/implementations/OpenRouter/OpenRouterProvider.ts#L264)][[16](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/implementations/OpenRouter/OpenRouterProvider.ts#L293)][[17](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/history/ChatHistoryManager.ts#L174)][[18](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L474)][[19](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L991)][[20](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L1016)][[21](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L1030)]:You should consider limiting the number of `console.log`s in your code, to not pollute the dev console.



---

### Optional

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L468)][[2](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistorySidebar.ts#L481)][[3](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/views/components/HistoryModal.ts#L222)]:Use `app.fileManager.trashFile(file: TAbstractFile)` instead, this will make sure that the file is deleted according to the users preferences.

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/providers/ProviderManager.ts#L565-L571)]:Obsidian provides the [`requestUrl`](https://docs.obsidian.md/Reference/TypeScript+API/requestUrl) method, it will make sure that network requests work on every plattform.

[[1](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L920)][[2](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L938)][[3](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1004)][[4](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1026)][[5](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1045)][[6](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1070)][[7](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1170)][[8](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1190)][[9](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1211)][[10](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1232)][[11](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/src/flares/FlareManager.ts#L1253)][[12](https://github.com/AlexXYK/flare-ai/blob/23dd2f8e70b311f5ad56774fc6ec34d883a3c1fd/main.ts#L952)]:Casting to `any` should be avoided as much as possible.



---



Do <b>NOT</b> open a new PR for re-validation.
Once you have pushed all of the required changes to your repo, the bot will update the labels on this PR within 6 hours.
If you think some of the required changes are incorrect, please comment with `/skip` and the reason why you think the results are incorrect.