mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-07-31 08:59:51 +00:00
⭐增设版权声明,更新授权年份,主题色! (#2)
* 优化更新
* 代码不够黑,新增一个空行
* ?
* 空格?
* 新年新气象,莫生气
* 又是空格
* 附和:zhDateTime1.1.1 修复过于愚蠢导致的问题
* ⭐增设版权声明,更新授权年份,主题色!
* ?怎么没删
* 更新 zhDateTime 库版本,主题色往文档里塞
* 我愚蠢了
This commit is contained in:
@ -1,3 +1,27 @@
|
||||
"""
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Asankilp & LiteyukiStudio
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"""
|
||||
|
||||
from nonebot.plugin import require
|
||||
|
||||
require("nonebot_plugin_alconna")
|
||||
|
@ -16,7 +16,7 @@ class ConfigModel(BaseModel):
|
||||
marshoai_aliases: list[str] = [
|
||||
"小棉",
|
||||
]
|
||||
marshoai_main_colour: str = "FFAAAA"
|
||||
marshoai_main_colour: str = "FEABA9"
|
||||
marshoai_default_model: str = "gpt-4o-mini"
|
||||
marshoai_prompt: str = (
|
||||
"你是一只可爱的猫娘,你的生日是9月6日,你喜欢晒太阳,撒娇,吃零食,玩耍等等可爱的事情,偶尔会调皮一下,"
|
||||
|
@ -8,7 +8,7 @@ marshoai_aliases:
|
||||
|
||||
marshoai_at: false # 决定是否开启at响应
|
||||
|
||||
marshoai_main_colour: "FFAAAA" # 默认主色,部分插件和功能使用
|
||||
marshoai_main_colour: "FEABA9" # 默认主色,部分插件和功能使用
|
||||
marshoai_default_model: "gpt-4o-mini" # 默认模型,设定为gpt-4o-mini。
|
||||
|
||||
# 主提示词,定义了Marsho的性格和行为,包含多语言名字翻译规则和对特定问题的回答约束。
|
||||
|
@ -13,15 +13,17 @@ __marsho_meta__ = PluginMetadata(
|
||||
)
|
||||
|
||||
|
||||
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
|
||||
|
||||
@on_function_call(description="获取当前时间,日期和星期")
|
||||
async def get_current_time() -> str:
|
||||
"""获取当前的时间和日期"""
|
||||
current_time = DateTime.now().strftime("%Y.%m.%d %H:%M:%S")
|
||||
current_weekday = DateTime.now().weekday()
|
||||
current_time = DateTime.now()
|
||||
|
||||
weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
current_weekday_name = weekdays[current_weekday]
|
||||
|
||||
current_lunar_date = DateTime.now().to_lunar().date_hanzify()[5:]
|
||||
time_prompt = f"现在的时间是 {current_time},{current_weekday_name},农历 {current_lunar_date}。"
|
||||
time_prompt = "现在的时间是 {},{},{}。".format(
|
||||
current_time.strftime("%Y.%m.%d %H:%M:%S"),
|
||||
weekdays[current_time.weekday()],
|
||||
current_time.chinesize.date_hanzify("农历{干支年}{生肖}年 {月份}月{数序日}"),
|
||||
)
|
||||
return time_prompt
|
||||
|
@ -30,7 +30,7 @@ NOT_GIVEN = NotGiven()
|
||||
# 时间参数相关
|
||||
if config.marshoai_enable_time_prompt:
|
||||
_weekdays = ["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]
|
||||
_time_prompt = "现在的时间是{date_time},{weekday_name},农历{lunar_date}。"
|
||||
_time_prompt = "现在的时间是{date_time}{weekday_name},{lunar_date}。"
|
||||
|
||||
|
||||
# noinspection LongLine
|
||||
@ -254,8 +254,7 @@ async def refresh_nickname_json():
|
||||
|
||||
def get_prompt():
|
||||
"""获取系统提示词"""
|
||||
prompts = ""
|
||||
prompts += config.marshoai_additional_prompt
|
||||
prompts = config.marshoai_additional_prompt
|
||||
if config.marshoai_enable_praises:
|
||||
praises_prompt = build_praises()
|
||||
prompts += praises_prompt
|
||||
@ -266,8 +265,8 @@ def get_prompt():
|
||||
"%Y年%m月%d日 %H:%M:%S"
|
||||
),
|
||||
weekday_name=_weekdays[current_time.weekday()],
|
||||
lunar_date=current_time.to_lunar().date_hanzify(
|
||||
"{干支年}{生肖}年{月份}月{日期}日"
|
||||
lunar_date=current_time.chinesize.date_hanzify(
|
||||
"农历{干支年}{生肖}年{月份}月{日期}"
|
||||
),
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user