Make the pretty print output more similar for each role
This commit is contained in:
@@ -114,12 +114,12 @@ void print_history(nlohmann::json const& data)
|
||||
else if (role == "assistant") {
|
||||
// Check for explicit reasoning/thinking field
|
||||
if (msg.contains("reasoning")) {
|
||||
std::cout << "\033[32mAi Thinking\033[0m: " << msg.value("reasoning","") << "\n\n";
|
||||
std::cout << "\033[32m[Ai Thinking]\033[0m " << msg.value("reasoning","") << "\n\n";
|
||||
}
|
||||
|
||||
// Check for tool calls
|
||||
if (msg.contains("tool_calls") && msg["tool_calls"].is_array() && !msg["tool_calls"].empty()) {
|
||||
std::cout << "\033[33mAi Tool Call\033[0m:\n";
|
||||
std::cout << "\033[33m[Ai Tool Call]\033[0m\n";
|
||||
for (const auto& tc : msg["tool_calls"]) {
|
||||
auto func = tc.contains("function") ? tc["function"] : nlohmann::json::object();
|
||||
std::string fn = func.value("name", "");
|
||||
@@ -130,11 +130,11 @@ void print_history(nlohmann::json const& data)
|
||||
|
||||
std::string response = msg.value("content", "");
|
||||
if (response != "")
|
||||
std::cout << "\033[37mAi Response\033[0m: " << response << "\n\n";
|
||||
std::cout << "\033[37m[Ai Response]\033[0m " << response << "\n\n";
|
||||
}
|
||||
// Handle cases where thinking might be a separate message type (reasoning/thinking roles)
|
||||
else if (role == "reasoning" || role == "thinking") {
|
||||
std::cout << "\033[32mAi Thinking\033[0m: " << msg.value("content", "") << "\n\n";
|
||||
std::cout << "\033[32m[Ai Thinking]\033[0m " << msg.value("content", "") << "\n\n";
|
||||
}
|
||||
else if (role == "tool") {
|
||||
std::cout << "\033[35m[Tool Result]\033[0m " << msg.value("content", "") << "\n\n";
|
||||
|
||||
Reference in New Issue
Block a user