Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
mlAnomalyDetection: `${ELASTIC_DOCS}explore-analyze/machine-learning/anomaly-detection`,
},
detectionEngineOverview: `${ELASTIC_DOCS}solutions/security/detect-and-alert`,
// TODO: Follow-up PR for creating an aiAssistant category adding all relevant doc links
aiAssistant: `${ELASTIC_DOCS}solutions/security/ai/ai-assistant`,
aiAssistantKnowledgeBaseIndexEntries: `${ELASTIC_DOCS}solutions/security/ai/ai-assistant-knowledge-base#knowledge-base-add-knowledge-index`,
signalsMigrationApi: isServerless
? `${KIBANA_APIS}group/endpoint-security-detections-api`
: `${KIBANA_SERVERLESS_APIS}group/endpoint-security-detections-api`,
Expand Down
1 change: 1 addition & 0 deletions src/platform/packages/shared/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ export interface DocLinks {
};
readonly securitySolution: {
readonly aiAssistant: string;
readonly aiAssistantKnowledgeBaseIndexEntries: string;
readonly cloudSecurityPosture: string;
readonly installElasticDefend: string;
readonly artifactControl: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export const ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_ENTRIES_URL_FIND =
export const ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_ENTRIES_URL_BULK_ACTION =
`${ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_ENTRIES_URL}/_bulk_action` as const;

export const ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_INDICES_URL =
`${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/knowledge_base/_indices` as const;
export const ELASTIC_AI_ASSISTANT_EVALUATE_URL =
`${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/evaluate` as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export * from './actions_connector/post_actions_connector_execute_route.gen';

// Knowledge Base Schemas
export * from './knowledge_base/crud_kb_route.gen';
export * from './knowledge_base/get_knowledge_base_indices_route.gen';
export * from './knowledge_base/entries/bulk_crud_knowledge_base_entries_route.gen';
export * from './knowledge_base/entries/common_attributes.gen';
export * from './knowledge_base/entries/crud_knowledge_base_entries_route.gen';
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { HttpSetup } from '@kbn/core-http-browser';

import { getKnowledgeBaseIndices, getKnowledgeBaseStatus, postKnowledgeBase } from './api';
import { getKnowledgeBaseStatus, postKnowledgeBase } from './api';
import { API_VERSIONS } from '@kbn/spaces-plugin/common';

jest.mock('@kbn/core-http-browser');
Expand Down Expand Up @@ -73,29 +73,4 @@ describe('API tests', () => {
await expect(postKnowledgeBase(knowledgeBaseArgs)).rejects.toThrowError('simulated error');
});
});

describe('getKnowledgeBaseIndices', () => {
it('calls the knowledge base API when correct resource path', async () => {
await getKnowledgeBaseIndices({ http: mockHttp });

expect(mockHttp.fetch).toHaveBeenCalledWith(
'/internal/elastic_assistant/knowledge_base/_indices',
{
method: 'GET',
signal: undefined,
version: '1',
}
);
});
it('returns error when error is an error', async () => {
const error = 'simulated error';
(mockHttp.fetch as jest.Mock).mockImplementation(() => {
throw new Error(error);
});

await expect(getKnowledgeBaseIndices({ http: mockHttp })).resolves.toThrowError(
'simulated error'
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
API_VERSIONS,
CreateKnowledgeBaseRequestParams,
CreateKnowledgeBaseResponse,
ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_INDICES_URL,
ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_URL,
GetKnowledgeBaseIndicesResponse,
ReadKnowledgeBaseRequestParams,
ReadKnowledgeBaseResponse,
} from '@kbn/elastic-assistant-common';
Expand Down Expand Up @@ -76,32 +74,3 @@ export const postKnowledgeBase = async ({

return response as CreateKnowledgeBaseResponse;
};

/**
* API call for getting indices that have fields of `semantic_text` type.
*
* @param {Object} options - The options object.
* @param {HttpSetup} options.http - HttpSetup
* @param {AbortSignal} [options.signal] - AbortSignal
*
* @returns {Promise<GetKnowledgeBaseIndicesResponse | IHttpFetchError>}
*/
export const getKnowledgeBaseIndices = async ({
http,
signal,
}: {
http: HttpSetup;
signal?: AbortSignal | undefined;
}): Promise<GetKnowledgeBaseIndicesResponse | IHttpFetchError> => {
try {
const response = await http.fetch(ELASTIC_AI_ASSISTANT_KNOWLEDGE_BASE_INDICES_URL, {
method: 'GET',
signal,
version: API_VERSIONS.internal.v1,
});

return response as GetKnowledgeBaseIndicesResponse;
} catch (error) {
return error as IHttpFetchError;
}
};

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { MOCK_QUICK_PROMPTS } from '../../mock/quick_prompt';
import { AssistantSpaceIdProvider, useAssistantContext } from '../../..';
import { I18nProvider } from '@kbn/i18n-react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useKnowledgeBaseIndices } from '../../assistant/api/knowledge_base/use_knowledge_base_indices';
import { Router } from '@kbn/shared-ux-router';
import { createMemoryHistory, History } from 'history';

Expand All @@ -46,7 +45,6 @@ jest.mock('../../assistant/api/knowledge_base/entries/use_update_knowledge_base_
jest.mock('../../assistant/api/knowledge_base/entries/use_delete_knowledge_base_entries');

jest.mock('../../assistant/settings/use_settings_updater/use_knowledge_base_updater');
jest.mock('../../assistant/api/knowledge_base/use_knowledge_base_indices');
jest.mock('../../assistant/api/knowledge_base/use_knowledge_base_status');
jest.mock('../../assistant/api/knowledge_base/entries/use_knowledge_base_entries');
jest.mock(
Expand Down Expand Up @@ -162,9 +160,6 @@ describe('KnowledgeBaseSettingsManagement', () => {
},
isFetched: true,
});
(useKnowledgeBaseIndices as jest.Mock).mockReturnValue({
data: { indices: ['index-1', 'index-2'] },
});
(useKnowledgeBaseEntries as jest.Mock).mockReturnValue({
data: { data: mockData },
isFetching: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const KnowledgeBaseSettingsManagement: React.FC<Params> = React.memo(({ d
const {
assistantAvailability: { hasManageGlobalKnowledgeBase, isAssistantEnabled },
assistantTelemetry,
docLinks,
http,
knowledgeBase,
setKnowledgeBase,
Expand Down Expand Up @@ -429,14 +430,14 @@ export const KnowledgeBaseSettingsManagement: React.FC<Params> = React.memo(({ d
/>
) : (
<IndexEntryEditor
http={http}
entry={selectedEntry as IndexEntry}
originalEntry={originalEntry as IndexEntry}
dataViews={dataViews}
setEntry={
setSelectedEntry as React.Dispatch<React.SetStateAction<Partial<IndexEntry>>>
}
hasManageGlobalKnowledgeBase={hasManageGlobalKnowledgeBase}
docLink={docLinks.links.securitySolution.aiAssistantKnowledgeBaseIndexEntries}
/>
)}
</>
Expand Down
Loading