diff --git a/nonebot_plugin_marshoai/__init__.py b/nonebot_plugin_marshoai/__init__.py index 94fc0a1c..8af1a338 100644 --- a/nonebot_plugin_marshoai/__init__.py +++ b/nonebot_plugin_marshoai/__init__.py @@ -5,8 +5,8 @@ from nonebot import get_driver usage = """MarshoAI Alpha by Asankilp 用法: marsho <聊天内容> : 与 Marsho 进行对话。当模型为 GPT-4o(-mini) 等时,可以带上图片进行对话。 - reset : 重置当前会话的上下文。 -超级用户命令: + reset : 重置当前会话的上下文。 ※需要加上命令前缀使用(默认为'/')。 +超级用户命令(均需要加上命令前缀使用): changemodel <模型名> : 切换全局 AI 模型。 contexts : 返回当前会话的上下文列表。 ※当上下文包含图片时,不要使用此命令。 praises : 返回夸赞名单的提示词。 diff --git a/nonebot_plugin_marshoai/util.py b/nonebot_plugin_marshoai/util.py index 85260d52..efb4e7f9 100644 --- a/nonebot_plugin_marshoai/util.py +++ b/nonebot_plugin_marshoai/util.py @@ -51,12 +51,12 @@ def build_praises(): def get_prompt(): prompts = "" prompts += config.marshoai_additional_prompt - current_time = datetime.now().strftime('%Y.%m.%d %H:%M:%S') - current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:]#库更新之前使用切片 if config.marshoai_enable_praises: praises_prompt = build_praises() prompts += praises_prompt if config.marshoai_enable_time_prompt: + current_time = datetime.now().strftime('%Y.%m.%d %H:%M:%S') + current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:] #库更新之前使用切片 time_prompt = f"现在的时间是{current_time},农历{current_lunar_date}。" prompts += time_prompt marsho_prompt = config.marshoai_prompt @@ -71,6 +71,8 @@ def suggest_solution(errinfo: str): suggestion = "模型达到调用速率限制。请稍等一段时间或联系Bot管理员。" elif "tokens_limit_reached" in errinfo: suggestion = "请求token达到上限。请重置上下文。" + elif "unauthorized" in errinfo: + suggestion = "Azure凭据无效。请联系Bot管理员。" if suggestion != "": return "\n"+suggestion else: diff --git a/pyproject.toml b/pyproject.toml index e774e989..9454f41d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nonebot-plugin-marshoai" -version = "0.1" +version = "0.1.1" description = "Nonebot2插件,调用Azure OpenAI服务实现猫娘聊天" readme = "README.md" requires-python = "<4.0,>=3.9" @@ -9,7 +9,7 @@ dependencies = [ "nonebot2[fastapi, websockets]>=2.2.0", "nonebot-plugin-alconna>=0.48.0", "azure-ai-inference>=1.0.0b4", - "zhDatetime>=1.1.0", + "zhDatetime>=1.1.1", "aiohttp>=3.9", "httpx>=0.27.0" ]