mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-24 14:56:44 +00:00
added callback support
This commit is contained in:
parent
e00da21da1
commit
5117b16c11
@ -856,6 +856,7 @@ class StateMachine:
|
|||||||
"""
|
"""
|
||||||
self.states_dict = states_dict
|
self.states_dict = states_dict
|
||||||
self.current_state_id = 0
|
self.current_state_id = 0
|
||||||
|
self.callback = None
|
||||||
|
|
||||||
def goto_state(self, state):
|
def goto_state(self, state):
|
||||||
"""
|
"""
|
||||||
@ -1201,6 +1202,9 @@ class APScript(StateMachine):
|
|||||||
step_text (dict): The step text
|
step_text (dict): The step text
|
||||||
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
if not callback and self.callback:
|
||||||
|
callback = self.callback
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
callback(full_text, MSG_TYPE.MSG_TYPE_FULL)
|
callback(full_text, MSG_TYPE.MSG_TYPE_FULL)
|
||||||
|
|
||||||
@ -1211,6 +1215,9 @@ class APScript(StateMachine):
|
|||||||
step_text (dict): The step text
|
step_text (dict): The step text
|
||||||
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
if not callback and self.callback:
|
||||||
|
callback = self.callback
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_AI)
|
callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_AI)
|
||||||
|
|
||||||
@ -1221,6 +1228,9 @@ class APScript(StateMachine):
|
|||||||
step_text (dict): The step text
|
step_text (dict): The step text
|
||||||
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
if not callback and self.callback:
|
||||||
|
callback = self.callback
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_USER)
|
callback(full_text, MSG_TYPE.MSG_TYPE_FULL_INVISIBLE_TO_USER)
|
||||||
|
|
||||||
@ -1232,6 +1242,9 @@ class APScript(StateMachine):
|
|||||||
step_text (dict): The step text
|
step_text (dict): The step text
|
||||||
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the info to. Defaults to None.
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the info to. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
if not callback and self.callback:
|
||||||
|
callback = self.callback
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
callback(info_text, MSG_TYPE.MSG_TYPE_FULL)
|
callback(info_text, MSG_TYPE.MSG_TYPE_FULL)
|
||||||
|
|
||||||
@ -1242,8 +1255,13 @@ class APScript(StateMachine):
|
|||||||
step_text (dict): The step progress in %
|
step_text (dict): The step progress in %
|
||||||
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the progress to. Defaults to None.
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the progress to. Defaults to None.
|
||||||
"""
|
"""
|
||||||
|
if not callback and self.callback:
|
||||||
|
callback = self.callback
|
||||||
|
|
||||||
if callback:
|
if callback:
|
||||||
callback(str(progress), MSG_TYPE.MSG_TYPE_STEP_PROGRESS)
|
callback(str(progress), MSG_TYPE.MSG_TYPE_STEP_PROGRESS)
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================
|
# ===========================================================
|
||||||
class AIPersonalityInstaller:
|
class AIPersonalityInstaller:
|
||||||
def __init__(self, personality:AIPersonality) -> None:
|
def __init__(self, personality:AIPersonality) -> None:
|
||||||
|
2
setup.py
2
setup.py
@ -26,7 +26,7 @@ def get_all_files(path):
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="lollms",
|
name="lollms",
|
||||||
version="2.1.54",
|
version="2.1.55",
|
||||||
author="Saifeddine ALOUI",
|
author="Saifeddine ALOUI",
|
||||||
author_email="aloui.saifeddine@gmail.com",
|
author_email="aloui.saifeddine@gmail.com",
|
||||||
description="A python library for AI personality definition",
|
description="A python library for AI personality definition",
|
||||||
|
Loading…
Reference in New Issue
Block a user