add remove_bg function
This commit is contained in:
@@ -18,6 +18,12 @@ class CallerContext:
|
||||
return f"{of}"
|
||||
return ""
|
||||
|
||||
def get_last_image(self) -> str:
|
||||
raise NotImplementedError("Function not implemented")
|
||||
|
||||
def set_last_image(self, img: str):
|
||||
raise NotImplementedError("Function not implemented")
|
||||
|
||||
async def reply_text(self, msg):
|
||||
raise NotImplementedError("Function not implemented")
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ class Session(CallerContext):
|
||||
_sio: SioConnection = None
|
||||
_session_id: str = None
|
||||
_tz_offset: int = 0 # timezone offset, in hours. = local_time - UTC0
|
||||
_last_image: str = None
|
||||
|
||||
_history_dir: str = None
|
||||
|
||||
@@ -163,6 +164,12 @@ class Session(CallerContext):
|
||||
def get_tz_offset(self):
|
||||
return self._tz_offset
|
||||
|
||||
def get_last_image(self) -> str:
|
||||
return self._last_image
|
||||
|
||||
def set_last_image(self, img: str):
|
||||
self._last_image = img
|
||||
|
||||
async def reply_text(self, msg):
|
||||
if self._message_id_ is None:
|
||||
raise function_error.FunctionError(function_error.EC_RESET, "Reset")
|
||||
|
||||
@@ -109,6 +109,8 @@ def run_server_mode():
|
||||
session.set_tz_offset(offset)
|
||||
elif msg.message_type == 'text':
|
||||
await session.on_chat_message(msg)
|
||||
elif msg.message_type == 'image':
|
||||
session.set_last_image(msg.message_content)
|
||||
|
||||
app.router.add_static('/js', './TestPage/js')
|
||||
app.router.add_static('/css', './TestPage/css')
|
||||
@@ -156,6 +158,8 @@ async def run_client_mode(session_map: dict[str, Session]):
|
||||
session.set_tz_offset(offset)
|
||||
elif msg.message_type == 'text':
|
||||
await session.on_chat_message(msg)
|
||||
elif msg.message_type == 'image':
|
||||
session.set_last_image(msg.message_content)
|
||||
|
||||
await sio.connect(CFG.bot_server_url)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user