TODO: support remote files in the future (http, https, etc)
| 184 | |
| 185 | // TODO: support remote files in the future (http, https, etc) |
| 186 | std::string load_input_file(const std::string & fname, bool is_media) { |
| 187 | std::ifstream file(fname, std::ios::binary); |
| 188 | if (!file) { |
| 189 | return ""; |
| 190 | } |
| 191 | if (is_media) { |
| 192 | raw_buffer buf; |
| 193 | buf.assign((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); |
| 194 | input_files.push_back(std::move(buf)); |
| 195 | return get_media_marker(); |
| 196 | } else { |
| 197 | std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); |
| 198 | return content; |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | common_chat_params format_chat() { |
| 203 | auto meta = ctx_server.get_meta(); |
no test coverage detected