Skip to content

Commit

Permalink
update openapi framwork
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoskys committed Oct 23, 2023
1 parent 88e125f commit 7aa1432
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
33 changes: 16 additions & 17 deletions llmbot_plugin_bilisearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def pre_check(self):
logger.error(f"Plugin:bilibili:package <bilibili_api> not installed:{e}")
return False

def func_message(self, message_text):
def func_message(self, message_text, **kwargs):
"""
如果合格则返回message,否则返回None,表示不处理
"""
Expand All @@ -90,19 +90,20 @@ def func_message(self, message_text):
return self.function
return None

async def failed(self, platform, task, receiver, reason):
async def failed(self, platform, task, receiver, reason, **kwargs):
try:
_meta = task.task_meta.reply_notify(
plugin_name=__plugin_name__,
callback=TaskHeader.Meta.Callback(
role="function",
name=__plugin_name__
)
)
await Task(queue=platform).send_task(
task=TaskHeader(
sender=task.sender,
receiver=receiver,
task_meta=TaskHeader.Meta(
callback_forward=True,
callback=TaskHeader.Meta.Callback(
role="function",
name=__plugin_name__
),
),
task_meta=_meta,
message=[
RawMessage(
user_id=receiver.user_id,
Expand Down Expand Up @@ -150,15 +151,13 @@ async def run(self, task: TaskHeader, receiver: TaskHeader.Location, arg, **kwar
try:
_set = Bili.parse_obj(arg)
_search_result = await search_on_bilibili(_set.keywords)

_meta = task.task_meta.child(__plugin_name__)
_meta.callback_forward = True
_meta.callback_forward_reprocess = True
_meta.callback = TaskHeader.Meta.Callback(
role="function",
name=__plugin_name__
_meta = task.task_meta.reply_raw(
plugin_name=__plugin_name__,
callback=TaskHeader.Meta.Callback(
role="function",
name=__plugin_name__
)
)

await Task(queue=receiver.platform).send_task(
task=TaskHeader(
sender=task.sender, # 继承发送者
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "llmbot_plugin_bilisearch"
version = "0.1.2"
version = "0.1.3"
description = ""
authors = ["Your Name <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 7aa1432

Please sign in to comment.