perf: 控制台输出请求响应过程

This commit is contained in:
RockChinQ
2024-02-20 22:56:42 +08:00
parent 3258d5b255
commit 80858672b0
5 changed files with 37 additions and 4 deletions

View File

@@ -31,3 +31,13 @@ class Message(pydantic.BaseModel):
tool_calls: typing.Optional[list[ToolCall]] = None
tool_call_id: typing.Optional[str] = None
def readable_str(self) -> str:
if self.content is not None:
return self.content
elif self.function_call is not None:
return f'{self.function_call.name}({self.function_call.arguments})'
elif self.tool_calls is not None:
return f'调用工具: {self.tool_calls[0].id}'
else:
return '未知消息'