Bin-Huang / chatbox

User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)
https://chatboxai.app
GNU General Public License v3.0
21.48k stars 2.17k forks source link

[BUG] Other Software's File Monitoring Leads to High CPU Usage While Generating Messages #1595

Open frontier777 opened 1 day ago

frontier777 commented 1 day ago

I have noticed that after each Chatbox query, my Windows Antimalware Service Executable process goes crazy - enough for my older machine to stutter for a little while (20-30 seconds) until it finishes doing what it's doing.

  1. Go to Chatbox.
  2. Query the AI - I am using OpenAI 4o-mini.
  3. In Task Manager observe the "Antimalware Service Executable - Microsoft Defender Antivirus Service" process immediately start using 100% of a core.

Expected Results I wouldn't expect the antimalware process to be triggered to this extent, upon each AI query.

Actual Results System slow down due to above.

Desktop (please complete the following information):

Testing Using Process Monitor I can see the issue may be Chatbox continually calling CreateFile on filenames like these. C:\Users\\AppData\Roaming\xyz.chatboxapp.app\config.json.tmp-0421289212bd01f0 C:\Users\\AppData\Roaming\xyz.chatboxapp.app\config.json.tmp-0421289885032997 C:\Users\\AppData\Roaming\xyz.chatboxapp.app\config.json.tmp-0421290572318334 C:\Users\\AppData\Roaming\xyz.chatboxapp.app\config.json.tmp-04212912532c1376 C:\Users\\AppData\Roaming\xyz.chatboxapp.app\config.json.tmp-04212989060e02da

This continues on for 20-30 seconds - well after the AI response has completed, ie. all the while antimalware is triggered, checking these files I assume.

Workaround I added a Windows Security exclusion on the xyz.chatboxapp.app folder - obviously not ideal.

Bin-Huang commented 18 hours ago

It looks like this is happening because of how your security software handles JSON files. Chatbox saves conversations as JSON files and updates them frequently while generating messages. Your antivirus software seems to be checking these files very closely, which is what's causing the high CPU usage.

This is pretty common, especially in corporate environments where security settings are strict and closely monitor file changes - particularly web-related files like JSON. It's just how some security software is set up by default, and not actually a problem with Chatbox.

For a quick fix, you could try adding the JSON file to your security software's exception list. Since it's just a plain text file storing chat data, it should be perfectly safe to exclude.

Just so you know, I'm currently working on a new way to store data (probably using SQLite3) that should prevent this kind of issue. Since I need to make it work across Web, iOS, and Android, it might take a while to get everything right.