mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Remove the old mechanism of streaming compiled references
Do not need response generator to stuff compiled references in chat stream using "### compiled references:" separator. References are now sent to clients as structured json while streaming
This commit is contained in:
parent
eb4e12d3c5
commit
b36a7833a6
2 changed files with 0 additions and 9 deletions
|
@ -62,10 +62,6 @@ class ThreadedGenerator:
|
||||||
self.queue.put(data)
|
self.queue.put(data)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if self.compiled_references and len(self.compiled_references) > 0:
|
|
||||||
self.queue.put(f"### compiled references:{json.dumps(self.compiled_references)}")
|
|
||||||
if self.online_results and len(self.online_results) > 0:
|
|
||||||
self.queue.put(f"### compiled references:{json.dumps(self.online_results)}")
|
|
||||||
self.queue.put(StopIteration)
|
self.queue.put(StopIteration)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -938,11 +938,6 @@ async def chat(
|
||||||
return
|
return
|
||||||
if not connection_alive or not continue_stream:
|
if not connection_alive or not continue_stream:
|
||||||
continue
|
continue
|
||||||
# Stop streaming after compiled references section of response starts
|
|
||||||
# References are being processed via the references event rather than the message event
|
|
||||||
if "### compiled references:" in item:
|
|
||||||
continue_stream = False
|
|
||||||
item = item.split("### compiled references:")[0]
|
|
||||||
try:
|
try:
|
||||||
async for result in send_event("message", f"{item}"):
|
async for result in send_event("message", f"{item}"):
|
||||||
yield result
|
yield result
|
||||||
|
|
Loading…
Reference in a new issue