Dodani makiety dla monitora stanu dialogu i ramki wraz z przykładami użycia

This commit is contained in:
Patryk Osiński 2024-04-19 21:22:02 +02:00
parent c3fb071cbf
commit 82f1c9b0da
3 changed files with 28 additions and 0 deletions

10
src/main.py Normal file
View 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
View File

@ -0,0 +1,4 @@
class Frame:
def __init__(self, source: str, text: str):
self.source = source
self.text = text

View 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]