Dodani makiety dla monitora stanu dialogu i ramki wraz z przykładami użycia
This commit is contained in:
parent
c3fb071cbf
commit
82f1c9b0da
10
src/main.py
Normal file
10
src/main.py
Normal file
@ -0,0 +1,10 @@
|
||||
from src.model.frame import Frame
|
||||
from src.service.dialog_state_monitor import DialogStateMonitor
|
||||
|
||||
|
||||
# Example
|
||||
monitor = DialogStateMonitor()
|
||||
monitor.append(Frame('system', 'hello'))
|
||||
monitor.append(Frame('user', 'some text'))
|
||||
print(monitor.get_all()[0].text)
|
||||
print(monitor.get_last().text)
|
4
src/model/frame.py
Normal file
4
src/model/frame.py
Normal file
@ -0,0 +1,4 @@
|
||||
class Frame:
|
||||
def __init__(self, source: str, text: str):
|
||||
self.source = source
|
||||
self.text = text
|
14
src/service/dialog_state_monitor.py
Normal file
14
src/service/dialog_state_monitor.py
Normal file
@ -0,0 +1,14 @@
|
||||
from src.model.frame import Frame
|
||||
|
||||
|
||||
class DialogStateMonitor:
|
||||
dialog = []
|
||||
|
||||
def append(self, frame: Frame):
|
||||
self.dialog.append(frame)
|
||||
|
||||
def get_all(self) -> [Frame]:
|
||||
return self.dialog
|
||||
|
||||
def get_last(self) -> Frame:
|
||||
return self.dialog[len(self.dialog) - 1]
|
Loading…
Reference in New Issue
Block a user