diff --git a/backend/README.md b/backend/README.md index 45d16d68..863090f7 100644 --- a/backend/README.md +++ b/backend/README.md @@ -11,10 +11,12 @@ Example contents of a `.env` file for the backend: ``` DATABASE_URI="postgresql://:@/" BACKEND_CORS_ORIGINS=["http://localhost", "http://localhost:4200", "http://localhost:3000", "http://localhost:8080", "https://localhost", "https://localhost:4200", "https://localhost:3000", "https://localhost:8080", "http://dev.oasst.laion.ai", "https://stag.oasst.laion.ai", "https://oasst.laion.ai"] - +REDIS_HOST=localhost +REDIS_PORT=6379 ``` ## Running the REST Server locally for development Have a look into the main `README.md` file for more information on how to set up -the backend for development. +the backend for development. Use the scripts within the +scripts/backend-development folder to run the BE API locally. diff --git a/oasst-shared/oasst_shared/schemas/protocol.py b/oasst-shared/oasst_shared/schemas/protocol.py index 83375d8f..e035d387 100644 --- a/oasst-shared/oasst_shared/schemas/protocol.py +++ b/oasst-shared/oasst_shared/schemas/protocol.py @@ -5,7 +5,7 @@ from uuid import UUID, uuid4 import pydantic from oasst_shared.exceptions import OasstErrorCode -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, conint, conlist, constr class TaskRequestType(str, enum.Enum): @@ -203,7 +203,7 @@ class TextReplyToMessage(Interaction): type: Literal["text_reply_to_message"] = "text_reply_to_message" message_id: str user_message_id: str - text: str + text: constr(min_length=1, strip_whitespace=True) class MessageRating(Interaction): @@ -211,7 +211,7 @@ class MessageRating(Interaction): type: Literal["message_rating"] = "message_rating" message_id: str - rating: int + rating: conint(gt=0) class MessageRanking(Interaction): @@ -219,7 +219,7 @@ class MessageRanking(Interaction): type: Literal["message_ranking"] = "message_ranking" message_id: str - ranking: list[int] + ranking: conlist(item_type=int, min_items=1) AnyInteraction = Union[