2024-04-11 19:31:16 +03:00
|
|
|
import json
|
|
|
|
from typing import List, Optional
|
2024-04-10 14:28:22 +03:00
|
|
|
from uuid import UUID
|
|
|
|
|
2024-04-19 00:03:47 +03:00
|
|
|
from pydantic import BaseModel, model_validator, root_validator
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class EmailInput(BaseModel):
|
|
|
|
activated: bool
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class BrainInput(BaseModel):
|
2024-04-19 00:03:47 +03:00
|
|
|
activated: Optional[bool] = False
|
|
|
|
value: Optional[UUID] = None
|
|
|
|
|
|
|
|
@root_validator(pre=True)
|
|
|
|
def empty_string_to_none(cls, values):
|
|
|
|
for field, value in values.items():
|
|
|
|
if value == "":
|
|
|
|
values[field] = None
|
|
|
|
return values
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class FileInput(BaseModel):
|
|
|
|
key: str
|
|
|
|
value: str
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class UrlInput(BaseModel):
|
|
|
|
key: str
|
|
|
|
value: str
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class TextInput(BaseModel):
|
|
|
|
key: str
|
|
|
|
value: str
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
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_HIDDEN
-->
----
| <a href="https://ellipsis.dev" target="_blank"><img
src="https://avatars.githubusercontent.com/u/80834858?s=400&u=31e596315b0d8f7465b3ee670f25cea677299c96&v=4"
alt="Ellipsis" width="30px" height="30px"/></a> | :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)
<!--
ELLIPSIS_HIDDEN
-->
2024-04-16 10:29:37 +03:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class Inputs(BaseModel):
|
|
|
|
files: Optional[List[FileInput]] = None
|
|
|
|
urls: Optional[List[UrlInput]] = None
|
|
|
|
texts: Optional[List[TextInput]] = None
|
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_HIDDEN
-->
----
| <a href="https://ellipsis.dev" target="_blank"><img
src="https://avatars.githubusercontent.com/u/80834858?s=400&u=31e596315b0d8f7465b3ee670f25cea677299c96&v=4"
alt="Ellipsis" width="30px" height="30px"/></a> | :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)
<!--
ELLIPSIS_HIDDEN
-->
2024-04-16 10:29:37 +03:00
|
|
|
booleans: Optional[List[InputBoolean]] = None
|
|
|
|
numbers: Optional[List[InputNumber]] = None
|
|
|
|
select_texts: Optional[List[InputSelectText]] = None
|
|
|
|
select_numbers: Optional[List[InputSelectNumber]] = None
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
class Outputs(BaseModel):
|
2024-04-11 19:31:16 +03:00
|
|
|
email: Optional[EmailInput] = None
|
|
|
|
brain: Optional[BrainInput] = None
|
2024-04-10 14:28:22 +03:00
|
|
|
|
|
|
|
|
2024-04-11 19:31:16 +03:00
|
|
|
class InputAssistant(BaseModel):
|
2024-04-10 14:28:22 +03:00
|
|
|
name: str
|
|
|
|
inputs: Inputs
|
|
|
|
outputs: Outputs
|
2024-04-11 19:31:16 +03:00
|
|
|
|
|
|
|
@model_validator(mode="before")
|
|
|
|
@classmethod
|
|
|
|
def to_py_dict(cls, data):
|
|
|
|
return json.loads(data)
|