mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
添加强制设置昵称配置项,移动测试插件到单独文件夹,稍微修改memory插件description(应该还是无法达到预期喵)
This commit is contained in:
parent
ba6b02d68e
commit
f9dc5e500e
@ -117,6 +117,7 @@ Add options in the `.env` file from the diagram below in nonebot2 project.
|
|||||||
| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | The default model of Marsho |
|
| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | The default model of Marsho |
|
||||||
| MARSHOAI_PROMPT | `str` | Catgirl Marsho's character prompt | Marsho's basic system prompt **※Some models(o1 and so on) don't support it** |
|
| MARSHOAI_PROMPT | `str` | Catgirl Marsho's character prompt | Marsho's basic system prompt **※Some models(o1 and so on) don't support it** |
|
||||||
| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho's external system prompt |
|
| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho's external system prompt |
|
||||||
|
| MARSHOAI_ENFORCE_NICKNAME | `bool` | `true` | Enforce user to set nickname or not |
|
||||||
| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | When double click Marsho who connected to OneBot adapter, the chat content. When it's empty string, double click function is off. Such as, the default content is `*[昵称]揉了揉你的猫耳。` |
|
| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | When double click Marsho who connected to OneBot adapter, the chat content. When it's empty string, double click function is off. Such as, the default content is `*[昵称]揉了揉你的猫耳。` |
|
||||||
| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI standard API |
|
| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI standard API |
|
||||||
| MARSHOAI_TEMPERATURE | `float` | `null` | temperature parameter |
|
| MARSHOAI_TEMPERATURE | `float` | `null` | temperature parameter |
|
||||||
|
@ -119,6 +119,7 @@ title: 安装
|
|||||||
| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | Marsho 默认调用的模型 |
|
| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | Marsho 默认调用的模型 |
|
||||||
| MARSHOAI_PROMPT | `str` | 猫娘 Marsho 人设提示词 | Marsho 的基本系统提示词 **※部分模型(o1等)不支持系统提示词。** |
|
| MARSHOAI_PROMPT | `str` | 猫娘 Marsho 人设提示词 | Marsho 的基本系统提示词 **※部分模型(o1等)不支持系统提示词。** |
|
||||||
| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho 的扩展系统提示词 |
|
| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho 的扩展系统提示词 |
|
||||||
|
| MARSHOAI_ENFORCE_NICKNAME | `bool` | `true` | 是否强制用户设置昵称 |
|
||||||
| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | 对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为`*[昵称]揉了揉你的猫耳。` |
|
| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | 对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为`*[昵称]揉了揉你的猫耳。` |
|
||||||
| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI 标准格式 API 端点 |
|
| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI 标准格式 API 端点 |
|
||||||
| MARSHOAI_TEMPERATURE | `float` | `null` | 推理生成多样性(温度)参数 |
|
| MARSHOAI_TEMPERATURE | `float` | `null` | 推理生成多样性(温度)参数 |
|
||||||
|
@ -278,9 +278,14 @@ async def marsho(
|
|||||||
# 用户名无法获取,暂时注释
|
# 用户名无法获取,暂时注释
|
||||||
# user_nickname = event.sender.nickname # 未设置昵称时获取用户名
|
# user_nickname = event.sender.nickname # 未设置昵称时获取用户名
|
||||||
# nickname_prompt = f"\n*此消息的说话者:{user_nickname}"
|
# nickname_prompt = f"\n*此消息的说话者:{user_nickname}"
|
||||||
|
if config.marshoai_enforce_nickname:
|
||||||
|
await UniMessage(
|
||||||
|
"※你未设置自己的昵称。你**必须**使用「nickname [昵称]」命令设置昵称后才能进行对话。"
|
||||||
|
).send()
|
||||||
|
return
|
||||||
if config.marshoai_enable_nickname_tip:
|
if config.marshoai_enable_nickname_tip:
|
||||||
await UniMessage(
|
await UniMessage(
|
||||||
"*你未设置自己的昵称。推荐使用'nickname [昵称]'命令设置昵称来获得个性化(可能)回答。"
|
"※你未设置自己的昵称。推荐使用「nickname [昵称]」命令设置昵称来获得个性化(可能)回答。"
|
||||||
).send()
|
).send()
|
||||||
|
|
||||||
is_support_image_model = (
|
is_support_image_model = (
|
||||||
|
@ -34,8 +34,9 @@ class ConfigModel(BaseModel):
|
|||||||
marshoai_single_latex_parse: bool = False
|
marshoai_single_latex_parse: bool = False
|
||||||
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_enable_praises: bool = True
|
marshoai_enable_praises: bool = True
|
||||||
marshoai_enable_time_prompt: 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_load_builtin_tools: bool = True
|
marshoai_load_builtin_tools: bool = True
|
||||||
|
@ -32,6 +32,8 @@ marshoai_enable_nickname_tip: true # 是否启用昵称提示。
|
|||||||
|
|
||||||
marshoai_enable_support_image_tip: true # 是否启用支持图片提示。
|
marshoai_enable_support_image_tip: true # 是否启用支持图片提示。
|
||||||
|
|
||||||
|
marshoai_enforce_nickname: true # 是否强制要求设定昵称。
|
||||||
|
|
||||||
marshoai_enable_praises: true # 是否启用夸赞名单功能。
|
marshoai_enable_praises: true # 是否启用夸赞名单功能。
|
||||||
|
|
||||||
marshoai_enable_tools: false # 是否启用工具支持。
|
marshoai_enable_tools: false # 是否启用工具支持。
|
||||||
|
@ -32,7 +32,7 @@ driver = get_driver()
|
|||||||
|
|
||||||
function_call = on_alconna(
|
function_call = on_alconna(
|
||||||
command=Alconna(
|
command=Alconna(
|
||||||
"marsho-function-call",
|
f"{config.marshoai_default_name}.funccall",
|
||||||
Subcommand(
|
Subcommand(
|
||||||
"call",
|
"call",
|
||||||
Args["function_name", str]["kwargs", MultiVar(str), []],
|
Args["function_name", str]["kwargs", MultiVar(str), []],
|
||||||
|
@ -20,8 +20,7 @@ memory_path = get_plugin_data_file("memory.json")
|
|||||||
if not Path(memory_path).exists():
|
if not Path(memory_path).exists():
|
||||||
with open(memory_path, "w", encoding="utf-8") as f:
|
with open(memory_path, "w", encoding="utf-8") as f:
|
||||||
json.dump({}, f, ensure_ascii=False, indent=4)
|
json.dump({}, f, ensure_ascii=False, indent=4)
|
||||||
print(memory_path)
|
# print(memory_path)
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
@on_function_call(description="存储记忆内容").params(
|
@on_function_call(description="存储记忆内容").params(
|
||||||
@ -43,9 +42,9 @@ async def write_memory(memory: str, user_id: str):
|
|||||||
return "记忆已经保存啦~"
|
return "记忆已经保存啦~"
|
||||||
|
|
||||||
|
|
||||||
@on_function_call(description="读取记忆内容").params(
|
@on_function_call(
|
||||||
user_id=String(description="你想读取记忆的人的id")
|
description="当用户与你发起对话时,你需要回忆有关他的一切,因此调用此函数读取记忆内容"
|
||||||
)
|
).params(user_id=String(description="你想读取记忆的人的id"))
|
||||||
async def read_memory(user_id: str):
|
async def read_memory(user_id: str):
|
||||||
with open(memory_path, "r", encoding="utf-8") as f:
|
with open(memory_path, "r", encoding="utf-8") as f:
|
||||||
memory_data = json.load(f)
|
memory_data = json.load(f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user