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