fix: 修复了在else语句中调用'schema_str'之前未定义的问题 (#1719)

重新排列了方法中的条件返回语句,以确保在使用之前始终定义了'schema_str'。
这个提交包含在:
owo
2024-04-18 16:26:13 +08:00
提交者 GitHub
父节点 5c5f442649
当前提交 f0e15bd710

查看文件

@@ -62,8 +62,8 @@ class GptJsonIO():
if "type" in reduced_schema:
del reduced_schema["type"]
# Ensure json in context is well-formed with double quotes.
if self.example_instruction:
schema_str = json.dumps(reduced_schema)
if self.example_instruction:
return PYDANTIC_FORMAT_INSTRUCTIONS.format(schema=schema_str)
else:
return PYDANTIC_FORMAT_INSTRUCTIONS_SIMPLE.format(schema=schema_str)