mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
Part two of making confirmation optional - add flag to ToolData so the button won't show in the UI
This commit is contained in:
@@ -27,7 +27,7 @@ const LLMResponse = memo(({ data, onConfirm, isLastMessage, onHeightChange }) =>
|
|||||||
: data?.response;
|
: data?.response;
|
||||||
|
|
||||||
const displayText = (response || '').trim();
|
const displayText = (response || '').trim();
|
||||||
const requiresConfirm = data.next === "confirm" && isLastMessage;
|
const requiresConfirm = data.force_confirm && data.next === "confirm" && isLastMessage;
|
||||||
const defaultText = requiresConfirm
|
const defaultText = requiresConfirm
|
||||||
? `Agent is ready to run "${data.tool}". Please confirm.`
|
? `Agent is ready to run "${data.tool}". Please confirm.`
|
||||||
: '';
|
: '';
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ if show_confirm_env is not None:
|
|||||||
if show_confirm_env == "False":
|
if show_confirm_env == "False":
|
||||||
SHOW_CONFIRM = False
|
SHOW_CONFIRM = False
|
||||||
|
|
||||||
|
#ToolData as part of the workflow is what's accessible to the UI - see LLMResponse.jsx for example
|
||||||
class ToolData(TypedDict, total=False):
|
class ToolData(TypedDict, total=False):
|
||||||
next: NextStep
|
next: NextStep
|
||||||
tool: str
|
tool: str
|
||||||
args: Dict[str, Any]
|
args: Dict[str, Any]
|
||||||
response: str
|
response: str
|
||||||
|
force_confirm: bool = True
|
||||||
|
|
||||||
@workflow.defn
|
@workflow.defn
|
||||||
class AgentGoalWorkflow:
|
class AgentGoalWorkflow:
|
||||||
@@ -162,6 +164,7 @@ class AgentGoalWorkflow:
|
|||||||
initial_interval=timedelta(seconds=5), backoff_coefficient=1
|
initial_interval=timedelta(seconds=5), backoff_coefficient=1
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
tool_data["force_confirm"] = SHOW_CONFIRM
|
||||||
self.tool_data = tool_data
|
self.tool_data = tool_data
|
||||||
|
|
||||||
# process the tool as dictated by the prompt response - what to do next, and with which tool
|
# process the tool as dictated by the prompt response - what to do next, and with which tool
|
||||||
|
|||||||
Reference in New Issue
Block a user