mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-08-11 11:13:12 +08:00
* Added pydantic checks for interaction protocols * Small updated to BE API README for redis and guide to local scripts * isort linting
This commit is contained in:
+4
-2
@@ -11,10 +11,12 @@ Example contents of a `.env` file for the backend:
|
||||
```
|
||||
DATABASE_URI="postgresql://<username>:<password>@<host>/<database_name>"
|
||||
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.
|
||||
|
||||
@@ -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[
|
||||
|
||||
Reference in New Issue
Block a user