From c92ccb55433c74fa52d5f88ea20ebb4d99666fab Mon Sep 17 00:00:00 2001 From: Stan Girard Date: Tue, 16 Apr 2024 00:29:37 -0700 Subject: [PATCH] feat(assistants): Add new input models for boolean, number, select text, and select number (#2432) This pull request adds new input models for boolean, number, select text, and select number. These models will allow for more flexible and dynamic input options in the software. The changes include the addition of the `InputBoolean`, `InputNumber`, `InputSelectText`, and `InputSelectNumber` classes to the `Inputs` model. These classes provide properties for key, required, description, and additional options specific to each input type. This enhancement will improve the overall functionality and user experience of the software. ---- | Ellipsis | :rocket: This PR description was created by [Ellipsis](https://www.ellipsis.dev) for commit 6fa583b6a86dfc9a45a9ced826a339be19b5c9df. | |--------|--------| ### Summary: This PR enhances the `Inputs` model by adding new input models for boolean, number, select text, and select number, improving the software's functionality and user experience. **Key points**: - Added `InputBoolean`, `InputNumber`, `InputSelectText`, and `InputSelectNumber` classes to `Inputs` model in `inputs.py` and `outputs.py`. - Each new class provides properties for key, required, description, and additional options specific to each input type. ---- Generated with :heart: by [ellipsis.dev](https://www.ellipsis.dev) --- backend/modules/assistant/dto/inputs.py | 24 +++++++++++++++ backend/modules/assistant/dto/outputs.py | 37 ++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/backend/modules/assistant/dto/inputs.py b/backend/modules/assistant/dto/inputs.py index 512b870b5..cb77e2229 100644 --- a/backend/modules/assistant/dto/inputs.py +++ b/backend/modules/assistant/dto/inputs.py @@ -29,10 +29,34 @@ class TextInput(BaseModel): value: str +class InputBoolean(BaseModel): + key: str + value: bool + + +class InputNumber(BaseModel): + key: str + value: int + + +class InputSelectText(BaseModel): + key: str + value: str + + +class InputSelectNumber(BaseModel): + key: str + value: int + + class Inputs(BaseModel): files: Optional[List[FileInput]] = None urls: Optional[List[UrlInput]] = None texts: Optional[List[TextInput]] = None + booleans: Optional[List[InputBoolean]] = None + numbers: Optional[List[InputNumber]] = None + select_texts: Optional[List[InputSelectText]] = None + select_numbers: Optional[List[InputSelectNumber]] = None class Outputs(BaseModel): diff --git a/backend/modules/assistant/dto/outputs.py b/backend/modules/assistant/dto/outputs.py index a13af7370..3254e030b 100644 --- a/backend/modules/assistant/dto/outputs.py +++ b/backend/modules/assistant/dto/outputs.py @@ -20,12 +20,49 @@ class InputText(BaseModel): key: str required: Optional[bool] = True description: str + validation_regex: Optional[str] = None + + +class InputBoolean(BaseModel): + key: str + required: Optional[bool] = True + description: str + + +class InputNumber(BaseModel): + key: str + required: Optional[bool] = True + description: str + min: Optional[int] = None + max: Optional[int] = None + increment: Optional[int] = None + default: Optional[int] = None + + +class InputSelectText(BaseModel): + key: str + required: Optional[bool] = True + description: str + options: List[str] + default: Optional[str] = None + + +class InputSelectNumber(BaseModel): + key: str + required: Optional[bool] = True + description: str + options: List[int] + default: Optional[int] = None class Inputs(BaseModel): files: Optional[List[InputFile]] = None urls: Optional[List[InputUrl]] = None texts: Optional[List[InputText]] = None + booleans: Optional[List[InputBoolean]] = None + numbers: Optional[List[InputNumber]] = None + select_texts: Optional[List[InputSelectText]] = None + select_numbers: Optional[List[InputSelectNumber]] = None class OutputEmail(BaseModel):