mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-21 05:33:12 +00:00
23 lines
627 B
Python
23 lines
627 B
Python
from lollms.apps.console import Conversation
|
|
import sys
|
|
|
|
class MyConversation(Conversation):
|
|
def __init__(self, cfg=None):
|
|
super().__init__(cfg, show_welcome_message=False)
|
|
|
|
def start_conversation(self):
|
|
prompt = "Once apon a time"
|
|
def callback(text, type=None, metadata:dict={}):
|
|
print(text, end="")
|
|
sys.stdout = sys.__stdout__
|
|
sys.stdout.flush()
|
|
|
|
return True
|
|
print(prompt, end="")
|
|
sys.stdout = sys.__stdout__
|
|
sys.stdout.flush()
|
|
output = self.safe_generate(prompt, callback=callback)
|
|
|
|
if __name__ == '__main__':
|
|
cv = MyConversation()
|
|
cv.start_conversation() |