feat: Update CMake presets and agent configuration for improved build options and interactive chat session experience

This commit is contained in:
scawful
2025-10-04 01:04:24 -04:00
parent 2ea811eeb2
commit 83f6f50326
4 changed files with 67 additions and 19 deletions

View File

@@ -4,6 +4,14 @@
#include <iostream>
#include <iomanip>
#ifdef _WIN32
#include <io.h>
#define isatty _isatty
#define fileno _fileno
#else
#include <unistd.h>
#endif
#include "absl/strings/str_format.h"
#include "absl/time/time.h"
@@ -90,15 +98,30 @@ absl::Status SimpleChatSession::SendAndWaitForResponse(
}
absl::Status SimpleChatSession::RunInteractive() {
std::cout << "Z3ED Agent Chat (Simple Mode)\n";
std::cout << "Type 'quit' or 'exit' to end the session.\n";
std::cout << "Type 'reset' to clear conversation history.\n";
std::cout << "----------------------------------------\n\n";
// Check if stdin is a TTY (interactive) or a pipe/file
bool is_interactive = isatty(fileno(stdin));
if (is_interactive) {
std::cout << "Z3ED Agent Chat (Simple Mode)\n";
std::cout << "Type 'quit' or 'exit' to end the session.\n";
std::cout << "Type 'reset' to clear conversation history.\n";
std::cout << "----------------------------------------\n\n";
}
std::string input;
while (true) {
std::cout << "You: ";
std::getline(std::cin, input);
if (is_interactive) {
std::cout << "You: ";
std::cout.flush(); // Ensure prompt is displayed before reading
}
if (!std::getline(std::cin, input)) {
// EOF reached (piped input exhausted or Ctrl+D)
if (is_interactive) {
std::cout << "\n";
}
break;
}
if (input.empty()) continue;
if (input == "quit" || input == "exit") break;