Fix stop signal handling and Sider streaming wrapper

This commit is contained in:
Jiaqing Liang
2026-02-06 10:39:36 +08:00
parent b37b56a780
commit de0cce72e0
3 changed files with 6 additions and 8 deletions

View File

@@ -15,11 +15,8 @@ class SiderLLMSession:
if len(prompt) > 28000:
print(f"[Warn] Prompt too long ({len(prompt)} chars), truncating.")
prompt = prompt[-28000:]
gen = self._core.chat(prompt, model)
full_text = ''.join(list(gen))
if stream:
def wrap_as_stream(): yield full_text
return wrap_as_stream() # gen有奇怪的死循环行为sider足够快
full_text = self._core.chat(prompt, model, stream=False)
if stream: return iter([full_text]) # gen有奇怪的空回复或死循环行为sider足够快
return full_text
class LLMSession: