add option to resend last input

This commit is contained in:
Georgi Gerganov
2019-08-10 11:33:56 +03:00
parent 44abc6cfd7
commit d831945bb2

View File

@@ -994,12 +994,19 @@ int main(int argc, char** argv) {
}; };
printf("\n"); printf("\n");
std::thread inputThread([]() { std::thread inputThread([]() {
std::string inputOld = "";
while (true) { while (true) {
std::string input; std::string input;
std::cout << "Enter text: "; std::cout << "Enter text: ";
getline(std::cin, input); getline(std::cin, input);
if (input.empty()) {
std::cout << "Re-sending ... " << std::endl;
input = inputOld;
} else {
std::cout << "Sending ... " << std::endl;
}
setText(input.size(), input.data()); setText(input.size(), input.data());
std::cout << "Sending ... " << std::endl; inputOld = input;
} }
}); });