mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-03-28 05:58:33 +08:00
fix: fast mode and relax mode checkout
This commit is contained in:
@@ -66,7 +66,7 @@ class LinkAI(Plugin):
|
|||||||
if not context.kwargs.get("isgroup"):
|
if not context.kwargs.get("isgroup"):
|
||||||
_set_reply_text("该指令需在群聊中使用", e_context, level=ReplyType.ERROR)
|
_set_reply_text("该指令需在群聊中使用", e_context, level=ReplyType.ERROR)
|
||||||
return
|
return
|
||||||
if e_context["context"]["session_id"] not in global_config["admin_users"]:
|
if context.kwargs.get("msg").actual_user_id not in global_config["admin_users"]:
|
||||||
_set_reply_text("需要管理员权限执行", e_context, level=ReplyType.ERROR)
|
_set_reply_text("需要管理员权限执行", e_context, level=ReplyType.ERROR)
|
||||||
return
|
return
|
||||||
app_code = cmd[2]
|
app_code = cmd[2]
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class MJBot:
|
|||||||
if res.get("code") == 200:
|
if res.get("code") == 200:
|
||||||
task_id = res.get("data").get("taskId")
|
task_id = res.get("data").get("taskId")
|
||||||
real_prompt = res.get("data").get("realPrompt")
|
real_prompt = res.get("data").get("realPrompt")
|
||||||
if mode == TaskMode.RELAX.name:
|
if mode == TaskMode.RELAX.value:
|
||||||
time_str = "1~10分钟"
|
time_str = "1~10分钟"
|
||||||
else:
|
else:
|
||||||
time_str = "1~2分钟"
|
time_str = "1~2分钟"
|
||||||
@@ -174,11 +174,12 @@ class MJBot:
|
|||||||
logger.info(f"[MJ] image upscale, img_id={img_id}, index={index}")
|
logger.info(f"[MJ] image upscale, img_id={img_id}, index={index}")
|
||||||
body = {"type": TaskType.UPSCALE.name, "imgId": img_id, "index": index}
|
body = {"type": TaskType.UPSCALE.name, "imgId": img_id, "index": index}
|
||||||
res = requests.post(url=self.base_url + "/operate", json=body, headers=self.headers)
|
res = requests.post(url=self.base_url + "/operate", json=body, headers=self.headers)
|
||||||
|
logger.debug(res)
|
||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
res = res.json()
|
res = res.json()
|
||||||
logger.info(res)
|
|
||||||
if res.get("code") == 200:
|
if res.get("code") == 200:
|
||||||
task_id = res.get("data").get("taskId")
|
task_id = res.get("data").get("taskId")
|
||||||
|
logger.info(f"[MJ] image upscale processing, task_id={task_id}")
|
||||||
content = f"🔎图片正在放大中,请耐心等待"
|
content = f"🔎图片正在放大中,请耐心等待"
|
||||||
reply = Reply(ReplyType.INFO, content)
|
reply = Reply(ReplyType.INFO, content)
|
||||||
task = MJTask(id=task_id, status=Status.PENDING, user_id=user_id, task_type=TaskType.UPSCALE)
|
task = MJTask(id=task_id, status=Status.PENDING, user_id=user_id, task_type=TaskType.UPSCALE)
|
||||||
@@ -274,7 +275,7 @@ class MJBot:
|
|||||||
return False
|
return False
|
||||||
task_count = len([t for t in self.tasks.values() if t.status == Status.PENDING])
|
task_count = len([t for t in self.tasks.values() if t.status == Status.PENDING])
|
||||||
if task_count >= self.config.get("max_tasks"):
|
if task_count >= self.config.get("max_tasks"):
|
||||||
reply = Reply(ReplyType.INFO, "Midjourney服务的总任务数已达上限,请稍后再试")
|
reply = Reply(ReplyType.INFO, "Midjourney作图任务数已达上限,请稍后再试")
|
||||||
e_context["reply"] = reply
|
e_context["reply"] = reply
|
||||||
e_context.action = EventAction.BREAK_PASS
|
e_context.action = EventAction.BREAK_PASS
|
||||||
return False
|
return False
|
||||||
@@ -282,9 +283,9 @@ class MJBot:
|
|||||||
|
|
||||||
def _fetch_mode(self, prompt) -> str:
|
def _fetch_mode(self, prompt) -> str:
|
||||||
mode = self.config.get("mode")
|
mode = self.config.get("mode")
|
||||||
if "--relax" in prompt or mode == TaskMode.RELAX.name:
|
if "--relax" in prompt or mode == TaskMode.RELAX.value:
|
||||||
return TaskMode.RELAX.name
|
return TaskMode.RELAX.value
|
||||||
return TaskMode.FAST.name
|
return mode or TaskMode.RELAX.value
|
||||||
|
|
||||||
def _run_loop(self, loop: asyncio.BaseEventLoop):
|
def _run_loop(self, loop: asyncio.BaseEventLoop):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user