diff --git a/autogpt_platform/backend/backend/server/v2/chat/response_model.py b/autogpt_platform/backend/backend/server/v2/chat/response_model.py index 7ca335ff85..2d38820bd5 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/response_model.py +++ b/autogpt_platform/backend/backend/server/v2/chat/response_model.py @@ -39,6 +39,7 @@ class StreamToolCallStart(StreamBaseResponse): """Tool call started notification.""" type: ResponseType = ResponseType.TOOL_CALL_START + tool_name: str = Field(..., description="Name of the tool that was executed") tool_id: str = Field(..., description="Unique tool call ID") diff --git a/autogpt_platform/backend/backend/server/v2/chat/service.py b/autogpt_platform/backend/backend/server/v2/chat/service.py index 467be47e79..4328deb016 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/service.py +++ b/autogpt_platform/backend/backend/server/v2/chat/service.py @@ -440,9 +440,11 @@ async def _stream_chat_chunks( if ( idx not in emitted_start_for_idx and tool_calls[idx]["id"] + and tool_calls[idx]["function"]["name"] ): yield StreamToolCallStart( tool_id=tool_calls[idx]["id"], + tool_name=tool_calls[idx]["function"]["name"], timestamp=datetime.now(UTC).isoformat(), ) emitted_start_for_idx.add(idx) diff --git a/autogpt_platform/backend/backend/server/v2/chat/tools/__init__.py b/autogpt_platform/backend/backend/server/v2/chat/tools/__init__.py index bdccb9c1dc..e0218bb7a2 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/tools/__init__.py +++ b/autogpt_platform/backend/backend/server/v2/chat/tools/__init__.py @@ -43,7 +43,7 @@ async def execute_tool( "find_agent": find_agent_tool, "get_agent_details": get_agent_details_tool, "get_required_setup_info": get_required_setup_info_tool, - "setup_agent": setup_agent_tool, + "schedule_agent": setup_agent_tool, "run_agent": run_agent_tool, } if tool_name not in tool_map: diff --git a/autogpt_platform/backend/backend/server/v2/chat/tools/find_agent.py b/autogpt_platform/backend/backend/server/v2/chat/tools/find_agent.py index 40fc4ae28b..111041a8f4 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/tools/find_agent.py +++ b/autogpt_platform/backend/backend/server/v2/chat/tools/find_agent.py @@ -120,7 +120,7 @@ class FindAgentTool(BaseTool): f"Found {len(agents)} agent{'s' if len(agents) != 1 else ''} for '{query}'" ) return AgentCarouselResponse( - message="Now you have found some options for the user to choose from. Please ask the user if they would like to use any of these agents. If they do, please call the get_agent_details tool for this agent.", + message="Now you have found some options for the user to choose from. You can add a link to a recommended agent at: /marketplace/agent/agent_id Please ask the user if they would like to use any of these agents. If they do, please call the get_agent_details tool for this agent.", title=title, agents=agents, count=len(agents), diff --git a/autogpt_platform/backend/backend/server/v2/chat/tools/get_agent_details.py b/autogpt_platform/backend/backend/server/v2/chat/tools/get_agent_details.py index 3f8e263ad8..8e8d42dbc9 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/tools/get_agent_details.py +++ b/autogpt_platform/backend/backend/server/v2/chat/tools/get_agent_details.py @@ -204,7 +204,7 @@ class GetAgentDetailsTool(BaseTool): ) return AgentDetailsResponse( - message=f"Found agent '{agent_details.name}'. You do not need to run this tool again for this agent.", + message=f"Found agent '{agent_details.name}'. When presenting the agent you do not need to mention the required credentials. You do not need to run this tool again for this agent.", session_id=session_id, agent=agent_details, user_authenticated=user_id is not None, diff --git a/autogpt_platform/backend/backend/server/v2/chat/tools/models.py b/autogpt_platform/backend/backend/server/v2/chat/tools/models.py index e8c2ab0ff1..d18d2c2d23 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/tools/models.py +++ b/autogpt_platform/backend/backend/server/v2/chat/tools/models.py @@ -66,6 +66,7 @@ class AgentCarouselResponse(ToolResponseBase): title: str = "Available Agents" agents: list[AgentInfo] count: int + name: str = "agent_carousel" class NoResultsResponse(ToolResponseBase): @@ -73,6 +74,7 @@ class NoResultsResponse(ToolResponseBase): type: ResponseType = ResponseType.NO_RESULTS suggestions: list[str] = [] + name: str = "no_results" # Agent details models diff --git a/autogpt_platform/backend/backend/server/v2/chat/tools/run_agent.py b/autogpt_platform/backend/backend/server/v2/chat/tools/run_agent.py index 25c7a90577..4b3754b322 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/tools/run_agent.py +++ b/autogpt_platform/backend/backend/server/v2/chat/tools/run_agent.py @@ -248,7 +248,7 @@ class RunAgentTool(BaseTool): ) return ExecutionStartedResponse( - message="Agent execution successfully started. Do not run this tool again unless specifically asked to run the agent again.", + message=f"Agent execution successfully started. You can add a link to the agent at: /library/agents/{library_agent.id}. Do not run this tool again unless specifically asked to run the agent again.", session_id=session_id, execution_id=execution.id, graph_id=library_agent.graph_id, diff --git a/autogpt_platform/backend/backend/server/v2/chat/tools/setup_agent.py b/autogpt_platform/backend/backend/server/v2/chat/tools/setup_agent.py index e6e71e2aad..5a2ddb8fbe 100644 --- a/autogpt_platform/backend/backend/server/v2/chat/tools/setup_agent.py +++ b/autogpt_platform/backend/backend/server/v2/chat/tools/setup_agent.py @@ -273,7 +273,7 @@ class SetupAgentTool(BaseTool): ) return ExecutionStartedResponse( - message="Agent execution successfully scheduled. Do not run this tool again unless specifically asked to run the agent again.", + message=f"Agent execution successfully scheduled. You can add a link to the agent at: /library/agents/{library_agent.id}. Do not run this tool again unless specifically asked to run the agent again.", session_id=session_id, execution_id=result.id, graph_id=library_agent.graph_id, diff --git a/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/helpers.ts index e2b37dbb6d..0ef2ed81ab 100644 --- a/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/helpers.ts +++ b/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/helpers.ts @@ -145,6 +145,7 @@ export function parseToolResponse( if (isAgentArray(agentsData)) { return { type: "agent_carousel", + toolName: "agent_carousel", agents: agentsData, totalCount: parsedResult.total_count as number | undefined, timestamp: timestamp || new Date(), @@ -156,6 +157,7 @@ export function parseToolResponse( if (responseType === "execution_started") { return { type: "execution_started", + toolName: "execution_started", executionId: (parsedResult.execution_id as string) || "", agentName: parsedResult.agent_name as string | undefined, message: parsedResult.message as string | undefined, @@ -165,6 +167,7 @@ export function parseToolResponse( if (responseType === "need_login") { return { type: "login_needed", + toolName: "login_needed", message: (parsedResult.message as string) || "Please sign in to use chat and agent features", @@ -260,6 +263,7 @@ export function extractCredentialsNeeded( })); return { type: "credentials_needed", + toolName: "get_required_setup_info", credentials, message: `To run ${agentName}, you need to add ${credentials.length === 1 ? "credentials" : `${credentials.length} credentials`}.`, agentName, diff --git a/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/useChatContainer.handlers.ts b/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/useChatContainer.handlers.ts index e7cf030252..4cca79daca 100644 --- a/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/useChatContainer.handlers.ts +++ b/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatContainer/useChatContainer.handlers.ts @@ -141,6 +141,7 @@ export function handleLoginNeeded( ) { const loginNeededMessage: ChatMessageData = { type: "login_needed", + toolName: "login_needed", message: chunk.message || "Please sign in to use chat and agent features", sessionId: chunk.session_id || deps.sessionId, agentInfo: chunk.agent_info, diff --git a/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatMessage/ChatMessage.tsx b/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatMessage/ChatMessage.tsx index 1c302a1613..6d8fdacb9a 100644 --- a/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatMessage/ChatMessage.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/chat/components/ChatMessage/ChatMessage.tsx @@ -9,12 +9,9 @@ import { ToolCallMessage } from "@/app/(platform)/chat/components/ToolCallMessag import { ToolResponseMessage } from "@/app/(platform)/chat/components/ToolResponseMessage/ToolResponseMessage"; import { AuthPromptWidget } from "@/app/(platform)/chat/components/AuthPromptWidget/AuthPromptWidget"; import { ChatCredentialsSetup } from "@/app/(platform)/chat/components/ChatCredentialsSetup/ChatCredentialsSetup"; -import { NoResultsMessage } from "@/app/(platform)/chat/components/NoResultsMessage/NoResultsMessage"; -import { AgentCarouselMessage } from "@/app/(platform)/chat/components/AgentCarouselMessage/AgentCarouselMessage"; -import { ExecutionStartedMessage } from "@/app/(platform)/chat/components/ExecutionStartedMessage/ExecutionStartedMessage"; import { useSupabase } from "@/lib/supabase/hooks/useSupabase"; import { useChatMessage, type ChatMessageData } from "./useChatMessage"; - +import { getToolActionPhrase } from "@/app/(platform)/chat/helpers"; export interface ChatMessageProps { message: ChatMessageData; className?: string; @@ -38,9 +35,6 @@ export function ChatMessage({ isToolResponse, isLoginNeeded, isCredentialsNeeded, - isNoResults, - isAgentCarousel, - isExecutionStarted, } = useChatMessage(message); const handleAllCredentialsComplete = useCallback( @@ -129,63 +123,25 @@ export function ChatMessage({ if (isToolCall && message.type === "tool_call") { return (
- {JSON.stringify(args, null, 2)}
-
-
- {shouldTruncate && !isExpanded
- ? `${resultString.slice(0, 200)}...`
- : resultString}
-
-