| 93 | } |
| 94 | |
| 95 | static std::vector<float> parse_float_array(const std::string& json, const std::string& key) { |
| 96 | std::string pat = "\"" + key + "\":"; |
| 97 | size_t pos = json.find(pat); |
| 98 | if (pos == std::string::npos) return {}; |
| 99 | size_t s = pos + pat.size(); |
| 100 | while (s < json.size() && json[s] == ' ') s++; |
| 101 | if (s >= json.size() || json[s] != '[') return {}; |
| 102 | int depth = 1; size_t e = s + 1; |
| 103 | while (e < json.size() && depth > 0) { if (json[e] == '[') depth++; else if (json[e] == ']') depth--; e++; } |
| 104 | std::vector<float> r; |
| 105 | std::istringstream iss(json.substr(s + 1, e - s - 2)); |
| 106 | std::string tok; |
| 107 | while (std::getline(iss, tok, ',')) { try { r.push_back(std::stof(tok)); } catch (...) {} } |
| 108 | return r; |
| 109 | } |
| 110 | |
| 111 | static std::string resolve_asset_paths(const std::string& messages) { |
| 112 | if (!g_assets_path) return messages; |
no test coverage detected