Commit
·
aa26750
1
Parent(s):
7b9a08a
models.py
CHANGED
|
@@ -208,6 +208,23 @@ class LLMServiceObj(BaseModel):
|
|
| 208 |
– same JSON/wire names via aliases, no Pydantic forward-ref clash.
|
| 209 |
"""
|
| 210 |
model_config = ConfigDict(populate_by_name=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
# --- core strings ---
|
| 213 |
MessageID: str = Field(default_factory=_nanoid)
|
|
@@ -468,22 +485,7 @@ class LLMServiceObj(BaseModel):
|
|
| 468 |
except Exception:
|
| 469 |
return int(datetime.now(timezone.utc).timestamp())
|
| 470 |
|
| 471 |
-
|
| 472 |
-
# (handy if other code already references those names in Python)
|
| 473 |
-
@property
|
| 474 |
-
def FunctionCallData(self) -> FunctionCallData:
|
| 475 |
-
return self.function_call_data
|
| 476 |
-
@FunctionCallData.setter
|
| 477 |
-
def FunctionCallData(self, v: FunctionCallData) -> None:
|
| 478 |
-
self.function_call_data = v
|
| 479 |
-
|
| 480 |
-
@property
|
| 481 |
-
def UserInfo(self) -> UserInfo:
|
| 482 |
-
return self.user_info
|
| 483 |
-
@UserInfo.setter
|
| 484 |
-
def UserInfo(self, v: UserInfo) -> None:
|
| 485 |
-
self.user_info = v
|
| 486 |
-
|
| 487 |
|
| 488 |
# ---------- ResultObj ----------
|
| 489 |
class ResultObj(BaseModel):
|
|
@@ -491,4 +493,4 @@ class ResultObj(BaseModel):
|
|
| 491 |
Success: bool = False
|
| 492 |
Data: Optional[Any] = None
|
| 493 |
|
| 494 |
-
|
|
|
|
| 208 |
– same JSON/wire names via aliases, no Pydantic forward-ref clash.
|
| 209 |
"""
|
| 210 |
model_config = ConfigDict(populate_by_name=True)
|
| 211 |
+
# ---------------- Convenience accessors (no name shadowing) ----------------
|
| 212 |
+
# Allow llm.FunctionCallData / llm.UserInfo while real fields stay
|
| 213 |
+
# function_call_data / user_info (aliased for JSON).
|
| 214 |
+
|
| 215 |
+
def __getattr__(self, name):
|
| 216 |
+
if name == "FunctionCallData":
|
| 217 |
+
return super().__getattribute__("function_call_data")
|
| 218 |
+
if name == "UserInfo":
|
| 219 |
+
return super().__getattribute__("user_info")
|
| 220 |
+
raise AttributeError(f"{type(self).__name__} has no attribute {name!r}")
|
| 221 |
+
|
| 222 |
+
def __setattr__(self, name, value):
|
| 223 |
+
if name == "FunctionCallData":
|
| 224 |
+
return super().__setattr__("function_call_data", value)
|
| 225 |
+
if name == "UserInfo":
|
| 226 |
+
return super().__setattr__("user_info", value)
|
| 227 |
+
return super().__setattr__(name, value)
|
| 228 |
|
| 229 |
# --- core strings ---
|
| 230 |
MessageID: str = Field(default_factory=_nanoid)
|
|
|
|
| 485 |
except Exception:
|
| 486 |
return int(datetime.now(timezone.utc).timestamp())
|
| 487 |
|
| 488 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
|
| 490 |
# ---------- ResultObj ----------
|
| 491 |
class ResultObj(BaseModel):
|
|
|
|
| 493 |
Success: bool = False
|
| 494 |
Data: Optional[Any] = None
|
| 495 |
|
| 496 |
+
|