🐛v0.1.1,更改zhDateTime最低版本

This commit is contained in:
Asankilp 2024-10-02 01:23:09 +08:00
parent 3b931ad66c
commit f3904c9dd2
3 changed files with 8 additions and 6 deletions

View File

@ -5,8 +5,8 @@ from nonebot import get_driver
usage = """MarshoAI Alpha by Asankilp usage = """MarshoAI Alpha by Asankilp
用法 用法
marsho <聊天内容> : Marsho 进行对话当模型为 GPT-4o(-mini) 等时可以带上图片进行对话 marsho <聊天内容> : Marsho 进行对话当模型为 GPT-4o(-mini) 等时可以带上图片进行对话
reset : 重置当前会话的上下文 reset : 重置当前会话的上下文 需要加上命令前缀使用(默认为'/')
超级用户命令: 超级用户命令(均需要加上命令前缀使用):
changemodel <模型名> : 切换全局 AI 模型 changemodel <模型名> : 切换全局 AI 模型
contexts : 返回当前会话的上下文列表 当上下文包含图片时不要使用此命令 contexts : 返回当前会话的上下文列表 当上下文包含图片时不要使用此命令
praises : 返回夸赞名单的提示词 praises : 返回夸赞名单的提示词

View File

@ -51,12 +51,12 @@ def build_praises():
def get_prompt(): def get_prompt():
prompts = "" prompts = ""
prompts += config.marshoai_additional_prompt 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: if config.marshoai_enable_praises:
praises_prompt = build_praises() praises_prompt = build_praises()
prompts += praises_prompt prompts += praises_prompt
if config.marshoai_enable_time_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}" time_prompt = f"现在的时间是{current_time},农历{current_lunar_date}"
prompts += time_prompt prompts += time_prompt
marsho_prompt = config.marshoai_prompt marsho_prompt = config.marshoai_prompt
@ -71,6 +71,8 @@ def suggest_solution(errinfo: str):
suggestion = "模型达到调用速率限制。请稍等一段时间或联系Bot管理员。" suggestion = "模型达到调用速率限制。请稍等一段时间或联系Bot管理员。"
elif "tokens_limit_reached" in errinfo: elif "tokens_limit_reached" in errinfo:
suggestion = "请求token达到上限。请重置上下文。" suggestion = "请求token达到上限。请重置上下文。"
elif "unauthorized" in errinfo:
suggestion = "Azure凭据无效。请联系Bot管理员。"
if suggestion != "": if suggestion != "":
return "\n"+suggestion return "\n"+suggestion
else: else:

View File

@ -1,6 +1,6 @@
[project] [project]
name = "nonebot-plugin-marshoai" name = "nonebot-plugin-marshoai"
version = "0.1" version = "0.1.1"
description = "Nonebot2插件调用Azure OpenAI服务实现猫娘聊天" description = "Nonebot2插件调用Azure OpenAI服务实现猫娘聊天"
readme = "README.md" readme = "README.md"
requires-python = "<4.0,>=3.9" requires-python = "<4.0,>=3.9"
@ -9,7 +9,7 @@ dependencies = [
"nonebot2[fastapi, websockets]>=2.2.0", "nonebot2[fastapi, websockets]>=2.2.0",
"nonebot-plugin-alconna>=0.48.0", "nonebot-plugin-alconna>=0.48.0",
"azure-ai-inference>=1.0.0b4", "azure-ai-inference>=1.0.0b4",
"zhDatetime>=1.1.0", "zhDatetime>=1.1.1",
"aiohttp>=3.9", "aiohttp>=3.9",
"httpx>=0.27.0" "httpx>=0.27.0"
] ]