mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-11-04 09:32:00 +00:00 
			
		
		
		
	server : indentation
This commit is contained in:
		@@ -2678,38 +2678,38 @@ int main(int argc, char **argv)
 | 
				
			|||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    const auto chunked_content_provider = [task_id, &llama](size_t, httplib::DataSink &sink) {
 | 
					                    const auto chunked_content_provider = [task_id, &llama](size_t, httplib::DataSink &sink) {
 | 
				
			||||||
                        while (true) {
 | 
					                        while (true) {
 | 
				
			||||||
                        task_result llama_result = llama.next_result(task_id);
 | 
					                            task_result llama_result = llama.next_result(task_id);
 | 
				
			||||||
                        if (!llama_result.error) {
 | 
					                            if (!llama_result.error) {
 | 
				
			||||||
                            std::vector<json> result_array = format_partial_response_oaicompat( llama_result);
 | 
					                                std::vector<json> result_array = format_partial_response_oaicompat( llama_result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            for (auto it = result_array.begin(); it != result_array.end(); ++it)
 | 
					                                for (auto it = result_array.begin(); it != result_array.end(); ++it)
 | 
				
			||||||
                            {
 | 
					                                {
 | 
				
			||||||
                                if (!it->empty()) {
 | 
					                                    if (!it->empty()) {
 | 
				
			||||||
                                    const std::string str =
 | 
					                                        const std::string str =
 | 
				
			||||||
                                        "data: " +
 | 
					                                            "data: " +
 | 
				
			||||||
                                        it->dump(-1, ' ', false, json::error_handler_t::replace) +
 | 
					                                            it->dump(-1, ' ', false, json::error_handler_t::replace) +
 | 
				
			||||||
                                        "\n\n";
 | 
					                                            "\n\n";
 | 
				
			||||||
                                    LOG_VERBOSE("data stream", {{"to_send", str}});
 | 
					                                        LOG_VERBOSE("data stream", {{"to_send", str}});
 | 
				
			||||||
                                    if (!sink.write(str.c_str(), str.size())) {
 | 
					                                        if (!sink.write(str.c_str(), str.size())) {
 | 
				
			||||||
                                        return false;
 | 
					                                            return false;
 | 
				
			||||||
 | 
					                                        }
 | 
				
			||||||
                                    }
 | 
					                                    }
 | 
				
			||||||
                                }
 | 
					                                }
 | 
				
			||||||
                            }
 | 
					                                if (llama_result.stop) {
 | 
				
			||||||
                            if (llama_result.stop) {
 | 
					                                    break;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            } else {
 | 
				
			||||||
 | 
					                                const std::string str =
 | 
				
			||||||
 | 
					                                    "error: " +
 | 
				
			||||||
 | 
					                                    llama_result.result_json.dump(-1, ' ', false,
 | 
				
			||||||
 | 
					                                            json::error_handler_t::replace) +
 | 
				
			||||||
 | 
					                                    "\n\n";
 | 
				
			||||||
 | 
					                                LOG_VERBOSE("data stream", {{"to_send", str}});
 | 
				
			||||||
 | 
					                                if (!sink.write(str.c_str(), str.size())) {
 | 
				
			||||||
 | 
					                                    return false;
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
                                break;
 | 
					                                break;
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            const std::string str =
 | 
					 | 
				
			||||||
                                "error: " +
 | 
					 | 
				
			||||||
                                llama_result.result_json.dump(-1, ' ', false,
 | 
					 | 
				
			||||||
                                                            json::error_handler_t::replace) +
 | 
					 | 
				
			||||||
                                "\n\n";
 | 
					 | 
				
			||||||
                            LOG_VERBOSE("data stream", {{"to_send", str}});
 | 
					 | 
				
			||||||
                            if (!sink.write(str.c_str(), str.size())) {
 | 
					 | 
				
			||||||
                                return false;
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                            break;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        sink.done();
 | 
					                        sink.done();
 | 
				
			||||||
                        return true;
 | 
					                        return true;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user