Skip to content

Commit

Permalink
Fix parsing of ML resp processor
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Sep 13, 2024
1 parent c6d9adf commit ca0d8ba
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import React, { useState, useEffect } from 'react';
import { useFormikContext, getIn } from 'formik';
import { cloneDeep, get, isEmpty, set } from 'lodash';
import { cloneDeep, isEmpty, set } from 'lodash';
import {
EuiCodeEditor,
EuiFlexGroup,
Expand Down Expand Up @@ -168,7 +168,7 @@ export function OutputTransformModal(props: OutputTransformModalProps) {
const docObjs = unwrapTransformedDocs(resp);
if (docObjs.length > 0) {
const sampleModelResult =
docObjs[0]?.inference_results;
docObjs[0]?.inference_results || {};
setSourceInput(
customStringify(sampleModelResult)
);
Expand Down Expand Up @@ -224,11 +224,8 @@ export function OutputTransformModal(props: OutputTransformModalProps) {
(hit: SearchHit) => hit._source
) as any[];
if (hits.length > 0) {
const sampleModelResult = get(
hits,
'0.inference_results.0',
{}
);
const sampleModelResult =
hits[0].inference_results || {};
setSourceInput(customStringify(sampleModelResult));
}
})
Expand Down

0 comments on commit ca0d8ba

Please sign in to comment.