Add dedicated information panel to the UI (#137)
* Allow streaming to the chatbot and the information panel without threading * Highlight evidence in a simple manner
This commit is contained in:
committed by
GitHub
parent
ebc61400d8
commit
513e86f490
@@ -1,5 +1,5 @@
|
||||
from abc import abstractmethod
|
||||
from typing import Iterator
|
||||
from typing import Iterator, Optional
|
||||
|
||||
from kotaemon.base.schema import Document
|
||||
from theflow import Function, Node, Param, lazy
|
||||
@@ -31,6 +31,17 @@ class BaseComponent(Function):
|
||||
|
||||
return self.__call__(self.inflow.flow())
|
||||
|
||||
def set_output_queue(self, queue):
|
||||
self._queue = queue
|
||||
for name in self._ff_nodes:
|
||||
node = getattr(self, name)
|
||||
if isinstance(node, BaseComponent):
|
||||
node.set_output_queue(queue)
|
||||
|
||||
def report_output(self, output: Optional[dict]):
|
||||
if self._queue is not None:
|
||||
self._queue.put_nowait(output)
|
||||
|
||||
@abstractmethod
|
||||
def run(
|
||||
self, *args, **kwargs
|
||||
|
Reference in New Issue
Block a user