This commit is contained in:
yzlin 2024-01-22 13:57:52 +08:00
parent 540542834e
commit 0f245f530e
2 changed files with 2 additions and 3 deletions

View file

@ -44,7 +44,7 @@ def docstring_to_schema(docstring: str):
# variable_pattern = re.compile(r"(\w+)\s*\((.*?)\):\s*(.*)")
variable_pattern = re.compile(
r"(\w+)\s*\((.*?)\):\s*(.*?)(?=\n\s*\w+\s*\(|\Z)", re.DOTALL
) # (?=\n\w+\s*\(|\Z) isb to assert that what follows is either the start of the next parameter (indicated by a newline, some word characters, and an opening parenthesis) or the end of the string (\Z).
) # (?=\n\w+\s*\(|\Z) is to assert that what follows is either the start of the next parameter (indicated by a newline, some word characters, and an opening parenthesis) or the end of the string (\Z).
params = variable_pattern.findall(_args)
parameter_schema = {"properties": {}, "required": []}

View file

@ -137,8 +137,7 @@ def make_schema(tool_source_object, include, path):
logger.info(f"schema made at {path}")
except Exception as e:
schema = {}
logger.error("Fail to make schema")
print(e)
logger.error(f"Fail to make schema: {e}")
return schema