fix : response timeout

This commit is contained in:
martin legrand 2025-03-29 14:30:28 +01:00
parent 90894f806a
commit f42a31578e
2 changed files with 14 additions and 4 deletions

View File

@ -20,6 +20,17 @@ class LlamacppLLM(GeneratorLLM):
)
return
self.logger.info(f"Using {self.model} for generation with Llama.cpp")
self.llm.create_chat_completion(
messages = history
)
try:
with self.state.lock:
self.state.is_generating = True
self.state.last_complete_sentence = ""
self.state.current_buffer = ""
output = self.llm.create_chat_completion(
messages = history
)
self.state.current_buffer = output
except Exception as e:
self.logger.error(f"Error: {e}")
finally:
with self.state.lock:
self.state.is_generating = False

View File

@ -18,7 +18,6 @@ class OllamaLLM(GeneratorLLM):
self.state.last_complete_sentence = ""
self.state.current_buffer = ""
self.logger.info("Starting generation...")
stream = ollama.chat(
model=self.model,
messages=history,