mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-18 18:44:42 -05:00
fix(platform/copilot): address PR review comments
- Extract reason from decomposition_result in vague_goal path instead of hardcoding - Change goal_type field to Literal["vague", "unachievable"] for stronger typing - Add reason prop to SuggestedGoalCard and display it - Pass reason to SuggestedGoalCard in CreateAgent - Add enum constraint to goal_type in openapi.json schema
This commit is contained in:
@@ -200,10 +200,13 @@ class CreateAgentTool(BaseTool):
|
||||
|
||||
if decomposition_result.get("type") == "vague_goal":
|
||||
suggested = decomposition_result.get("suggested_goal", "")
|
||||
reason = decomposition_result.get(
|
||||
"reason", "The goal needs more specific details"
|
||||
)
|
||||
return SuggestedGoalResponse(
|
||||
message="The goal is too vague to create a specific workflow.",
|
||||
suggested_goal=suggested,
|
||||
reason="The goal needs more specific details",
|
||||
reason=reason,
|
||||
original_goal=description,
|
||||
goal_type="vague",
|
||||
session_id=session_id,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Any
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@@ -309,7 +309,7 @@ class SuggestedGoalResponse(ToolResponseBase):
|
||||
original_goal: str = Field(
|
||||
default="", description="The user's original goal for context"
|
||||
)
|
||||
goal_type: str = Field(
|
||||
goal_type: Literal["vague", "unachievable"] = Field(
|
||||
default="vague", description="Type: 'vague' or 'unachievable'"
|
||||
)
|
||||
|
||||
|
||||
@@ -263,6 +263,7 @@ export function CreateAgentTool({ part }: Props) {
|
||||
<SuggestedGoalCard
|
||||
message={output.message}
|
||||
suggestedGoal={output.suggested_goal}
|
||||
reason={output.reason}
|
||||
goalType={output.goal_type ?? "vague"}
|
||||
onUseSuggestedGoal={handleUseSuggestedGoal}
|
||||
/>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ArrowRightIcon, LightbulbIcon } from "@phosphor-icons/react";
|
||||
interface Props {
|
||||
message: string;
|
||||
suggestedGoal: string;
|
||||
reason?: string;
|
||||
goalType: string;
|
||||
onUseSuggestedGoal: (goal: string) => void;
|
||||
}
|
||||
@@ -14,6 +15,7 @@ interface Props {
|
||||
export function SuggestedGoalCard({
|
||||
message,
|
||||
suggestedGoal,
|
||||
reason,
|
||||
goalType,
|
||||
onUseSuggestedGoal,
|
||||
}: Props) {
|
||||
@@ -33,7 +35,7 @@ export function SuggestedGoalCard({
|
||||
: "Goal needs more detail"}
|
||||
</Text>
|
||||
<Text variant="small" className="text-slate-600">
|
||||
{message}
|
||||
{reason || message}
|
||||
</Text>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11709,6 +11709,7 @@
|
||||
},
|
||||
"goal_type": {
|
||||
"type": "string",
|
||||
"enum": ["vague", "unachievable"],
|
||||
"title": "Goal Type",
|
||||
"description": "Type: 'vague' or 'unachievable'",
|
||||
"default": "vague"
|
||||
|
||||
Reference in New Issue
Block a user