@@ -1287,6 +1287,37 @@ func (e *ExptResultBuilder) buildEvaluatorResult(ctx context.Context) error {
12871287 logs .CtxWarn (ctx , "turnEvaluatorResultRef not found, evaluatorRecordID: %v, turnResultID: %v" , evaluatorRecord .ID , turnResultID )
12881288 continue
12891289 }
1290+
1291+ // 当 FullTrajectory=false 时,如果评估器输入里的 input_fields / evaluate_target_output_fields 中包含 trajectory,
1292+ // 同样做一次 JSON 预览剪裁 + 文本长度剪裁,避免评估器输入里携带超长轨迹。
1293+ if ! e .FullTrajectory && evaluatorRecord .EvaluatorInputData != nil {
1294+ // 1) InputFields 中的 trajectory
1295+ if evaluatorRecord .EvaluatorInputData .InputFields != nil {
1296+ if trajectoryContent , ok := evaluatorRecord .EvaluatorInputData .InputFields [consts .EvalTargetOutputFieldKeyTrajectory ]; ok && trajectoryContent != nil {
1297+ if trajectoryContent .Text != nil && len (* trajectoryContent .Text ) > 0 {
1298+ preview := utils .GenerateJsonObjectPreview (* trajectoryContent .Text )
1299+ if preview != "" {
1300+ trajectoryContent .Text = gptr .Of (utils .GenerateTextPreview (preview ))
1301+ } else {
1302+ trajectoryContent .Text = gptr .Of (utils .GenerateTextPreview (* trajectoryContent .Text ))
1303+ }
1304+ }
1305+ }
1306+ }
1307+ // 2) EvaluateTargetOutputFields 中的 trajectory
1308+ if evaluatorRecord .EvaluatorInputData .EvaluateTargetOutputFields != nil {
1309+ if trajectoryContent , ok := evaluatorRecord .EvaluatorInputData .EvaluateTargetOutputFields [consts .EvalTargetOutputFieldKeyTrajectory ]; ok && trajectoryContent != nil {
1310+ if trajectoryContent .Text != nil && len (* trajectoryContent .Text ) > 0 {
1311+ preview := utils .GenerateJsonObjectPreview (* trajectoryContent .Text )
1312+ if preview != "" {
1313+ trajectoryContent .Text = gptr .Of (utils .GenerateTextPreview (preview ))
1314+ } else {
1315+ trajectoryContent .Text = gptr .Of (utils .GenerateTextPreview (* trajectoryContent .Text ))
1316+ }
1317+ }
1318+ }
1319+ }
1320+ }
12901321 if _ , ok := turnResultID2VersionID2Result [turnResultID ]; ! ok {
12911322 turnResultID2VersionID2Result [turnResultID ] = make (map [int64 ]* entity.EvaluatorRecord )
12921323 }
@@ -1517,17 +1548,18 @@ func (e *ExptResultBuilder) buildTargetOutput(ctx context.Context) error {
15171548 if ! ok {
15181549 continue
15191550 }
1520-
15211551 // 如果不需要完整轨迹,则使用 generateJsonObjectPreview 对 trajectory 进行剪裁
15221552 if ! e .FullTrajectory &&
15231553 targetRecord .EvalTargetOutputData != nil &&
15241554 targetRecord .EvalTargetOutputData .OutputFields != nil {
15251555 if trajectoryContent , ok := targetRecord .EvalTargetOutputData .OutputFields [consts .EvalTargetOutputFieldKeyTrajectory ]; ok && trajectoryContent != nil {
15261556 if trajectoryContent .Text != nil && len (* trajectoryContent .Text ) > 0 {
15271557 // 使用 generateJsonObjectPreview 对 trajectory JSON 进行剪裁
1528- preview := utils .GenerateJsonObjectPreview ([] byte ( * trajectoryContent .Text ) )
1558+ preview := utils .GenerateJsonObjectPreview (* trajectoryContent .Text )
15291559 if preview != "" {
1530- trajectoryContent .Text = & preview
1560+ trajectoryContent .Text = gptr .Of (utils .GenerateTextPreview (preview ))
1561+ } else {
1562+ trajectoryContent .Text = gptr .Of (utils .GenerateTextPreview (* trajectoryContent .Text ))
15311563 }
15321564 }
15331565 }
0 commit comments