mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-29 08:41:22 +00:00 
			
		
		
		
	server : add VSCode's Github Copilot Chat support (#12896)
* server : add VSCode's Github Copilot Chat support * cont : update handler name
This commit is contained in:
		| @@ -3907,6 +3907,21 @@ int main(int argc, char ** argv) { | |||||||
|         res_ok(res, {{ "success", true }}); |         res_ok(res, {{ "success", true }}); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  |     const auto handle_api_show = [&ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) { | ||||||
|  |         json data = { | ||||||
|  |             { | ||||||
|  |                 "template", common_chat_templates_source(ctx_server.chat_templates.get()), | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "model_info", { | ||||||
|  |                     { "llama.context_length", ctx_server.slots.back().n_ctx, }, | ||||||
|  |                 } | ||||||
|  |             }, | ||||||
|  |         }; | ||||||
|  |  | ||||||
|  |         res_ok(res, data); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|     // handle completion-like requests (completion, chat, infill) |     // handle completion-like requests (completion, chat, infill) | ||||||
|     // we can optionally provide a custom format for partial results and final results |     // we can optionally provide a custom format for partial results and final results | ||||||
|     const auto handle_completions_impl = [&ctx_server, &res_error, &res_ok]( |     const auto handle_completions_impl = [&ctx_server, &res_error, &res_ok]( | ||||||
| @@ -4471,6 +4486,7 @@ int main(int argc, char ** argv) { | |||||||
|     svr->Get ("/metrics",             handle_metrics); |     svr->Get ("/metrics",             handle_metrics); | ||||||
|     svr->Get ("/props",               handle_props); |     svr->Get ("/props",               handle_props); | ||||||
|     svr->Post("/props",               handle_props_change); |     svr->Post("/props",               handle_props_change); | ||||||
|  |     svr->Post("/api/show",            handle_api_show); | ||||||
|     svr->Get ("/models",              handle_models); // public endpoint (no API key check) |     svr->Get ("/models",              handle_models); // public endpoint (no API key check) | ||||||
|     svr->Get ("/v1/models",           handle_models); // public endpoint (no API key check) |     svr->Get ("/v1/models",           handle_models); // public endpoint (no API key check) | ||||||
|     svr->Post("/completion",          handle_completions); // legacy |     svr->Post("/completion",          handle_completions); // legacy | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Georgi Gerganov
					Georgi Gerganov