diff --git a/plugins/linkai/linkai.py b/plugins/linkai/linkai.py index 7482459..c48da9d 100644 --- a/plugins/linkai/linkai.py +++ b/plugins/linkai/linkai.py @@ -66,7 +66,7 @@ class LinkAI(Plugin): if not context.kwargs.get("isgroup"): _set_reply_text("该指令需在群聊中使用", e_context, level=ReplyType.ERROR) 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) return app_code = cmd[2] diff --git a/plugins/linkai/midjourney.py b/plugins/linkai/midjourney.py index 9df8f34..93463cc 100644 --- a/plugins/linkai/midjourney.py +++ b/plugins/linkai/midjourney.py @@ -149,7 +149,7 @@ class MJBot: if res.get("code") == 200: task_id = res.get("data").get("taskId") real_prompt = res.get("data").get("realPrompt") - if mode == TaskMode.RELAX.name: + if mode == TaskMode.RELAX.value: time_str = "1~10分钟" else: time_str = "1~2分钟" @@ -174,11 +174,12 @@ class MJBot: logger.info(f"[MJ] image upscale, img_id={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) + logger.debug(res) if res.status_code == 200: res = res.json() - logger.info(res) if res.get("code") == 200: task_id = res.get("data").get("taskId") + logger.info(f"[MJ] image upscale processing, task_id={task_id}") content = f"🔎图片正在放大中,请耐心等待" reply = Reply(ReplyType.INFO, content) task = MJTask(id=task_id, status=Status.PENDING, user_id=user_id, task_type=TaskType.UPSCALE) @@ -274,7 +275,7 @@ class MJBot: return False task_count = len([t for t in self.tasks.values() if t.status == Status.PENDING]) if task_count >= self.config.get("max_tasks"): - reply = Reply(ReplyType.INFO, "Midjourney服务的总任务数已达上限,请稍后再试") + reply = Reply(ReplyType.INFO, "Midjourney作图任务数已达上限,请稍后再试") e_context["reply"] = reply e_context.action = EventAction.BREAK_PASS return False @@ -282,9 +283,9 @@ class MJBot: def _fetch_mode(self, prompt) -> str: mode = self.config.get("mode") - if "--relax" in prompt or mode == TaskMode.RELAX.name: - return TaskMode.RELAX.name - return TaskMode.FAST.name + if "--relax" in prompt or mode == TaskMode.RELAX.value: + return TaskMode.RELAX.value + return mode or TaskMode.RELAX.value def _run_loop(self, loop: asyncio.BaseEventLoop): """