mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
🐛 优化Caller类中的参数处理逻辑,简化properties构建
This commit is contained in:
parent
aad0ec7b60
commit
9851872724
@ -155,6 +155,12 @@ class Caller:
|
||||
Returns:
|
||||
dict[str, Any]: 函数的json数据
|
||||
"""
|
||||
properties = {key: value.data() for key, value in self._parameters.items()}
|
||||
if not properties:
|
||||
properties["placeholder"] = {
|
||||
"type": "string",
|
||||
"description": "占位符,用于显示在对话框中", # 为保证兼容性而设置的无用参数
|
||||
}
|
||||
return {
|
||||
"type": "function",
|
||||
"function": {
|
||||
@ -162,15 +168,7 @@ class Caller:
|
||||
"description": self._description,
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
**{
|
||||
key: value.data() for key, value in self._parameters.items()
|
||||
},
|
||||
"placeholder": {
|
||||
"type": "string",
|
||||
"description": "占位符,用于显示在对话框中", # 为保证兼容性而设置的无用参数
|
||||
},
|
||||
},
|
||||
"properties": properties,
|
||||
},
|
||||
"required": [
|
||||
key
|
||||
|
Loading…
x
Reference in New Issue
Block a user