diff --git a/.github/workflows/update-pre-commit.yml b/.github/workflows/update-pre-commit.yml deleted file mode 100644 index 9d6a4310..00000000 --- a/.github/workflows/update-pre-commit.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Update pre-commit hooks - -on: - schedule: - - cron: '0 0 * * 0' # 每周日 UTC 时间 00:00 - workflow_dispatch: # 允许手动触发 - -jobs: - update-pre-commit: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install pre-commit - run: pip install pre-commit - - - name: Update pre-commit hooks - run: pre-commit autoupdate - - - name: Create Pull Request if changes - uses: peter-evans/create-pull-request@v5 - with: - commit-message: "chore: update pre-commit hooks" - title: "chore: update pre-commit hooks" - body: | - Automated update of pre-commit hooks via pre-commit autoupdate. - - **Changes:** - - Updated hook versions in .pre-commit-config.yaml - branch: "update/pre-commit-hooks" - labels: "dependencies" - delete-branch: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3a01585f..e323ea1e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -63,19 +63,19 @@ repos: - id: pyupgrade - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 25.9.0 hooks: - id: black args: [ --skip-string-normalization, --line-length=88 ] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 6.0.1 hooks: - id: isort args: [ "--profile", "black" ] - repo: https://github.com/pycqa/autoflake - rev: v2.2.1 + rev: v2.3.1 hooks: - id: autoflake args: @@ -84,7 +84,7 @@ repos: - --remove-unused-variables - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.3.0 hooks: - id: flake8 additional_dependencies: [ flake8-bugbear ] diff --git a/agents/matmaster_agent/base_agents/job_agent.py b/agents/matmaster_agent/base_agents/job_agent.py index b1a169ba..8a494c74 100644 --- a/agents/matmaster_agent/base_agents/job_agent.py +++ b/agents/matmaster_agent/base_agents/job_agent.py @@ -870,9 +870,9 @@ async def _run_async_impl( if not params_check_completed: # Call ParamsCheckInfoAgent to generate params needing check - async for params_check_info_event in self.params_check_info_agent.run_async( - ctx - ): + async for ( + params_check_info_event + ) in self.params_check_info_agent.run_async(ctx): yield params_check_info_event else: async for submit_event in self.submit_agent.run_async(ctx): diff --git a/agents/matmaster_agent/callback.py b/agents/matmaster_agent/callback.py index 46f3bc78..02d7279d 100644 --- a/agents/matmaster_agent/callback.py +++ b/agents/matmaster_agent/callback.py @@ -149,9 +149,9 @@ async def matmaster_check_job_status( llm_response.content = None break if not reset: - callback_context.state[ - 'special_llm_response' - ] = True # 标记开始处理原来消息的非流式版本 + callback_context.state['special_llm_response'] = ( + True # 标记开始处理原来消息的非流式版本 + ) llm_response.content.parts = [] reset = True function_call_id = f"call_{str(uuid.uuid4()).replace('-', '')[:24]}" diff --git a/agents/matmaster_agent/chembrain_agent/base.py b/agents/matmaster_agent/chembrain_agent/base.py index 4f280cde..47aa66f3 100644 --- a/agents/matmaster_agent/chembrain_agent/base.py +++ b/agents/matmaster_agent/chembrain_agent/base.py @@ -147,7 +147,9 @@ async def _run_async_impl( and event.content.parts and event.content.parts[0].function_response ): - logger.info(f"{event.content.parts[0].function_response.name} 调用结束") + logger.info( + f"{event.content.parts[0].function_response.name} 调用结束" + ) yield Event( author=self.name, actions=EventActions( diff --git a/agents/matmaster_agent/chembrain_agent/smiles_conversion_agent/callback.py b/agents/matmaster_agent/chembrain_agent/smiles_conversion_agent/callback.py index 9f8cebf3..b04aa636 100644 --- a/agents/matmaster_agent/chembrain_agent/smiles_conversion_agent/callback.py +++ b/agents/matmaster_agent/chembrain_agent/smiles_conversion_agent/callback.py @@ -26,9 +26,11 @@ async def smiles_conversion_after_tool( 'after': { 'tool_name': tool.name, 'tool_args': args, - 'tool_response': tool_response.content[0].text - if (tool_response and len(tool_response.content)) - else None, + 'tool_response': ( + tool_response.content[0].text + if (tool_response and len(tool_response.content)) + else None + ), } } diff --git a/agents/matmaster_agent/ssebrain_agent/base.py b/agents/matmaster_agent/ssebrain_agent/base.py index f540bd66..ad0834cd 100644 --- a/agents/matmaster_agent/ssebrain_agent/base.py +++ b/agents/matmaster_agent/ssebrain_agent/base.py @@ -144,7 +144,9 @@ async def _run_async_impl( and event.content.parts and event.content.parts[0].function_response ): - logger.info(f"{event.content.parts[0].function_response.name} 调用结束") + logger.info( + f"{event.content.parts[0].function_response.name} 调用结束" + ) yield Event( author=self.name, actions=EventActions( diff --git a/agents/matmaster_agent/ssebrain_agent/callback.py b/agents/matmaster_agent/ssebrain_agent/callback.py index e2fb8a47..ee064cba 100644 --- a/agents/matmaster_agent/ssebrain_agent/callback.py +++ b/agents/matmaster_agent/ssebrain_agent/callback.py @@ -54,7 +54,9 @@ async def ssebrain_before_agent( callback_context.state['current_time'] = datetime.now().strftime( '%Y-%m-%d %H:%M:%S' ) - callback_context.state['db_name'] = 'solid_state_electrolyte_db' # 使用默认数据库 + callback_context.state['db_name'] = ( + 'solid_state_electrolyte_db' # 使用默认数据库 + ) db_manager = DatabaseManager('solid_state_electrolyte_db') await db_manager.async_init() # Call the async init method callback_context.state['available_tables'] = db_manager.table_schema diff --git a/agents/matmaster_agent/utils/helper_func.py b/agents/matmaster_agent/utils/helper_func.py index dfa54753..4aa8c17f 100644 --- a/agents/matmaster_agent/utils/helper_func.py +++ b/agents/matmaster_agent/utils/helper_func.py @@ -34,7 +34,9 @@ async def update_session_state(ctx: InvocationContext, author: str): author=f"{filename}:{lineno}", actions=actions_with_update, ) - await ctx.session_service.append_event(ctx.session, system_event) # 会引入一个空消息 + await ctx.session_service.append_event( + ctx.session, system_event + ) # 会引入一个空消息 def update_llm_response( @@ -339,7 +341,9 @@ def get_new_function_call_indices( def check_None_wrapper(func): def wrapper(*args, **kwargs): - result = func(*args, **kwargs) # 注意这里应该是 *args, **kwargs 而不是 args, kwargs + result = func( + *args, **kwargs + ) # 注意这里应该是 *args, **kwargs 而不是 args, kwargs if result is None: raise ValueError( f"'{func.__name__.replace('_get_', '')}' was not found, please provide it!" diff --git a/evaluate/base/human_simulator.py b/evaluate/base/human_simulator.py index 944fa7c9..dbd8263b 100644 --- a/evaluate/base/human_simulator.py +++ b/evaluate/base/human_simulator.py @@ -115,7 +115,9 @@ def _generate_user_response(self, agent_message: str) -> Tuple[str, bool]: user_response = result.get('response', '我理解了。') should_continue = result.get('continue', True) - logger.info(f"用户响应生成 - 轮次: {self.turn_count}, 继续: {should_continue}") + logger.info( + f"用户响应生成 - 轮次: {self.turn_count}, 继续: {should_continue}" + ) return user_response, should_continue @@ -199,9 +201,9 @@ def get_conversation_summary(self) -> Dict[str, Any]: 'goal': self.goal.initial_question if self.goal else None, 'total_turns': self.turn_count, 'final_state': self.current_state.value, - 'duration_minutes': ((time.time() - self.start_time) / 60) - if self.start_time - else 0, + 'duration_minutes': ( + ((time.time() - self.start_time) / 60) if self.start_time else 0 + ), 'conversation_history': self.conversation_history, }