MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / read_json_text_batch_file

Function read_json_text_batch_file

app/cli/batch.cpp:66–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66std::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
82struct TextBatchFileFormat {
83 const char * extension;

Callers

nothing calls this directly

Calls 5

parse_fileFunction · 0.85
is_stringMethod · 0.80
is_objectMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected