Skip to content

Commit d242a48

Browse files
committed
feat: support multiple metrics in line, column, and bar charts
1 parent 1903544 commit d242a48

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

backend/apps/chat/task/llm.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -849,14 +849,14 @@ def check_save_chart(self, session: Session, res: str) -> Dict[str, Any]:
849849
if chart.get('axis').get('series'):
850850
chart.get('axis').get('series')['value'] = chart.get('axis').get('series').get('value').lower()
851851
if chart.get('axis') and chart['axis'].get('multi-quota'):
852-
muti_quota = chart['axis']['multi-quota']
853-
if muti_quota.get('value'):
854-
if isinstance(muti_quota['value'], list):
852+
multi_quota = chart['axis']['multi-quota']
853+
if multi_quota.get('value'):
854+
if isinstance(multi_quota['value'], list):
855855
# 将数组中的每个值转换为小写
856-
muti_quota['value'] = [v.lower() if v else v for v in muti_quota['value']]
857-
elif isinstance(muti_quota['value'], str):
856+
multi_quota['value'] = [v.lower() if v else v for v in multi_quota['value']]
857+
elif isinstance(multi_quota['value'], str):
858858
# 如果是字符串,也转换为小写
859-
muti_quota['value'] = muti_quota['value'].lower()
859+
multi_quota['value'] = multi_quota['value'].lower()
860860
elif data['type'] == 'error':
861861
message = data['reason']
862862
error = True
@@ -1468,8 +1468,8 @@ def request_picture(chat_id: int, record_id: int, chart: dict, data: dict):
14681468
x = None
14691469
y = None
14701470
series = None
1471-
muti_quota_fields = []
1472-
muti_quota_name =None
1471+
multi_quota_fields = []
1472+
multi_quota_name =None
14731473

14741474
if chart.get('axis'):
14751475
axis_data = chart.get('axis')
@@ -1478,8 +1478,8 @@ def request_picture(chat_id: int, record_id: int, chart: dict, data: dict):
14781478
series = axis_data.get('series')
14791479
# 获取multi-quota字段列表
14801480
if axis_data.get('multi-quota') and 'value' in axis_data.get('multi-quota'):
1481-
muti_quota_fields = axis_data.get('multi-quota').get('value', [])
1482-
muti_quota_name = axis_data.get('multi-quota').get('name')
1481+
multi_quota_fields = axis_data.get('multi-quota').get('value', [])
1482+
multi_quota_name = axis_data.get('multi-quota').get('name')
14831483

14841484
axis = []
14851485
for v in columns:
@@ -1497,13 +1497,13 @@ def request_picture(chat_id: int, record_id: int, chart: dict, data: dict):
14971497
'type': 'y'
14981498
}
14991499
# 如果是multi-quota字段,添加标志
1500-
if y_item.get('value') in muti_quota_fields:
1500+
if y_item.get('value') in multi_quota_fields:
15011501
y_obj['multi-quota'] = True
15021502
axis.append(y_obj)
15031503
if series:
15041504
axis.append({'name': series.get('name'), 'value': series.get('value'), 'type': 'series'})
1505-
if muti_quota_name:
1506-
axis.append({'name': muti_quota_name, 'value': muti_quota_name, 'type': 'other-info'})
1505+
if multi_quota_name:
1506+
axis.append({'name': multi_quota_name, 'value': multi_quota_name, 'type': 'other-info'})
15071507

15081508
request_obj = {
15091509
"path": os.path.join(settings.MCP_IMAGE_PATH, file_name),

0 commit comments

Comments
 (0)