| 39 | } |
| 40 | |
| 41 | AGenUIExeCode AGenUIMessageParser::parseUpdateComponentsData(const std::string& jsonData, std::string& outSurfaceId, nlohmann::json& outComponentsJson) { |
| 42 | try { |
| 43 | auto json = nlohmann::json::parse(jsonData); |
| 44 | if (!json.contains("updateComponents")) { |
| 45 | AGENUI_LOG("missing updateComponents field"); |
| 46 | return UpdateComponents_MissingKeyword; |
| 47 | } |
| 48 | |
| 49 | auto updateComponentsJson = json["updateComponents"]; |
| 50 | if (!updateComponentsJson.contains("surfaceId")) { |
| 51 | AGENUI_LOG("missing surfaceId"); |
| 52 | return UpdateComponents_MissingSurfaceId; |
| 53 | } |
| 54 | outSurfaceId = updateComponentsJson["surfaceId"].get<std::string>(); |
| 55 | if (outSurfaceId.empty()) { |
| 56 | return UpdateComponents_EmptySurfaceId; |
| 57 | } |
| 58 | outComponentsJson = updateComponentsJson; |
| 59 | } catch (const nlohmann::json::exception& e) { |
| 60 | return UpdateComponents_JsonError; |
| 61 | } |
| 62 | return Execute_Success; |
| 63 | } |
| 64 | |
| 65 | AGenUIExeCode AGenUIMessageParser::parseUpdateDataModelData(const std::string& jsonData, std::string& outSurfaceId, nlohmann::json& outDataModelJson) { |
| 66 | try { |