Skip to content
Snippets Groups Projects
Commit c7e46961 authored by leehuwuj's avatar leehuwuj
Browse files

fix annotation message

parent d09ae65d
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,13 @@ class Annotation(BaseModel): ...@@ -103,7 +103,13 @@ class Annotation(BaseModel):
class Message(BaseModel): class Message(BaseModel):
role: MessageRole role: MessageRole
content: str content: str
annotations: List[Annotation] | None = None annotations: Optional[List[Annotation]] = None
@validator("annotations", pre=True)
def validate_annotations(cls, v):
if v is None:
return v
return [item for item in v if isinstance(item, Annotation)]
class ChatData(BaseModel): class ChatData(BaseModel):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment