nonebot-plugin-githubmodels 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nonebot_plugin_githubmodels-0.2.1 → nonebot_plugin_githubmodels-0.2.2}/PKG-INFO +1 -1
- {nonebot_plugin_githubmodels-0.2.1 → nonebot_plugin_githubmodels-0.2.2}/nonebot_plugin_githubmodels/__init__.py +6 -8
- {nonebot_plugin_githubmodels-0.2.1 → nonebot_plugin_githubmodels-0.2.2}/pyproject.toml +1 -1
- {nonebot_plugin_githubmodels-0.2.1 → nonebot_plugin_githubmodels-0.2.2}/LICENSE +0 -0
- {nonebot_plugin_githubmodels-0.2.1 → nonebot_plugin_githubmodels-0.2.2}/README.md +0 -0
- {nonebot_plugin_githubmodels-0.2.1 → nonebot_plugin_githubmodels-0.2.2}/nonebot_plugin_githubmodels/config.py +0 -0
|
@@ -3,7 +3,7 @@ from nonebot import require, get_plugin_config
|
|
|
3
3
|
require("nonebot_plugin_alconna")
|
|
4
4
|
require("nonebot_plugin_htmlrender")
|
|
5
5
|
from openai import AsyncOpenAI
|
|
6
|
-
from arclet.alconna import Args, Option, Alconna
|
|
6
|
+
from arclet.alconna import Args, Option, Alconna, MultiVar
|
|
7
7
|
from nonebot.plugin import PluginMetadata
|
|
8
8
|
from nonebot_plugin_htmlrender import md_to_pic
|
|
9
9
|
from nonebot_plugin_alconna import UniMessage, on_alconna, Match
|
|
@@ -25,7 +25,7 @@ shared_context = []
|
|
|
25
25
|
ai = on_alconna(
|
|
26
26
|
Alconna(
|
|
27
27
|
"AI",
|
|
28
|
-
Args["user_input?", str],
|
|
28
|
+
Args["user_input?", MultiVar(str)],
|
|
29
29
|
Option("-r|--reset"),
|
|
30
30
|
Option("-i|--image"),
|
|
31
31
|
),
|
|
@@ -41,21 +41,19 @@ async def ai_reset():
|
|
|
41
41
|
await ai.finish("上下文已重置")
|
|
42
42
|
|
|
43
43
|
@ai.assign("image")
|
|
44
|
-
async def ai_image(user_input: Match[str]):
|
|
44
|
+
async def ai_image(user_input: Match[tuple[str]]):
|
|
45
45
|
if user_input.available:
|
|
46
46
|
global REPLY_IMAGE
|
|
47
47
|
REPLY_IMAGE = True
|
|
48
|
-
ai.set_path_arg("user_input", user_input.result)
|
|
48
|
+
ai.set_path_arg("user_input", " ".join(user_input.result))
|
|
49
49
|
|
|
50
50
|
@ai.handle()
|
|
51
|
-
async def handle_function(user_input: Match[str]):
|
|
51
|
+
async def handle_function(user_input: Match[tuple[str]]):
|
|
52
52
|
if user_input.available:
|
|
53
|
-
ai.set_path_arg("user_input", user_input.result)
|
|
53
|
+
ai.set_path_arg("user_input", " ".join(user_input.result))
|
|
54
54
|
|
|
55
55
|
@ai.got_path("user_input", prompt="请输入有效问题")
|
|
56
56
|
async def got_location(user_input: str):
|
|
57
|
-
if not user_input.strip():
|
|
58
|
-
await ai.reject("你真的输入了有效问题吗?请输入有效问题")
|
|
59
57
|
global shared_context
|
|
60
58
|
shared_context.append({"role": "user", "content": user_input})
|
|
61
59
|
if len(shared_context) > MAX_CONTEXT_LENGTH:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|