Add step 625 tool call visualization model
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
// Step 624: Agent Chat Panel model
|
||||
|
||||
#include "AgentToolCallVisualization.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -19,6 +21,7 @@ struct AgentChatMessage {
|
||||
|
||||
struct AgentChatState {
|
||||
std::vector<AgentChatMessage> messages;
|
||||
std::vector<AgentToolCallView> toolCalls;
|
||||
std::string draftInput;
|
||||
bool autoScroll = true;
|
||||
bool open = false;
|
||||
@@ -52,6 +55,20 @@ public:
|
||||
state->autoScroll = true;
|
||||
}
|
||||
|
||||
static void addToolCall(AgentChatState* state,
|
||||
const std::string& toolName,
|
||||
const json& input,
|
||||
const json& output,
|
||||
const std::string& timestamp) {
|
||||
if (!state) return;
|
||||
AgentToolCallView view = AgentToolCallVisualization::build(toolName, input, output);
|
||||
state->toolCalls.push_back(view);
|
||||
state->messages.push_back({AgentChatRole::Tool,
|
||||
AgentToolCallVisualization::inlineLabel(view),
|
||||
timestamp});
|
||||
state->autoScroll = true;
|
||||
}
|
||||
|
||||
static const char* roleLabel(AgentChatRole role) {
|
||||
if (role == AgentChatRole::User) return "user";
|
||||
if (role == AgentChatRole::Assistant) return "assistant";
|
||||
|
||||
Reference in New Issue
Block a user