🌡v0.2.1,新增2个配置项

This commit is contained in:
Asankilp 2024-10-04 22:00:02 +08:00
parent e4facb65f7
commit a0bfa7fa7f
5 changed files with 23 additions and 7 deletions

View File

@ -118,10 +118,12 @@ _✨ 使用 Azure OpenAI 推理服务的聊天机器人插件 ✨_
| 配置项 | 必填 | 默认值 | 说明 |
| :---------------: | :--: | :----: | :----------------------------------------------------------: |
| MARSHOAI_TOKEN | 是 | 无 | 调用 API 必需的 token |
| MARSHOAI_TOKEN | 是 | 无 | 调用 API 必需的访问 token |
| MARSHOAI_DEFAULT_MODEL | 否 | `gpt-4o-mini` | Marsho 默认调用的模型 |
| MARSHOAI_PROMPT | 否 | 猫娘 Marsho 人设提示词 | Marsho 的基本系统提示词 |
| MARSHOAI_ADDITIONAL_PROMPT | 否 | 无 | Marsho 的扩展系统提示词 |
| MARSHOAI_ENABLE_PRAISES | 否 | `true` | 是否启用夸赞名单功能 |
| MARSHOAI_ENABLE_TIME_PROMPT | 否 | `true` | 是否启用实时更新的日期与时间(精确到秒)与农历日期系统提示词 |
| MARSHOAI_AZURE_ENDPOINT | 否 | `https://models.inference.ai.azure.com` | 调用 Azure OpenAI 服务的 API 终结点 |
| MARSHOAI_AZURE_ENDPOINT | 否 | `https://models.inference.ai.azure.com` | 调用 Azure OpenAI 服务的 API 终结点 |
| MARSHOAI_TEMPERATURE | 否 | 无 | 进行推理时的温度参数 |
| MARSHOAI_MAX_TOKENS | 否 | 无 | 返回消息的最大 token 数 |

View File

@ -121,7 +121,9 @@ async def marsho(
usermsg += str(clean_text)
response = await client.complete(
messages=context.build(target.id, target.private)+[UserMessage(content=usermsg)],
model=model_name
model=model_name,
temperature=config.marshoai_temperature,
max_tokens=config.marshoai_max_tokens
)
#await UniMessage(str(response)).send()
choice = response.choices[0]

View File

@ -11,4 +11,6 @@ class ConfigModel(BaseModel):
marshoai_enable_praises: bool = True
marshoai_enable_time_prompt: bool = True
marshoai_azure_endpoint: str = "https://models.inference.ai.azure.com"
marshoai_temperature: float = None
marshoai_max_tokens: int = None
config: ConfigModel = get_plugin_config(ConfigModel)

View File

@ -1,6 +1,6 @@
[project]
name = "nonebot-plugin-marshoai"
version = "0.2"
version = "0.2.1"
description = "Nonebot2插件调用Azure OpenAI服务实现猫娘聊天"
readme = "README.md"
requires-python = "<4.0,>=3.9"

View File

@ -14,7 +14,10 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#">
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<title
id="title1">Marsho logo</title>
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
@ -26,8 +29,8 @@
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
inkscape:zoom="1.4142136"
inkscape:cx="224.15285"
inkscape:cy="75.306872"
inkscape:cx="224.15284"
inkscape:cy="75.30687"
inkscape:window-width="2880"
inkscape:window-height="1514"
inkscape:window-x="-11"
@ -209,6 +212,13 @@
rdf:about="">
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-nc-sa/4.0/" />
<dc:title>Marsho logo</dc:title>
<dc:creator>
<cc:Agent>
<dc:title>Asankilp</dc:title>
</cc:Agent>
</dc:creator>
<dc:description>可爱猫娘Marsho的可爱logo~</dc:description>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-nc-sa/4.0/">

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB