返回提交历史
Modified
g4f/client/stubs.py
+5
-2
XFEstudio/gpt4free
fix: serialize None as empty string
bb205066
代码差异
1 个文件
+5
-2
@@ -185,14 +185,17 @@ class ChatCompletion(BaseModel):
185
185
186
186
class ChatCompletionDelta(BaseModel):
187
187
role: str
188
content: str
188
content: Optional[str]
189
189
190
190
@classmethod
191
191
def model_construct(cls, content: Optional[str]):
192
192
return super().model_construct(role="assistant", content=content)
193
193
194
194
@field_serializer('content')
195
def serialize_content(self, content: str):
195
def serialize_content(self, content: Optional[str]):
196
if content is None:
197
return ""
198
196
199
return str(content)
197
200
198
201
class ChatCompletionDeltaChoice(BaseModel):