修复:DSH 自主查询、图片直显与报告稳定性
允许 Agent 在循环中查目录、修正查询和提问,保留实时权限检查及模型原始回答。 统一相同查询证据与图表资源;排名补齐阶段指标,修正 OR 重量筛选,并限制模型明细输入。 增加运行恢复、图表自适应坐标轴与两位小数,修复报告主图选择、重复图及边缘标签。 验证:独立副本通过 162 项 Python、73 项前端及 21 项后端测试,前端构建通过。 线上已用原 8 题复测,并追加两轮双期对比;TOP100 与组合筛选分别核对 100 行和 20 行。
This commit is contained in:
@@ -2041,8 +2041,7 @@ class QualityTools:
|
||||
try:
|
||||
result = rank_response(response, release, period, ranking_filters, arguments['dimension'],
|
||||
arguments.get('stage'), arguments['metric'], arguments.get('limit', 10),
|
||||
include_metrics=bool(self._query_contract and
|
||||
{'totalWeight','scrapWeight'} <= set((self._query_contract.get('task') or {}).get('fields', []))))
|
||||
include_metrics=bool(self._query_contract))
|
||||
except Exception as error:
|
||||
# The normal result and exception remain unchanged. Attach
|
||||
# a bounded, identifier-free summary so the protocol layer
|
||||
@@ -2172,6 +2171,16 @@ def tool_definition(*, native_protocol: bool = False, task=None, release_id=None
|
||||
modes = ['catalog', 'query', 'rank']
|
||||
schema['properties']['metric']['description'] = 'rank必填,不能省略:totalWeight为投入/生产重量,scrapWeight为报废重量。其他mode不传metric。'
|
||||
schema['properties']['mode']['description'] += ' rank完整示例:{"mode":"rank","metric":"totalWeight","stage":"black","dimension":"product","limit":10}。'
|
||||
if task.get('agentDriven'):
|
||||
schema['properties'].pop('freshQuery', None)
|
||||
schema['properties']['offset'] = {'type':'integer','minimum':0,'description':'query分组结果的模型展示分页偏移,默认0,每页最多100项;不影响正式数据范围。'}
|
||||
schema['properties']['search'] = {'type':'string','maxLength':256,'description':'catalog配合dimension检索当前账号可访问的完整名称,例如18x15x4。'}
|
||||
schema['properties']['fields']['description'] += ' query可用rate/scrapRate/totalWeight/scrapWeight选择所需指标。rank一次返回metrics.rate(所选阶段合格率)、metrics.totalWeight、metrics.scrapWeight,无需另查合格率。'
|
||||
for rule in schema['allOf']:
|
||||
if (rule.get('if',{}).get('properties',{}).get('mode',{}).get('const') == 'query'):
|
||||
constraints = rule.get('then',{}).get('allOf',[])
|
||||
rule['then']['allOf'] = [item for item in constraints if item not in ({'not':{'required':['fields']}}, {'not':{'required':['offset']}})]
|
||||
modes.extend(['compare','changes','defects'])
|
||||
if 'defect' in dimensions or exploring:
|
||||
modes.append('defects')
|
||||
if task.get('comparisonPeriod'):
|
||||
@@ -2186,22 +2195,24 @@ def tool_definition(*, native_protocol: bool = False, task=None, release_id=None
|
||||
schema['properties']['action']['enum'] = actions
|
||||
else:
|
||||
for key in ('action', 'fields', 'offset', 'recordFilter', 'sourceRevisionId'):
|
||||
if key in ('fields','offset') and task.get('agentDriven'):
|
||||
continue
|
||||
schema['properties'].pop(key, None)
|
||||
schema['properties'].pop('sourceRevisionId', None)
|
||||
schema['properties']['mode']['enum'] = modes
|
||||
schema['properties']['mode']['enum'] = list(dict.fromkeys(modes))
|
||||
schema['properties']['sort']['description'] = 'changes支持scrap_delta/current_scrap/rate_drop/current_rate;defects仅支持current_scrap/scrap_delta。'
|
||||
schema['properties']['view']['enum'] = ['overall','department','group','product']
|
||||
schema['properties']['view']['description'] = 'query使用:overall查总体;department/group/product分别批量读取正式产业部、分组、产品汇总。合格率排名和汇总重量条件使用query,不能用重量rank代替。'
|
||||
schema['properties']['stage']['enum'] = task.get('stages') or ['black', 'bright']
|
||||
schema['properties']['stage']['enum'] = ['black','bright'] if task.get('agentDriven') else task.get('stages') or ['black', 'bright']
|
||||
# Keep the model-facing type aligned with its allowed values.
|
||||
# Overall reads omit this optional field rather than passing null.
|
||||
schema['properties']['stage']['type'] = 'string'
|
||||
schema['properties']['dimension']['enum'] = ['department', 'group', 'product', 'defect']
|
||||
if task.get('period'):
|
||||
if task.get('period') and not task.get('agentDriven'):
|
||||
schema['properties']['period'] = {'const': copy.deepcopy(task['period']), 'description': '本轮期间已冻结,可省略,运行时自动带入。'}
|
||||
if task.get('comparisonPeriod'):
|
||||
if task.get('comparisonPeriod') and not task.get('agentDriven'):
|
||||
schema['properties']['comparisonPeriod'] = {'const': copy.deepcopy(task['comparisonPeriod']), 'description': '本轮基期已冻结,可省略,运行时自动带入。'}
|
||||
else:
|
||||
elif not task.get('agentDriven'):
|
||||
schema['properties'].pop('comparisonPeriod', None)
|
||||
if release_id:
|
||||
schema['properties']['releaseId'] = {'const': release_id, 'description': '本轮数据版本已冻结,可省略,运行时自动带入。'}
|
||||
|
||||
Reference in New Issue
Block a user