Made Jarvis more mobile friendly

This commit is contained in:
2026-04-21 11:00:39 +02:00
parent a72eef4b82
commit eaea8d94b1
14 changed files with 604 additions and 97 deletions
+16 -1
View File
@@ -2585,6 +2585,14 @@ async def create_my_email_account(request: Request):
agent_model = body.get("agent_model", "").strip()
agent_prompt = body.get("agent_prompt", "").strip()
agent_max_tool_calls = body.get("agent_max_tool_calls")
if agent_max_tool_calls is not None:
try:
agent_max_tool_calls = int(agent_max_tool_calls)
except (TypeError, ValueError):
agent_max_tool_calls = None
agent_prompt_mode = body.get("agent_prompt_mode") or "combined"
# Auto-create a dedicated agent for this account
agent = await create_agent(
name=f"Email Handler: {label}",
@@ -2593,6 +2601,8 @@ async def create_my_email_account(request: Request):
allowed_tools=["email"],
created_by="user",
owner_user_id=user.id,
max_tool_calls=agent_max_tool_calls,
prompt_mode=agent_prompt_mode,
)
agent_id = agent["id"]
@@ -2629,7 +2639,7 @@ async def update_my_email_account(request: Request, account_id: str):
raise HTTPException(status_code=404, detail="Account not found")
body = await request.json()
# Update the linked agent's model and prompt if provided
# Update the linked agent's model, prompt, and cost-control fields if provided
if acct.get("agent_id"):
agent_fields = {}
if "agent_model" in body:
@@ -2638,6 +2648,11 @@ async def update_my_email_account(request: Request, account_id: str):
agent_fields["prompt"] = body["agent_prompt"]
if "label" in body:
agent_fields["name"] = f"Email Handler: {body['label']}"
if "agent_max_tool_calls" in body:
v = body["agent_max_tool_calls"]
agent_fields["max_tool_calls"] = int(v) if v is not None else None
if "agent_prompt_mode" in body:
agent_fields["prompt_mode"] = body["agent_prompt_mode"] or "combined"
if agent_fields:
await update_agent(acct["agent_id"], **agent_fields)