Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions backend/services/agent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,14 +1056,16 @@ async def import_agent_by_agent_id(
regeneration_model_id = business_logic_model_id or model_id
if regeneration_model_id:
try:
agent_name = _regenerate_agent_name_with_llm(
# Offload blocking LLM regeneration to a thread to avoid blocking the event loop
agent_name = await asyncio.to_thread(
_regenerate_agent_name_with_llm,
original_name=agent_name,
existing_names=existing_names,
task_description=import_agent_info.business_description or import_agent_info.description or "",
model_id=regeneration_model_id,
tenant_id=tenant_id,
language=LANGUAGE["ZH"], # Default to Chinese, can be enhanced later
agents_cache=all_agents
agents_cache=all_agents,
)
logger.info(f"Regenerated agent name: '{agent_name}'")
except Exception as e:
Expand All @@ -1088,14 +1090,16 @@ async def import_agent_by_agent_id(
regeneration_model_id = business_logic_model_id or model_id
if regeneration_model_id:
try:
agent_display_name = _regenerate_agent_display_name_with_llm(
# Offload blocking LLM regeneration to a thread to avoid blocking the event loop
agent_display_name = await asyncio.to_thread(
_regenerate_agent_display_name_with_llm,
original_display_name=agent_display_name,
existing_display_names=existing_display_names,
task_description=import_agent_info.business_description or import_agent_info.description or "",
model_id=regeneration_model_id,
tenant_id=tenant_id,
language=LANGUAGE["ZH"], # Default to Chinese, can be enhanced later
agents_cache=all_agents
agents_cache=all_agents,
)
logger.info(f"Regenerated agent display_name: '{agent_display_name}'")
except Exception as e:
Expand Down