diff --git a/docs/en/start/install.md b/docs/en/start/install.md index 3c551598..2da971e0 100644 --- a/docs/en/start/install.md +++ b/docs/en/start/install.md @@ -136,6 +136,7 @@ Add options in the `.env` file from the diagram below in nonebot2 project. | MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | When on, if user send request with photo and model don't support that, remind the user | | MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | When on, if user haven't set username, remind user to set | | MARSHOAI_ENABLE_PRAISES | `bool` | `true` | Turn on Praise list or not | +| MARSHOAI_ENABLE_TIME_PROMPT | `bool` | `true` | Turn on real-time date and time (accurate to seconds) and lunar date system prompt | | MARSHOAI_ENABLE_TOOLS | `bool` | `false` | Turn on Marsho Tools or not | | MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | Turn on Marsho Plugins or not | MARSHOAI_PLUGIN_DIRS | `list[str]` | `[]` | List of plugins directory | diff --git a/docs/zh/start/install-new.md b/docs/zh/start/install-new.md index 94050de3..504c20b9 100644 --- a/docs/zh/start/install-new.md +++ b/docs/zh/start/install-new.md @@ -138,6 +138,7 @@ GitHub Models API 的限制较多,不建议使用,建议通过修改`MARSHOA | MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | 启用后用户发送带图请求时若模型不支持图片,则提示用户 | | MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | 启用后用户未设置昵称时提示用户设置 | | MARSHOAI_ENABLE_PRAISES | `bool` | `true` | 是否启用夸赞名单功能 | +| MARSHOAI_ENABLE_TIME_PROMPT | `bool` | `true` | 是否启用实时更新的日期与时间(精确到秒)与农历日期系统提示词 | | MARSHOAI_ENABLE_TOOLS | `bool` | `false` | 是否启用小棉工具 | | MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | 是否启用小棉插件 | | MARSHOAI_PLUGINS | `list[str]` | `[]` | 要从`sys.path`加载的插件的名称,例如从pypi安装的包 | diff --git a/nonebot_plugin_marshoai/config.py b/nonebot_plugin_marshoai/config.py index 6e9e2c08..b87c1460 100644 --- a/nonebot_plugin_marshoai/config.py +++ b/nonebot_plugin_marshoai/config.py @@ -32,6 +32,7 @@ class ConfigModel(BaseModel): marshoai_poke_suffix: str = "揉了揉你的猫耳" marshoai_enable_richtext_parse: bool = True marshoai_single_latex_parse: bool = False + marshoai_enable_time_prompt: bool = True marshoai_enable_nickname_tip: bool = True marshoai_enable_support_image_tip: bool = True marshoai_enforce_nickname: bool = True diff --git a/nonebot_plugin_marshoai/plugins/marshoai_basic/__init__.py b/nonebot_plugin_marshoai/plugins_test/marshoai_basic/__init__.py similarity index 100% rename from nonebot_plugin_marshoai/plugins/marshoai_basic/__init__.py rename to nonebot_plugin_marshoai/plugins_test/marshoai_basic/__init__.py diff --git a/nonebot_plugin_marshoai/plugins/marshoai_basic/tools.json b/nonebot_plugin_marshoai/plugins_test/marshoai_basic/tools.json similarity index 100% rename from nonebot_plugin_marshoai/plugins/marshoai_basic/tools.json rename to nonebot_plugin_marshoai/plugins_test/marshoai_basic/tools.json diff --git a/nonebot_plugin_marshoai/plugins/marshoai_basic/tools_test.json b/nonebot_plugin_marshoai/plugins_test/marshoai_basic/tools_test.json similarity index 100% rename from nonebot_plugin_marshoai/plugins/marshoai_basic/tools_test.json rename to nonebot_plugin_marshoai/plugins_test/marshoai_basic/tools_test.json diff --git a/nonebot_plugin_marshoai/util.py b/nonebot_plugin_marshoai/util.py index b26e5e27..2aa9fe2b 100755 --- a/nonebot_plugin_marshoai/util.py +++ b/nonebot_plugin_marshoai/util.py @@ -17,6 +17,7 @@ from nonebot_plugin_alconna import Image as ImageMsg from nonebot_plugin_alconna import Text as TextMsg from nonebot_plugin_alconna import UniMessage from openai import AsyncOpenAI +from zhDateTime import DateTime from .config import config from .constants import * @@ -245,6 +246,13 @@ def get_prompt(): 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 spell = SystemMessage(content=marsho_prompt + prompts).as_dict() return spell