| 106 | } |
| 107 | |
| 108 | void LLMClientInterface::sendData(const QByteArray &data) |
| 109 | { |
| 110 | QJsonDocument doc = QJsonDocument::fromJson(data); |
| 111 | if (!doc.isObject()) |
| 112 | return; |
| 113 | |
| 114 | QJsonObject request = doc.object(); |
| 115 | QString method = request["method"].toString(); |
| 116 | |
| 117 | if (method == "initialize") { |
| 118 | handleInitialize(request); |
| 119 | } else if (method == "initialized") { |
| 120 | // TODO make initilizied handler |
| 121 | } else if (method == "shutdown") { |
| 122 | handleShutdown(request); |
| 123 | } else if (method == "textDocument/didOpen") { |
| 124 | handleTextDocumentDidOpen(request); |
| 125 | } else if (method == "getCompletionsCycling") { |
| 126 | handleCompletion(request); |
| 127 | } else if (method == "$/cancelRequest") { |
| 128 | handleCancelRequest(); |
| 129 | } else if (method == "exit") { |
| 130 | // TODO make exit handler |
| 131 | } else { |
| 132 | LOG_MESSAGE(QString("Unknown method: %1").arg(method)); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | void LLMClientInterface::handleCancelRequest() |
| 137 | { |