Spaces:
Sleeping
Sleeping
Update models.py
Browse files
models.py
CHANGED
@@ -1,10 +1,16 @@
|
|
1 |
-
from pydantic import BaseModel
|
2 |
from typing import List, Optional
|
3 |
|
4 |
-
# === Trainer Models ===
|
5 |
class InitializeBotResponse(BaseModel):
|
6 |
bot_id: str
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
class DocumentPath(BaseModel):
|
9 |
bot_id: str
|
10 |
data_path: str
|
@@ -16,59 +22,8 @@ class QueryRequest(BaseModel):
|
|
16 |
bot_id: str
|
17 |
chat_id: str
|
18 |
query: str
|
|
|
19 |
|
20 |
class QueryResponse(BaseModel):
|
21 |
response: str
|
22 |
web_sources: List[str]
|
23 |
-
|
24 |
-
# === Authentication Models ===
|
25 |
-
class User(BaseModel):
|
26 |
-
name: str = Field(..., min_length=3, max_length=50)
|
27 |
-
email: EmailStr
|
28 |
-
password: str
|
29 |
-
|
30 |
-
@validator("password")
|
31 |
-
def validate_password(cls, value):
|
32 |
-
if len(value) < 8:
|
33 |
-
raise ValueError("Password must be at least 8 characters long.")
|
34 |
-
if not any(char.isdigit() for char in value):
|
35 |
-
raise ValueError("Password must include at least one number.")
|
36 |
-
if not any(char.isupper() for char in value):
|
37 |
-
raise ValueError("Password must include at least one uppercase letter.")
|
38 |
-
if not any(char.islower() for char in value):
|
39 |
-
raise ValueError("Password must include at least one lowercase letter.")
|
40 |
-
if not any(char in "!@#$%^&*()-_+=<>?/" for char in value):
|
41 |
-
raise ValueError("Password must include at least one special character.")
|
42 |
-
return value
|
43 |
-
|
44 |
-
class UserUpdate(BaseModel):
|
45 |
-
name: Optional[str] = Field(None, min_length=3, max_length=50)
|
46 |
-
email: Optional[EmailStr]
|
47 |
-
password: Optional[str]
|
48 |
-
|
49 |
-
@validator("password")
|
50 |
-
def validate_password(cls, value):
|
51 |
-
if value is not None:
|
52 |
-
if len(value) < 8:
|
53 |
-
raise ValueError("Password must be at least 8 characters long.")
|
54 |
-
if not any(char.isdigit() for char in value):
|
55 |
-
raise ValueError("Password must include at least one number.")
|
56 |
-
if not any(char.isupper() for char in value):
|
57 |
-
raise ValueError("Password must include at least one uppercase letter.")
|
58 |
-
if not any(char.islower() for char in value):
|
59 |
-
raise ValueError("Password must include at least one lowercase letter.")
|
60 |
-
if not any(char in "!@#$%^&*()-_+=<>?/" for char in value):
|
61 |
-
raise ValueError("Password must include at least one special character.")
|
62 |
-
return value
|
63 |
-
|
64 |
-
class Token(BaseModel):
|
65 |
-
access_token: str
|
66 |
-
refresh_token: str
|
67 |
-
token_type: str
|
68 |
-
|
69 |
-
class LoginResponse(Token):
|
70 |
-
name: str
|
71 |
-
avatar: Optional[str] = None
|
72 |
-
|
73 |
-
class TokenData(BaseModel):
|
74 |
-
email: Optional[str] = None
|
|
|
1 |
+
from pydantic import BaseModel
|
2 |
from typing import List, Optional
|
3 |
|
|
|
4 |
class InitializeBotResponse(BaseModel):
|
5 |
bot_id: str
|
6 |
|
7 |
+
class CreateBotRequest(BaseModel):
|
8 |
+
bot_id: str
|
9 |
+
prompt_type: str
|
10 |
+
|
11 |
+
class CreateBotResponse(BaseModel):
|
12 |
+
bot_id: str
|
13 |
+
|
14 |
class DocumentPath(BaseModel):
|
15 |
bot_id: str
|
16 |
data_path: str
|
|
|
22 |
bot_id: str
|
23 |
chat_id: str
|
24 |
query: str
|
25 |
+
prompt_type: str # Added to allow dynamic prompt selection
|
26 |
|
27 |
class QueryResponse(BaseModel):
|
28 |
response: str
|
29 |
web_sources: List[str]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|