Commit
·
4cb71cc
1
Parent(s):
bbfbcdd
models.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
from typing import Any, Optional, List
|
| 4 |
from datetime import datetime, timezone
|
| 5 |
from pydantic import BaseModel, Field, ConfigDict
|
| 6 |
|
| 7 |
|
| 8 |
-
# ---------- CloudEvent (Pydantic v2
|
| 9 |
class CloudEvent(BaseModel):
|
| 10 |
specversion: str = "1.0"
|
| 11 |
id: str
|
|
@@ -30,7 +29,15 @@ class CloudEvent(BaseModel):
|
|
| 30 |
)
|
| 31 |
|
| 32 |
|
| 33 |
-
# ----------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
class FunctionState(BaseModel):
|
| 35 |
IsFunctionCall: bool = False
|
| 36 |
IsFunctionCallResponse: bool = False
|
|
@@ -39,13 +46,35 @@ class FunctionState(BaseModel):
|
|
| 39 |
IsFunctionStillRunning: bool = False
|
| 40 |
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
-
model_config = ConfigDict(extra="allow")
|
| 49 |
|
| 50 |
|
| 51 |
# ---------- LLMServiceObj (field names match C# exactly) ----------
|
|
@@ -90,7 +119,7 @@ class LLMServiceObj(BaseModel):
|
|
| 90 |
IsProcessedStack: List[bool] = Field(default_factory=list)
|
| 91 |
MessageIDStack: List[str] = Field(default_factory=list)
|
| 92 |
|
| 93 |
-
# function state flags (
|
| 94 |
IsFunctionCall: bool = False
|
| 95 |
IsFunctionCallResponse: bool = False
|
| 96 |
IsFunctionCallError: bool = False
|
|
@@ -98,7 +127,7 @@ class LLMServiceObj(BaseModel):
|
|
| 98 |
IsFunctionStillRunning: bool = False
|
| 99 |
|
| 100 |
|
| 101 |
-
# ---------- ResultObj ----------
|
| 102 |
class ResultObj(BaseModel):
|
| 103 |
Message: str = ""
|
| 104 |
Success: bool = False
|
|
|
|
| 1 |
+
# models.py
|
| 2 |
+
from typing import Any, Optional, List, Dict
|
|
|
|
| 3 |
from datetime import datetime, timezone
|
| 4 |
from pydantic import BaseModel, Field, ConfigDict
|
| 5 |
|
| 6 |
|
| 7 |
+
# ---------- CloudEvent (Pydantic v2) ----------
|
| 8 |
class CloudEvent(BaseModel):
|
| 9 |
specversion: str = "1.0"
|
| 10 |
id: str
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
|
| 32 |
+
# ---------- FunctionCallData (from your C#) ----------
|
| 33 |
+
class FunctionCallData(BaseModel):
|
| 34 |
+
function: Optional[str] = None
|
| 35 |
+
name: Optional[str] = None
|
| 36 |
+
arguments: Optional[Dict[str, Any]] = None
|
| 37 |
+
parameters: Optional[Dict[str, Any]] = None
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# ---------- FunctionState (from your C#) ----------
|
| 41 |
class FunctionState(BaseModel):
|
| 42 |
IsFunctionCall: bool = False
|
| 43 |
IsFunctionCallResponse: bool = False
|
|
|
|
| 46 |
IsFunctionStillRunning: bool = False
|
| 47 |
|
| 48 |
|
| 49 |
+
# ---------- UserInfo (from your C#; omitting JsonIgnored/NotMapped collections) ----------
|
| 50 |
+
class UserInfo(BaseModel):
|
| 51 |
+
UserID: Optional[str] = None
|
| 52 |
+
DateCreated: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
| 53 |
+
HostLimit: int = 0
|
| 54 |
+
DisableEmail: bool = False
|
| 55 |
+
Status: Optional[str] = ""
|
| 56 |
+
Name: Optional[str] = ""
|
| 57 |
+
Given_name: Optional[str] = ""
|
| 58 |
+
Family_name: Optional[str] = ""
|
| 59 |
+
Nickname: Optional[str] = ""
|
| 60 |
+
Sub: Optional[str] = ""
|
| 61 |
+
Enabled: bool = True
|
| 62 |
+
MonitorAlertEnabled: bool = True
|
| 63 |
+
PredictAlertEnabled: bool = False
|
| 64 |
+
AccountType: Optional[str] = "Default"
|
| 65 |
+
Email: Optional[str] = ""
|
| 66 |
+
Email_verified: bool = False
|
| 67 |
+
Picture: Optional[str] = ""
|
| 68 |
+
Updated_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
| 69 |
+
LastLoginDate: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
|
| 70 |
+
CustomerId: Optional[str] = ""
|
| 71 |
+
CancelAt: Optional[datetime] = None
|
| 72 |
+
TokensUsed: int = 0
|
| 73 |
|
| 74 |
+
# NotMapped in C#: model as loose dict so it round-trips safely
|
| 75 |
+
LoadServer: Dict[str, Any] = Field(default_factory=dict)
|
| 76 |
|
| 77 |
+
# JsonIgnore MonitorIPs in C#: we do not include it here
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
# ---------- LLMServiceObj (field names match C# exactly) ----------
|
|
|
|
| 119 |
IsProcessedStack: List[bool] = Field(default_factory=list)
|
| 120 |
MessageIDStack: List[str] = Field(default_factory=list)
|
| 121 |
|
| 122 |
+
# function state flags (C# stores in FunctionState; we expose flat flags like your class does)
|
| 123 |
IsFunctionCall: bool = False
|
| 124 |
IsFunctionCallResponse: bool = False
|
| 125 |
IsFunctionCallError: bool = False
|
|
|
|
| 127 |
IsFunctionStillRunning: bool = False
|
| 128 |
|
| 129 |
|
| 130 |
+
# ---------- ResultObj (from your C#) ----------
|
| 131 |
class ResultObj(BaseModel):
|
| 132 |
Message: str = ""
|
| 133 |
Success: bool = False
|