| 64 | } |
| 65 | |
| 66 | std::string read_json_text_batch_file(const std::filesystem::path & path) { |
| 67 | const auto root = engine::io::json::parse_file(path); |
| 68 | if (root.is_string()) { |
| 69 | return normalize_text_as_paragraph(root.as_string()); |
| 70 | } |
| 71 | if (root.is_object()) { |
| 72 | if (const auto * input = root.find("input"); input != nullptr && input->is_string()) { |
| 73 | return normalize_text_as_paragraph(input->as_string()); |
| 74 | } |
| 75 | if (const auto * text = root.find("text"); text != nullptr && text->is_string()) { |
| 76 | return normalize_text_as_paragraph(text->as_string()); |
| 77 | } |
| 78 | } |
| 79 | throw std::runtime_error("--batch-text-dir JSON file requires a string root, input, or text: " + path.string()); |
| 80 | } |
| 81 | |
| 82 | struct TextBatchFileFormat { |
| 83 | const char * extension; |
nothing calls this directly
no test coverage detected