MCPcopy Create free account
hub / github.com/78/tenbox / HandleClient

Method HandleClient

src/daemon/llm_proxy.cpp:433–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433void LlmProxyService::HandleClient(int client_fd) {
434 pthread_setname_np(pthread_self(), "llm-handler");
435 bool keep_alive = true;
436 while (keep_alive && running_.load()) {
437 std::string method;
438 std::string path;
439 std::string body;
440 if (!ParseHttpRequest(client_fd, method, path, body, keep_alive)) break;
441
442 if (method == "POST" && (path == "/v1/chat/completions" ||
443 path == "/chat/completions")) {
444 HandleChatCompletions(client_fd, body, keep_alive);
445 } else if (method == "GET" && (path == "/v1/models" || path == "/models")) {
446 HandleModels(client_fd, keep_alive);
447 } else {
448 SendErrorResponse(client_fd, 404, "Not Found",
449 "Unknown endpoint: " + path, keep_alive);
450 }
451 }
452 ::close(client_fd);
453}
454
455bool LlmProxyService::ParseHttpRequest(int client_fd, std::string& method,
456 std::string& path, std::string& body,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected