Lots of changes... not done yet.
This commit is contained in:
@@ -1930,7 +1930,8 @@ impl AIConversation {
|
||||
) -> String {
|
||||
let mut result = Vec::new();
|
||||
for exchange in self.all_exchanges() {
|
||||
let formatted_exchange = exchange.format_for_copy(action_model);
|
||||
let formatted_exchange =
|
||||
exchange.format_for_copy_for_conversation(action_model, Some(self.id()));
|
||||
if !formatted_exchange.is_empty() {
|
||||
result.push(formatted_exchange);
|
||||
}
|
||||
|
||||
+38
-4
@@ -581,6 +581,14 @@ impl AIAgentOutput {
|
||||
pub fn format_for_copy(
|
||||
&self,
|
||||
action_model: Option<&crate::ai::blocklist::BlocklistAIActionModel>,
|
||||
) -> String {
|
||||
self.format_for_copy_for_conversation(action_model, None)
|
||||
}
|
||||
|
||||
pub fn format_for_copy_for_conversation(
|
||||
&self,
|
||||
action_model: Option<&crate::ai::blocklist::BlocklistAIActionModel>,
|
||||
conversation_id: Option<conversation::AIConversationId>,
|
||||
) -> String {
|
||||
let mut result = Vec::new();
|
||||
let mut last_was_action = false;
|
||||
@@ -612,8 +620,12 @@ impl AIAgentOutput {
|
||||
}
|
||||
AIAgentOutputMessageType::Action(action) => {
|
||||
// Include action results from the action model if available
|
||||
if let Some(action_model) = action_model {
|
||||
if let Some(action_result) = action_model.get_action_result(&action.id) {
|
||||
if let (Some(action_model), Some(conversation_id)) =
|
||||
(action_model, conversation_id)
|
||||
{
|
||||
if let Some(action_result) =
|
||||
action_model.get_action_result(conversation_id, &action.id)
|
||||
{
|
||||
result.push(format!("{}", MarkdownActionResult(&action_result.result)));
|
||||
// Add an extra newline after tool call results for readability
|
||||
result.push(String::new());
|
||||
@@ -1222,6 +1234,9 @@ impl<'a> std::fmt::Display for MarkdownActionResult<'a> {
|
||||
RequestCommandOutputResult::CancelledBeforeExecution => {
|
||||
write!(f, "\n_Command cancelled_")
|
||||
}
|
||||
RequestCommandOutputResult::ExecutionError { command, message } => {
|
||||
write!(f, "\n_Command `{command}` was not executed: {message}_")
|
||||
}
|
||||
RequestCommandOutputResult::Denylisted { command } => {
|
||||
write!(
|
||||
f,
|
||||
@@ -3225,9 +3240,19 @@ impl AIAgentExchange {
|
||||
pub fn format_output_for_copy(
|
||||
&self,
|
||||
action_model: Option<&crate::ai::blocklist::BlocklistAIActionModel>,
|
||||
) -> String {
|
||||
self.format_output_for_copy_for_conversation(action_model, None)
|
||||
}
|
||||
|
||||
pub fn format_output_for_copy_for_conversation(
|
||||
&self,
|
||||
action_model: Option<&crate::ai::blocklist::BlocklistAIActionModel>,
|
||||
conversation_id: Option<conversation::AIConversationId>,
|
||||
) -> String {
|
||||
match self.output_status.output() {
|
||||
Some(output) => output.get().format_for_copy(action_model),
|
||||
Some(output) => output
|
||||
.get()
|
||||
.format_for_copy_for_conversation(action_model, conversation_id),
|
||||
None => String::new(),
|
||||
}
|
||||
}
|
||||
@@ -3238,9 +3263,18 @@ impl AIAgentExchange {
|
||||
pub fn format_for_copy(
|
||||
&self,
|
||||
action_model: Option<&crate::ai::blocklist::BlocklistAIActionModel>,
|
||||
) -> String {
|
||||
self.format_for_copy_for_conversation(action_model, None)
|
||||
}
|
||||
|
||||
pub fn format_for_copy_for_conversation(
|
||||
&self,
|
||||
action_model: Option<&crate::ai::blocklist::BlocklistAIActionModel>,
|
||||
conversation_id: Option<conversation::AIConversationId>,
|
||||
) -> String {
|
||||
let input_text = self.format_input_for_copy();
|
||||
let output_text = self.format_output_for_copy(action_model);
|
||||
let output_text =
|
||||
self.format_output_for_copy_for_conversation(action_model, conversation_id);
|
||||
let has_user_input = !input_text.is_empty();
|
||||
let has_agent_output = !output_text.is_empty();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user