diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index a8199a1..e19575f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1,7 @@ contact_links: - - name: OpenSearch Community Support - url: https://discuss.opendistrocommunity.dev/ - about: Please ask and answer questions here. - - name: AWS/Amazon Security - url: https://aws.amazon.com/security/vulnerability-reporting/ - about: Please report security vulnerabilities here. \ No newline at end of file + - name: Anubhav Gain + url: https://www.linkedin.com/in/anubhavgain/ + about: A DevSecOps Engineer. + - name: Hriday Sheth + url: https://www.linkedin.com/in/hridaysheth/ + about: Official maintainer of this Ai based Chat Bot. diff --git a/public/components/__tests__/chat_window_header_title.test.tsx b/public/components/__tests__/chat_window_header_title.test.tsx index ec3ece9..218f1b6 100644 --- a/public/components/__tests__/chat_window_header_title.test.tsx +++ b/public/components/__tests__/chat_window_header_title.test.tsx @@ -197,11 +197,11 @@ describe('', () => { expect(renderResult.getByRole('button', { name: 'Save to notebook' })).toBeDisabled(); }); - it('should show "OpenSearch Assistant" when conversationId is undefined', async () => { + it('should show "OpenArmor Assistant" when conversationId is undefined', async () => { const { renderResult } = setup({ conversationId: undefined, }); - expect(renderResult.getByText('OpenSearch Assistant')).toBeInTheDocument(); + expect(renderResult.getByText('OpenArmor Assistant')).toBeInTheDocument(); }); }); diff --git a/public/components/chat_welcome_message.tsx b/public/components/chat_welcome_message.tsx index 4fed0b2..71fce79 100644 --- a/public/components/chat_welcome_message.tsx +++ b/public/components/chat_welcome_message.tsx @@ -20,11 +20,11 @@ export const WelcomeMessage = (props: Props) => { titleSize="s" body={ -

Welcome{usernamePlaceHolder}to the OpenSearch Assistant!

+

Welcome{usernamePlaceHolder}to the OpenArmor Assistant!

I can help you analyze data, create visualizations, and get other insights.

How can I help?

- The OpenSearch Assistant may produce inaccurate information. Verify all information + The OpenArmor Assistant may produce inaccurate information. Verify all information before using it in any environment or workload.
diff --git a/public/components/chat_window_header_title.tsx b/public/components/chat_window_header_title.tsx index 316f4bf..7003364 100644 --- a/public/components/chat_window_header_title.tsx +++ b/public/components/chat_window_header_title.tsx @@ -29,7 +29,7 @@ export const ChatWindowHeaderTitle = React.memo(() => { const [isSaveNotebookModalOpen, setSaveNotebookModalOpen] = useState(false); const { chatState } = useChatState(); const { saveChat } = useSaveChat(); - const displayTitle = chatContext.conversationId ? chatContext.title : 'OpenSearch Assistant'; + const displayTitle = chatContext.conversationId ? chatContext.title : 'OpenArmor Assistant'; const onButtonClick = useCallback(() => { setPopoverOpen((flag) => !flag); diff --git a/public/components/incontext_insight/index.tsx b/public/components/incontext_insight/index.tsx index 736d17d..2b86746 100644 --- a/public/components/incontext_insight/index.tsx +++ b/public/components/incontext_insight/index.tsx @@ -174,7 +174,7 @@ export const IncontextInsight = ({ children }: IncontextInsightProps) => { ); - const GeneratePopoverBody: React.FC<{}> = ({}) => ( + const GeneratePopoverBody: React.FC<{}> = ({ }) => ( toasts.addDanger('To be implemented...')}>Generate summary ); @@ -195,7 +195,7 @@ export const IncontextInsight = ({ children }: IncontextInsightProps) => { ); - const ChatPopoverBody: React.FC<{}> = ({}) => ( + const ChatPopoverBody: React.FC<{}> = ({ }) => ( @@ -286,7 +286,7 @@ export const IncontextInsight = ({ children }: IncontextInsightProps) => {
{i18n.translate('assistantDashboards.incontextInsight.assistant', { - defaultMessage: 'OpenSearch Assistant', + defaultMessage: 'OpenArmor Assistant', })}
diff --git a/public/components/invite_message.tsx b/public/components/invite_message.tsx index 55258e2..655529c 100644 --- a/public/components/invite_message.tsx +++ b/public/components/invite_message.tsx @@ -9,7 +9,7 @@ import React from 'react'; export const InviteMessage: React.FC = () => { // using https://mailtolinkgenerator.com/ const mailtoLink = - 'mailto:opensearch-assistant@amazon.com?subject=Requesting%20invite%20to%20OpenSearch%20Assistant%20Playground'; + 'mailto:openarmor-assistant@theopenarmor.org?subject=Requesting%20invite%20to%20OpenSearch%20Assistant%20Playground'; return ( {

To request access, please send an email to{' '} - opensearch-assistant@amazon.com + opensearch-assistant@theopenarmor.org .

diff --git a/public/tabs/__tests__/chat_window_header.test.tsx b/public/tabs/__tests__/chat_window_header.test.tsx index 5c527ef..3b738b6 100644 --- a/public/tabs/__tests__/chat_window_header.test.tsx +++ b/public/tabs/__tests__/chat_window_header.test.tsx @@ -12,7 +12,7 @@ import { TabId } from '../../types'; import { SIDECAR_DOCKED_MODE } from '../../../../../src/core/public'; jest.mock('../../components/chat_window_header_title', () => { - return { ChatWindowHeaderTitle: () =>
OpenSearch Assistant
}; + return { ChatWindowHeaderTitle: () =>
OpenArmor Assistant
}; }); const setup = ({ selectedTabId }: { selectedTabId?: TabId } = {}) => { @@ -40,7 +40,7 @@ describe('', () => { it('should render title, history, setSidecarMode and close button', () => { const { renderResult } = setup(); - expect(renderResult.getByText('OpenSearch Assistant')).toBeInTheDocument(); + expect(renderResult.getByText('OpenArmor Assistant')).toBeInTheDocument(); expect(renderResult.getByLabelText('history')).toBeInTheDocument(); expect(renderResult.getByLabelText('setSidecarMode')).toBeInTheDocument(); expect(renderResult.getByLabelText('close')).toBeInTheDocument(); diff --git a/public/utils/notebook.ts b/public/utils/notebook.ts index 8a1af29..e471467 100644 --- a/public/utils/notebook.ts +++ b/public/utils/notebook.ts @@ -3,40 +3,40 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { v4 as uuid } from 'uuid'; -import { htmlIdGenerator } from '@elastic/eui'; -import { IMessage } from '../../common/types/chat_saved_object_attributes'; +import { v4 as uuid } from "uuid"; +import { htmlIdGenerator } from "@elastic/eui"; +import { IMessage } from "../../common/types/chat_saved_object_attributes"; const buildBasicGraph = () => ({ - id: 'paragraph_' + uuid(), + id: "paragraph_" + uuid(), dateCreated: new Date().toISOString(), dateModified: new Date().toISOString(), input: { - inputText: '', - inputType: '', + inputText: "", + inputType: "", }, - output: [{ result: '', outputType: '', execution_time: '0 ms' }], + output: [{ result: "", outputType: "", execution_time: "0 ms" }], }); -const ASSISTANT_MESSAGE_PREFIX = 'OpenSearch Assistant: '; +const ASSISTANT_MESSAGE_PREFIX = "OpenArmor Assistant: "; const createDashboardVizObject = (objectId: string) => { const vizUniqueId = htmlIdGenerator()(); // a dashboard container object for new visualization const basicVizObject = { - viewMode: 'view', + viewMode: "view", panels: { - '1': { + "1": { gridData: { x: 0, y: 0, w: 50, h: 20, - i: '1', + i: "1", }, - type: 'visualization', + type: "visualization", explicitInput: { - id: '1', + id: "1", savedObjectId: objectId, }, }, @@ -47,13 +47,13 @@ const createDashboardVizObject = (objectId: string) => { id: vizUniqueId, timeRange: { // We support last 15minutes here to keep consistent with chat bot preview. - to: 'now', - from: 'now-15m', + to: "now", + from: "now-15m", }, - title: 'embed_viz_' + vizUniqueId, + title: "embed_viz_" + vizUniqueId, query: { - query: '', - language: 'lucene', + query: "", + language: "lucene", }, refreshConfig: { pause: true, @@ -63,30 +63,33 @@ const createDashboardVizObject = (objectId: string) => { return basicVizObject; }; -export const convertMessagesToParagraphs = (messages: IMessage[], username?: string) => { - const userMessagePrefix = username ? `${username}: ` : 'User: '; +export const convertMessagesToParagraphs = ( + messages: IMessage[], + username?: string +) => { + const userMessagePrefix = username ? `${username}: ` : "User: "; return messages.map((message: IMessage) => { const paragraph = buildBasicGraph(); switch (message.contentType) { // markdown,text and error are all text formatted in notebook. - case 'markdown': - case 'text': - case 'error': + case "markdown": + case "text": + case "error": const messageText = // markdown and error represents assistant, text represents user. - message.contentType === 'text' + message.contentType === "text" ? userMessagePrefix + message.content : ASSISTANT_MESSAGE_PREFIX + message.content; Object.assign(paragraph, { - input: { inputText: `%md\n${messageText}`, inputType: 'MARKDOWN' }, + input: { inputText: `%md\n${messageText}`, inputType: "MARKDOWN" }, output: [ { result: messageText, - outputType: 'MARKDOWN', - execution_time: '0 ms', + outputType: "MARKDOWN", + execution_time: "0 ms", }, ], }); @@ -95,30 +98,32 @@ export const convertMessagesToParagraphs = (messages: IMessage[], username?: str /** * TODO migrate ppl_data_grid logic to dashboards-observerability */ - case 'ppl_data_grid': + case "ppl_data_grid": const queryText = message.content; Object.assign(paragraph, { - input: { inputText: `%ppl\n${queryText}`, inputType: 'MARKDOWN' }, + input: { inputText: `%ppl\n${queryText}`, inputType: "MARKDOWN" }, output: [ { result: `\n${queryText}`, - outputType: 'QUERY', - execution_time: '0 ms', + outputType: "QUERY", + execution_time: "0 ms", }, ], }); break; - case 'visualization': + case "visualization": const visualizationObjectId = message.content; - const inputText = JSON.stringify(createDashboardVizObject(visualizationObjectId)); + const inputText = JSON.stringify( + createDashboardVizObject(visualizationObjectId) + ); Object.assign(paragraph, { - input: { inputText, inputType: 'VISUALIZATION' }, + input: { inputText, inputType: "VISUALIZATION" }, output: [ { - result: '', - outputType: 'VISUALIZATION', - execution_time: '0 ms', + result: "", + outputType: "VISUALIZATION", + execution_time: "0 ms", }, ], }); diff --git a/public/utils/tests/notebook.test.ts b/public/utils/tests/notebook.test.ts index ae023ee..70dde51 100644 --- a/public/utils/tests/notebook.test.ts +++ b/public/utils/tests/notebook.test.ts @@ -3,27 +3,30 @@ * SPDX-License-Identifier: Apache-2.0 */ -import * as uuidExports from 'uuid'; -import { convertMessagesToParagraphs } from '../notebook'; +import * as uuidExports from "uuid"; +import { convertMessagesToParagraphs } from "../notebook"; -jest.mock('uuid', () => ({ - ...jest.requireActual('uuid'), +jest.mock("uuid", () => ({ + ...jest.requireActual("uuid"), __esModule: true, })); -describe('notebook convertMessagesToParagraphs utils', () => { +describe("notebook convertMessagesToParagraphs utils", () => { beforeAll(() => { jest.useFakeTimers(); jest.setSystemTime(new Date(2023, 11, 26)); - jest.spyOn(uuidExports, 'v4').mockReturnValue('a-fixed-uuid'); + jest.spyOn(uuidExports, "v4").mockReturnValue("a-fixed-uuid"); }); afterAll(() => { jest.useRealTimers(); - jest.spyOn(uuidExports, 'v4').mockRestore(); + jest.spyOn(uuidExports, "v4").mockRestore(); }); - it('should return consistent paragraphs if contentType is text', () => { + it("should return consistent paragraphs if contentType is text", () => { expect( - convertMessagesToParagraphs([{ type: 'input', contentType: 'text', content: 'bar' }], 'foo') + convertMessagesToParagraphs( + [{ type: "input", contentType: "text", content: "bar" }], + "foo" + ) ).toMatchInlineSnapshot(` Array [ Object { @@ -47,11 +50,11 @@ describe('notebook convertMessagesToParagraphs utils', () => { `); }); - it('should return consistent paragraphs if contentType is markdown', () => { + it("should return consistent paragraphs if contentType is markdown", () => { expect( convertMessagesToParagraphs( - [{ type: 'output', contentType: 'markdown', content: 'bar' }], - 'foo' + [{ type: "output", contentType: "markdown", content: "bar" }], + "foo" ) ).toMatchInlineSnapshot(` Array [ @@ -61,14 +64,14 @@ describe('notebook convertMessagesToParagraphs utils', () => { "id": "paragraph_a-fixed-uuid", "input": Object { "inputText": "%md - OpenSearch Assistant: bar", + OpenArmor Assistant: bar", "inputType": "MARKDOWN", }, "output": Array [ Object { "execution_time": "0 ms", "outputType": "MARKDOWN", - "result": "OpenSearch Assistant: bar", + "result": "OpenArmor Assistant: bar", }, ], }, @@ -76,9 +79,12 @@ describe('notebook convertMessagesToParagraphs utils', () => { `); }); - it('should return consistent paragraphs if contentType is error', () => { + it("should return consistent paragraphs if contentType is error", () => { expect( - convertMessagesToParagraphs([{ type: 'output', contentType: 'error', content: 'bar' }], 'foo') + convertMessagesToParagraphs( + [{ type: "output", contentType: "error", content: "bar" }], + "foo" + ) ).toMatchInlineSnapshot(` Array [ Object { @@ -87,14 +93,14 @@ describe('notebook convertMessagesToParagraphs utils', () => { "id": "paragraph_a-fixed-uuid", "input": Object { "inputText": "%md - OpenSearch Assistant: bar", + OpenArmor Assistant: bar", "inputType": "MARKDOWN", }, "output": Array [ Object { "execution_time": "0 ms", "outputType": "MARKDOWN", - "result": "OpenSearch Assistant: bar", + "result": "OpenArmor Assistant: bar", }, ], }, @@ -102,11 +108,11 @@ describe('notebook convertMessagesToParagraphs utils', () => { `); }); - it('should return consistent paragraphs if contentType is visualization', () => { + it("should return consistent paragraphs if contentType is visualization", () => { expect( convertMessagesToParagraphs( - [{ type: 'output', contentType: 'visualization', content: 'bar' }], - 'foo' + [{ type: "output", contentType: "visualization", content: "bar" }], + "foo" ) ).toMatchInlineSnapshot(` Array [ @@ -130,11 +136,11 @@ describe('notebook convertMessagesToParagraphs utils', () => { `); }); - it('should return consistent paragraphs if contentType is not supported', () => { + it("should return consistent paragraphs if contentType is not supported", () => { expect( convertMessagesToParagraphs( - [{ type: 'output', contentType: 'not-supported', content: 'bar' }], - 'foo' + [{ type: "output", contentType: "not-supported", content: "bar" }], + "foo" ) ).toMatchInlineSnapshot(` Array [