mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-07 02:46:10 +08:00
✨ 重新添加实时日期和时间提示功能
This commit is contained in:
parent
a3929a552d
commit
5bed46cf49
@ -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_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_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_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_TOOLS | `bool` | `false` | Turn on Marsho Tools or not |
|
||||||
| MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | Turn on Marsho Plugins or not
|
| MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | Turn on Marsho Plugins or not
|
||||||
| MARSHOAI_PLUGIN_DIRS | `list[str]` | `[]` | List of plugins directory |
|
| MARSHOAI_PLUGIN_DIRS | `list[str]` | `[]` | List of plugins directory |
|
||||||
|
@ -138,6 +138,7 @@ GitHub Models API 的限制较多,不建议使用,建议通过修改`MARSHOA
|
|||||||
| MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | 启用后用户发送带图请求时若模型不支持图片,则提示用户 |
|
| MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | 启用后用户发送带图请求时若模型不支持图片,则提示用户 |
|
||||||
| MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | 启用后用户未设置昵称时提示用户设置 |
|
| MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | 启用后用户未设置昵称时提示用户设置 |
|
||||||
| MARSHOAI_ENABLE_PRAISES | `bool` | `true` | 是否启用夸赞名单功能 |
|
| MARSHOAI_ENABLE_PRAISES | `bool` | `true` | 是否启用夸赞名单功能 |
|
||||||
|
| MARSHOAI_ENABLE_TIME_PROMPT | `bool` | `true` | 是否启用实时更新的日期与时间(精确到秒)与农历日期系统提示词 |
|
||||||
| MARSHOAI_ENABLE_TOOLS | `bool` | `false` | 是否启用小棉工具 |
|
| MARSHOAI_ENABLE_TOOLS | `bool` | `false` | 是否启用小棉工具 |
|
||||||
| MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | 是否启用小棉插件 |
|
| MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | 是否启用小棉插件 |
|
||||||
| MARSHOAI_PLUGINS | `list[str]` | `[]` | 要从`sys.path`加载的插件的名称,例如从pypi安装的包 |
|
| MARSHOAI_PLUGINS | `list[str]` | `[]` | 要从`sys.path`加载的插件的名称,例如从pypi安装的包 |
|
||||||
|
@ -32,6 +32,7 @@ class ConfigModel(BaseModel):
|
|||||||
marshoai_poke_suffix: str = "揉了揉你的猫耳"
|
marshoai_poke_suffix: str = "揉了揉你的猫耳"
|
||||||
marshoai_enable_richtext_parse: bool = True
|
marshoai_enable_richtext_parse: bool = True
|
||||||
marshoai_single_latex_parse: bool = False
|
marshoai_single_latex_parse: bool = False
|
||||||
|
marshoai_enable_time_prompt: bool = True
|
||||||
marshoai_enable_nickname_tip: bool = True
|
marshoai_enable_nickname_tip: bool = True
|
||||||
marshoai_enable_support_image_tip: bool = True
|
marshoai_enable_support_image_tip: bool = True
|
||||||
marshoai_enforce_nickname: bool = True
|
marshoai_enforce_nickname: bool = True
|
||||||
|
@ -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 Text as TextMsg
|
||||||
from nonebot_plugin_alconna import UniMessage
|
from nonebot_plugin_alconna import UniMessage
|
||||||
from openai import AsyncOpenAI
|
from openai import AsyncOpenAI
|
||||||
|
from zhDateTime import DateTime
|
||||||
|
|
||||||
from .config import config
|
from .config import config
|
||||||
from .constants import *
|
from .constants import *
|
||||||
@ -245,6 +246,13 @@ def get_prompt():
|
|||||||
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:
|
||||||
|
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
|
marsho_prompt = config.marshoai_prompt
|
||||||
spell = SystemMessage(content=marsho_prompt + prompts).as_dict()
|
spell = SystemMessage(content=marsho_prompt + prompts).as_dict()
|
||||||
return spell
|
return spell
|
||||||
|
Loading…
x
Reference in New Issue
Block a user