1313
1414from agents .matmaster_agent .base_agents .callback import _get_ak
1515from agents .matmaster_agent .constant import FRONTEND_STATE_KEY
16+ from agents .matmaster_agent .locales import i18n
1617from agents .matmaster_agent .model import UserContent
1718from agents .matmaster_agent .prompt import get_user_content_lang
18- from agents .matmaster_agent .style import JobCompleteCard
19+ from agents .matmaster_agent .style import get_job_complete_card
1920from agents .matmaster_agent .utils .job_utils import get_job_status , has_job_running , get_running_jobs_detail
2021
2122logger = logging .getLogger (__name__ )
@@ -75,10 +76,9 @@ async def matmaster_check_job_status(callback_context: CallbackContext, llm_resp
7576 running_job_ids = get_running_jobs_detail (jobs_dict ) # 从 state 里面拿
7677 access_key = _get_ak (callback_context ) # 从 state 或环境变量里面拿
7778 if callback_context .state ['target_language' ] in ['Chinese' , 'zh-CN' , '简体中文' , 'Chinese (Simplified)' ]:
78- job_complete_intro = '检测到任务 <{job_id}> 已完成,我将立刻转移至对应的 Agent 去获取任务结果。'
79+ i18n . language = "zh"
7980 else :
80- job_complete_intro = ('Job <{job_id}> has been detected as completed. '
81- 'I will immediately transfer to the corresponding agent to retrieve the job results.' )
81+ i18n .language = "en"
8282
8383 reset = False
8484 for origin_job_id , job_id , job_query_url , agent_name in running_job_ids :
@@ -101,7 +101,7 @@ async def matmaster_check_job_status(callback_context: CallbackContext, llm_resp
101101 reset = True
102102 function_call_id = f"call_{ str (uuid .uuid4 ()).replace ('-' , '' )[:24 ]} "
103103 callback_context .state ['origin_job_id' ] = origin_job_id
104- llm_response .content .parts .append (Part (text = JobCompleteCard . format ( job_id = job_id )))
104+ llm_response .content .parts .append (Part (text = get_job_complete_card ( i18n = i18n , job_id = job_id )))
105105 llm_response .content .parts .append (Part (function_call = FunctionCall (id = function_call_id ,
106106 name = 'transfer_to_agent' ,
107107 args = {'agent_name' : agent_name })))
0 commit comments