Skip to content

Commit 206f520

Browse files
authored
Merge pull request #714 from AnguseZhang/fix/matmaster_flow_flash
refactor: 通过json.dumps重构matmaster_flow_args以提高可读性和结构一致性
2 parents d772ee6 + 0dbbf78 commit 206f520

2 files changed

Lines changed: 58 additions & 31 deletions

File tree

agents/matmaster_agent/flow_agents/agent.py

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -503,11 +503,15 @@ async def _run_plan_make_agent(
503503
None,
504504
ModelRole,
505505
{
506-
'title': plan_title,
507-
'status': 'start',
508-
'font_color': '#30B37F',
509-
'bg_color': '#EFF8F5',
510-
'border_color': '#B2E0CE',
506+
'matmaster_flow_args': json.dumps(
507+
{
508+
'title': plan_title,
509+
'status': 'start',
510+
'font_color': '#30B37F',
511+
'bg_color': '#EFF8F5',
512+
'border_color': '#B2E0CE',
513+
}
514+
)
511515
},
512516
):
513517
yield matmaster_flow_event
@@ -544,11 +548,15 @@ async def _run_plan_make_agent(
544548
None,
545549
ModelRole,
546550
{
547-
'title': plan_title,
548-
'status': 'end',
549-
'font_color': '#30B37F',
550-
'bg_color': '#EFF8F5',
551-
'border_color': '#B2E0CE',
551+
'matmaster_flow_args': json.dumps(
552+
{
553+
'title': plan_title,
554+
'status': 'end',
555+
'font_color': '#30B37F',
556+
'bg_color': '#EFF8F5',
557+
'border_color': '#B2E0CE',
558+
}
559+
)
552560
},
553561
):
554562
yield matmaster_flow_event
@@ -636,11 +644,15 @@ async def _run_plan_execute_and_summary_agent(
636644
None,
637645
ModelRole,
638646
{
639-
'title': i18n.t('PlanSummary'),
640-
'status': 'start',
641-
'font_color': '#9479F7',
642-
'bg_color': '#F5F3FF',
643-
'border_color': '#CFC3FC',
647+
'matmaster_flow_args': json.dumps(
648+
{
649+
'title': i18n.t('PlanSummary'),
650+
'status': 'start',
651+
'font_color': '#9479F7',
652+
'bg_color': '#F5F3FF',
653+
'border_color': '#CFC3FC',
654+
}
655+
)
644656
},
645657
):
646658
yield matmaster_flow_event
@@ -686,11 +698,15 @@ async def _run_plan_execute_and_summary_agent(
686698
None,
687699
ModelRole,
688700
{
689-
'title': i18n.t('PlanSummary'),
690-
'status': 'end',
691-
'font_color': '#9479F7',
692-
'bg_color': '#F5F3FF',
693-
'border_color': '#CFC3FC',
701+
'matmaster_flow_args': json.dumps(
702+
{
703+
'title': i18n.t('PlanSummary'),
704+
'status': 'end',
705+
'font_color': '#9479F7',
706+
'bg_color': '#F5F3FF',
707+
'border_color': '#CFC3FC',
708+
}
709+
)
694710
},
695711
):
696712
yield matmaster_flow_event
@@ -841,11 +857,17 @@ async def _run_async_impl(
841857
None,
842858
ModelRole,
843859
{
844-
'title': active_flow.get('title', ''),
845-
'status': 'end',
846-
'font_color': active_flow.get('font_color', '#0E6DE8'),
847-
'bg_color': active_flow.get('bg_color', '#EBF2FB'),
848-
'border_color': active_flow.get('border_color', '#B7D3F7'),
860+
'matmaster_flow_args': json.dumps(
861+
{
862+
'title': active_flow.get('title', ''),
863+
'status': 'end',
864+
'font_color': active_flow.get('font_color', '#0E6DE8'),
865+
'bg_color': active_flow.get('bg_color', '#EBF2FB'),
866+
'border_color': active_flow.get(
867+
'border_color', '#B7D3F7'
868+
),
869+
}
870+
)
849871
},
850872
):
851873
yield matmaster_flow_event

agents/matmaster_agent/flow_agents/execution_agent/agent.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import copy
2+
import json
23
import logging
34
from typing import AsyncGenerator, override
45

@@ -177,12 +178,16 @@ async def _core_execution_agent(
177178
None,
178179
ModelRole,
179180
{
180-
'title': step_title,
181-
'status': 'start',
182-
'font_color': '#0E6DE8',
183-
'bg_color': '#EBF2FB',
184-
'border_color': '#B7D3F7',
185-
'execution_type_label': execution_type_label,
181+
'matmaster_flow_args': json.dumps(
182+
{
183+
'title': step_title,
184+
'status': 'start',
185+
'font_color': '#0E6DE8',
186+
'bg_color': '#EBF2FB',
187+
'border_color': '#B7D3F7',
188+
'execution_type_label': execution_type_label,
189+
}
190+
)
186191
},
187192
):
188193
yield matmaster_flow_event

0 commit comments

Comments
 (0)