Skip to content

Commit

Permalink
Fix mappedDoc in createLogsAIAssistantRenderer and revert change to L…
Browse files Browse the repository at this point in the history
…ogAIAssistant
  • Loading branch information
davismcphee committed Jun 6, 2024
1 parent 6607524 commit 0bfbe8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export function createLogAIAssistant({
export const createLogsAIAssistantRenderer =
(LogAIAssistantRender: ReturnType<typeof createLogAIAssistant>) =>
({ doc }: ObservabilityLogsAIAssistantFeatureRenderDeps) => {
const mappedDoc = useMemo(
const mappedDoc = useMemo<LogAIAssistantDocument>(
() => ({
fields: Object.entries(doc.flattened).map(([field, value]) => ({
field,
value,
})) as LogAIAssistantDocument['fields'],
value: Array.isArray(value) ? value : [value],
})),
}),
[doc]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ export const LogAIAssistant = ({
return undefined;
}

const messageValue = doc.fields.find((field) => field.field === 'message')?.value;
const message = Array.isArray(messageValue) ? messageValue[0] : messageValue;
const message = doc.fields.find((field) => field.field === 'message')?.value[0];

return getContextualInsightMessages({
message: `I'm looking at a log entry. Can you construct a Kibana KQL query that I can enter in the search bar that gives me similar log entries, based on the message field?`,
Expand Down

0 comments on commit 0bfbe8a

Please sign in to comment.