[BUG] Incorrect detection of generation failure leads to infinite loop
I was encountering an infinite loop of empty AI responses halfway through the generation process, seemingly at random.
While debugging, I identified that the code to handle a generation failure ( Writer/Interface/Wrapper.py:388 ) does not correctly handle a message with no content, resulting in an infinite loop of empty response generation. Using a breakpoint to add spaces before the test, the infinite loop was broken.
(I assume my specific configuration resulted in generation failures with no white-space, while this was tested with a configuration that did generate white-space even when it failed)
if _Messages[-1]["content"].isspace():
I recommend the line be changed to the following:
if _Messages[-1]["content"].trim() == "":
Thank you! Would you mind making that into a PR? I'd be happy to merge it!