diff --git a/CHANGELOG.md b/CHANGELOG.md index 29d980d4..4b9c882e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - remove redundant error toast([#515](https://github.com/opensearch-project/dashboards-assistant/pull/515)) - Add auto suggested aggregation for text2Viz ([#514](https://github.com/opensearch-project/dashboards-assistant/pull/514)) - Remove experimental badge for natural language vis ([#516](https://github.com/opensearch-project/dashboards-assistant/pull/516)) +- Revert - Add http error instruction for t2ppl task ([#518](https://github.com/opensearch-project/dashboards-assistant/pull/518)) ### Bug Fixes diff --git a/public/utils/pipeline/text_to_ppl_task.test.ts b/public/utils/pipeline/text_to_ppl_task.test.ts deleted file mode 100644 index c042b235..00000000 --- a/public/utils/pipeline/text_to_ppl_task.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright OpenSearch Contributors - * SPDX-License-Identifier: Apache-2.0 - */ - -import { processInputQuestion } from './text_to_ppl_task'; - -describe('processInputQuestion', () => { - it('should return consistent instructions if error or fail keyword exists', () => { - expect(processInputQuestion('show me Errors by day in the last 7 days?')).toMatchInlineSnapshot( - `"show me Errors by day in the last 7 days?. If you're dealing logs with http response code, then error usually refers to http response code like 4xx, 5xx"` - ); - - expect(processInputQuestion('how many Failed logs in January')).toMatchInlineSnapshot( - `"how many Failed logs in January. If you're dealing logs with http response code, then error usually refers to http response code like 4xx, 5xx"` - ); - }); - - it('should return consistent instructions if no error or fail keyword exists', () => { - expect(processInputQuestion('how many orders are sold every day')).toMatchInlineSnapshot( - `"how many orders are sold every day"` - ); - }); -}); diff --git a/public/utils/pipeline/text_to_ppl_task.ts b/public/utils/pipeline/text_to_ppl_task.ts index 944c287a..87f0150c 100644 --- a/public/utils/pipeline/text_to_ppl_task.ts +++ b/public/utils/pipeline/text_to_ppl_task.ts @@ -7,14 +7,6 @@ import { HttpSetup } from '../../../../../src/core/public'; import { Task } from './task'; import { TEXT2VIZ_API } from '../../../common/constants/llm'; -export const processInputQuestion = (inputQuestion: string) => { - const httpErrorInstructionAppendRegExp = new RegExp(`(?:${['error', 'fail'].join('|')})`, 'i'); - if (httpErrorInstructionAppendRegExp.test(inputQuestion)) { - return `${inputQuestion}. If you're dealing logs with http response code, then error usually refers to http response code like 4xx, 5xx`; - } - return inputQuestion; -}; - interface Input { inputQuestion: string; index: string; @@ -33,7 +25,7 @@ export class Text2PPLTask extends Task { async execute(v: T) { let ppl = ''; try { - ppl = await this.text2ppl(processInputQuestion(v.inputQuestion), v.index, v.dataSourceId); + ppl = await this.text2ppl(v.inputQuestion, v.index, v.dataSourceId); } catch (e) { throw new Error( `Error while generating PPL query with input: ${v.inputQuestion}. Please try rephrasing your question.` diff --git a/release-notes/dashboards-assistant.release-notes-3.0.0.0-alpha1.md b/release-notes/dashboards-assistant.release-notes-3.0.0.0-alpha1.md index bee0667d..4f882594 100644 --- a/release-notes/dashboards-assistant.release-notes-3.0.0.0-alpha1.md +++ b/release-notes/dashboards-assistant.release-notes-3.0.0.0-alpha1.md @@ -25,7 +25,6 @@ Compatible with OpenSearch and OpenSearch Dashboards version 3.0.0-alpha1 - Optimize source selector width in t2v page ([#497](https://github.com/opensearch-project/dashboards-assistant/pull/497)) - Show error message if PPL query does not contain aggregation ([#499](https://github.com/opensearch-project/dashboards-assistant/pull/499)) - Adjust the overall style of alert summary popover ([#501](https://github.com/opensearch-project/dashboards-assistant/pull/501)) -- Add http error instruction for t2ppl task ([#502](https://github.com/opensearch-project/dashboards-assistant/pull/502)) - Change the background color, button position and text for alert summary popover ([#506](https://github.com/opensearch-project/dashboards-assistant/pull/506)) - collect metrics for when t2viz triggered([#510](https://github.com/opensearch-project/dashboards-assistant/pull/510)) - chatbot dock bottom border top([#511](https://github.com/opensearch-project/dashboards-assistant/pull/511))