refactored

This commit is contained in:
Robert 2024-02-28 18:08:51 +07:00
parent 803aec9a44
commit 12b57c8c0f
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -5,7 +5,11 @@ from pydantic import BaseModel, Field
from typing import Literal, Union, Annotated, Optional, List from typing import Literal, Union, Annotated, Optional, List
class WaitAction(BaseModel): class BaseAction(BaseModel):
action_type: Literal["wait", "comment"]
class WaitAction(BaseAction):
action_type: Literal["wait"] action_type: Literal["wait"]
wait_for: int wait_for: int
@ -13,17 +17,15 @@ class WaitAction(BaseModel):
pass pass
class TextCommentAction(BaseModel): class CommentAction(BaseAction):
action_type: Literal["text_comment"] action_type: Literal["comment"]
text: str text: str
class Config(BaseConfig): class Config(BaseConfig):
pass pass
Action = Annotated[ Action = Annotated[Union[WaitAction, CommentAction], Field(description="action_type")]
Union[WaitAction, TextCommentAction], Field(description="action_type")
]
class Chain(BaseMongoModel): class Chain(BaseMongoModel):