Refactor form update handling in API endpoints and models
- Introduced a new function to parse JSON values in endpoints.py for improved data handling. - Updated extract_form_update_from_flow_nodes to return structured data instead of strings. - Changed formUpdate field in ProcessResponse_chat model to use Any type with a default empty dictionary for better flexibility in handling updates.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
class ProcessRequest_chat(BaseModel):
|
||||
sessionId: str = Field(..., max_length=64)
|
||||
@@ -11,7 +11,7 @@ class ProcessResponse_chat(BaseModel):
|
||||
sessionId: str = Field(..., max_length=64)
|
||||
timeStamp: str = Field(..., max_length=32)
|
||||
outputText: str = Field(...)
|
||||
formUpdate: str = Field(default="")
|
||||
formUpdate: Any = Field(default_factory=dict)
|
||||
nextStage: str = Field(..., max_length=32)
|
||||
nextStageCode: str = Field(..., max_length=4)
|
||||
code: str = Field(..., max_length=4)
|
||||
|
||||
Reference in New Issue
Block a user