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:
Xin Wang
2026-06-17 13:29:50 +08:00
parent ffd3bf0385
commit 6ff23e433b
2 changed files with 28 additions and 14 deletions

View File

@@ -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)