mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 11:42:44 +08:00
fix: chat处理过程的插件返回值目标错误
This commit is contained in:
parent
0752698c1d
commit
d0b0f2209a
|
@ -39,7 +39,14 @@ class ChatMessageHandler(handler.MessageHandler):
|
|||
|
||||
if event_ctx.is_prevented_default():
|
||||
if event_ctx.event.reply is not None:
|
||||
query.resp_message_chain = mirai.MessageChain(event_ctx.event.reply)
|
||||
mc = mirai.MessageChain(event_ctx.event.reply)
|
||||
|
||||
query.resp_messages.append(
|
||||
llm_entities.Message(
|
||||
role='plugin',
|
||||
content=str(mc),
|
||||
)
|
||||
)
|
||||
|
||||
yield entities.StageProcessResult(
|
||||
result_type=entities.ResultType.CONTINUE,
|
||||
|
|
|
@ -29,6 +29,13 @@ class ResponseWrapper(stage.PipelineStage):
|
|||
if query.resp_messages[-1].role == 'command':
|
||||
query.resp_message_chain = mirai.MessageChain("[bot] "+query.resp_messages[-1].content)
|
||||
|
||||
yield entities.StageProcessResult(
|
||||
result_type=entities.ResultType.CONTINUE,
|
||||
new_query=query
|
||||
)
|
||||
elif query.resp_messages[-1].role == 'plugin':
|
||||
query.resp_message_chain = mirai.MessageChain(query.resp_messages[-1].content)
|
||||
|
||||
yield entities.StageProcessResult(
|
||||
result_type=entities.ResultType.CONTINUE,
|
||||
new_query=query
|
||||
|
|
|
@ -22,7 +22,7 @@ class ToolCall(pydantic.BaseModel):
|
|||
class Message(pydantic.BaseModel):
|
||||
"""消息"""
|
||||
|
||||
role: str # user, system, assistant, tool, command
|
||||
role: str # user, system, assistant, tool, command, plugin
|
||||
|
||||
name: typing.Optional[str] = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user