mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[8.15] [Security AI Assistant] Changing chat related internal APIs to become public (#188139) (#188260)
# Backport This will backport the following commits from `main` to `8.15`: - [[Security AI Assistant] Changing chat related internal APIs to become public (#188139)](https://github.com/elastic/kibana/pull/188139) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Yuliia Naumenko","email":"jo.naumenko@gmail.com"},"sourceCommit":{"committedDate":"2024-07-12T19:23:09Z","message":"[Security AI Assistant] Changing chat related internal APIs to become public (#188139)\n\n## Summary\r\n\r\nIn this PR Security Gen AI related APIs are changed from internal to\r\npublic.\r\n\r\nConversations APIs:\r\n- POST/PUT/GET/DELETE\r\n`\"/api/security_ai_assistant/current_user/conversations/{id}\"`\r\n- GET `\"/api/security_ai_assistant/current_user/conversations/_find\"`\r\n\r\nPrompts APIs:\r\n\r\n- POST `\"/api/security_ai_assistant/prompts/_bulk_action\"`\r\n- GET `\"/api/security_ai_assistant/current_user/conversations/_find\"`\r\n\r\nAnonymization APIs:\r\n\r\n- POST `\"/api/security_ai_assistant/anonymization_fields/_bulk_action\"`\r\n- GET `\"/api/security_ai_assistant/anonymization_fields/_find\"`","sha":"1d5cf48a9700ee769f64256c23278fcfd8cecc5d","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v8.15.0","v8.16.0"],"title":"[Security AI Assistant] Changing chat related internal APIs to become public","number":188139,"url":"https://github.com/elastic/kibana/pull/188139","mergeCommit":{"message":"[Security AI Assistant] Changing chat related internal APIs to become public (#188139)\n\n## Summary\r\n\r\nIn this PR Security Gen AI related APIs are changed from internal to\r\npublic.\r\n\r\nConversations APIs:\r\n- POST/PUT/GET/DELETE\r\n`\"/api/security_ai_assistant/current_user/conversations/{id}\"`\r\n- GET `\"/api/security_ai_assistant/current_user/conversations/_find\"`\r\n\r\nPrompts APIs:\r\n\r\n- POST `\"/api/security_ai_assistant/prompts/_bulk_action\"`\r\n- GET `\"/api/security_ai_assistant/current_user/conversations/_find\"`\r\n\r\nAnonymization APIs:\r\n\r\n- POST `\"/api/security_ai_assistant/anonymization_fields/_bulk_action\"`\r\n- GET `\"/api/security_ai_assistant/anonymization_fields/_find\"`","sha":"1d5cf48a9700ee769f64256c23278fcfd8cecc5d"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/188139","number":188139,"mergeCommit":{"message":"[Security AI Assistant] Changing chat related internal APIs to become public (#188139)\n\n## Summary\r\n\r\nIn this PR Security Gen AI related APIs are changed from internal to\r\npublic.\r\n\r\nConversations APIs:\r\n- POST/PUT/GET/DELETE\r\n`\"/api/security_ai_assistant/current_user/conversations/{id}\"`\r\n- GET `\"/api/security_ai_assistant/current_user/conversations/_find\"`\r\n\r\nPrompts APIs:\r\n\r\n- POST `\"/api/security_ai_assistant/prompts/_bulk_action\"`\r\n- GET `\"/api/security_ai_assistant/current_user/conversations/_find\"`\r\n\r\nAnonymization APIs:\r\n\r\n- POST `\"/api/security_ai_assistant/anonymization_fields/_bulk_action\"`\r\n- GET `\"/api/security_ai_assistant/anonymization_fields/_find\"`","sha":"1d5cf48a9700ee769f64256c23278fcfd8cecc5d"}}]}] BACKPORT--> Co-authored-by: Yuliia Naumenko <jo.naumenko@gmail.com>
This commit is contained in:
parent
c37905cab9
commit
bc5b5da7fd
22 changed files with 55 additions and 53 deletions
|
@ -10,20 +10,22 @@ export const ELASTIC_AI_ASSISTANT_INTERNAL_API_VERSION = '1';
|
|||
export const ELASTIC_AI_ASSISTANT_URL = '/api/security_ai_assistant';
|
||||
export const ELASTIC_AI_ASSISTANT_INTERNAL_URL = '/internal/elastic_assistant';
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/current_user/conversations`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL = `${ELASTIC_AI_ASSISTANT_URL}/current_user/conversations`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/{id}`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID_MESSAGES = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID}/messages`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_INTERNAL_CONVERSATIONS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/current_user/conversations`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID_MESSAGES = `${ELASTIC_AI_ASSISTANT_INTERNAL_CONVERSATIONS_URL}/{id}/messages`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_CHAT_COMPLETE_URL = `${ELASTIC_AI_ASSISTANT_URL}/chat/complete`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_INTERNAL_CONVERSATIONS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND = `${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/_find`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/prompts`;
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL = `${ELASTIC_AI_ASSISTANT_URL}/prompts`;
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_PROMPTS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND = `${ELASTIC_AI_ASSISTANT_PROMPTS_URL}/_find`;
|
||||
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL = `${ELASTIC_AI_ASSISTANT_INTERNAL_URL}/anonymization_fields`;
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL = `${ELASTIC_AI_ASSISTANT_URL}/anonymization_fields`;
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION = `${ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL}/_bulk_action`;
|
||||
export const ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND = `${ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL}/_find`;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('bulkUpdateAnonymizationFields', () => {
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify({
|
||||
create: [],
|
||||
update: [],
|
||||
|
@ -71,7 +71,7 @@ describe('bulkUpdateAnonymizationFields', () => {
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify({
|
||||
create: [anonymizationField1, anonymizationField2],
|
||||
update: [],
|
||||
|
@ -93,7 +93,7 @@ describe('bulkUpdateAnonymizationFields', () => {
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify({
|
||||
update: [anonymizationField1, anonymizationField2],
|
||||
delete: { ids: [] },
|
||||
|
|
|
@ -26,7 +26,7 @@ export const bulkUpdateAnonymizationFields = async (
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify(anonymizationFieldsActions),
|
||||
}
|
||||
);
|
||||
|
|
|
@ -45,14 +45,14 @@ describe('useFetchAnonymizationFields', () => {
|
|||
const { waitForNextUpdate } = renderHook(() => useFetchAnonymizationFields());
|
||||
await waitForNextUpdate();
|
||||
expect(http.fetch).toHaveBeenCalledWith(
|
||||
'/internal/elastic_assistant/anonymization_fields/_find',
|
||||
'/api/security_ai_assistant/anonymization_fields/_find',
|
||||
{
|
||||
method: 'GET',
|
||||
query: {
|
||||
page: 1,
|
||||
per_page: 1000,
|
||||
},
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal: undefined,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -36,7 +36,7 @@ export const CACHING_KEYS = [
|
|||
ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND,
|
||||
QUERY.page,
|
||||
QUERY.per_page,
|
||||
API_VERSIONS.internal.v1,
|
||||
API_VERSIONS.public.v1,
|
||||
];
|
||||
|
||||
export const useFetchAnonymizationFields = (payload?: UseFetchAnonymizationFieldsParams) => {
|
||||
|
@ -50,7 +50,7 @@ export const useFetchAnonymizationFields = (payload?: UseFetchAnonymizationField
|
|||
async () =>
|
||||
http.fetch(ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
query: QUERY,
|
||||
signal: payload?.signal,
|
||||
}),
|
||||
|
|
|
@ -36,11 +36,11 @@ describe('conversations api', () => {
|
|||
await waitForNextUpdate();
|
||||
|
||||
expect(deleteProps.http.fetch).toHaveBeenCalledWith(
|
||||
'/internal/elastic_assistant/current_user/conversations/test',
|
||||
'/api/security_ai_assistant/current_user/conversations/test',
|
||||
{
|
||||
method: 'DELETE',
|
||||
signal: undefined,
|
||||
version: '1',
|
||||
version: '2023-10-31',
|
||||
}
|
||||
);
|
||||
expect(toasts.addError).not.toHaveBeenCalled();
|
||||
|
@ -62,11 +62,11 @@ describe('conversations api', () => {
|
|||
await waitForNextUpdate();
|
||||
|
||||
expect(getProps.http.fetch).toHaveBeenCalledWith(
|
||||
'/internal/elastic_assistant/current_user/conversations/test',
|
||||
'/api/security_ai_assistant/current_user/conversations/test',
|
||||
{
|
||||
method: 'GET',
|
||||
signal: undefined,
|
||||
version: '1',
|
||||
version: '2023-10-31',
|
||||
}
|
||||
);
|
||||
expect(toasts.addError).not.toHaveBeenCalled();
|
||||
|
|
|
@ -44,7 +44,7 @@ export const getConversationById = async ({
|
|||
try {
|
||||
const response = await http.fetch(`${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/${id}`, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal,
|
||||
});
|
||||
|
||||
|
@ -84,7 +84,7 @@ export const getUserConversations = async ({
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
|
||||
{
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
@ -125,7 +125,7 @@ export const createConversation = async ({
|
|||
try {
|
||||
const response = await http.post(ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL, {
|
||||
body: JSON.stringify(conversation),
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal,
|
||||
});
|
||||
|
||||
|
@ -168,7 +168,7 @@ export const deleteConversation = async ({
|
|||
try {
|
||||
const response = await http.fetch(`${ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL}/${id}`, {
|
||||
method: 'DELETE',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal,
|
||||
});
|
||||
|
||||
|
@ -237,7 +237,7 @@ export const updateConversation = async ({
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -47,14 +47,14 @@ describe('useFetchCurrentUserConversations', () => {
|
|||
);
|
||||
await waitForNextUpdate();
|
||||
expect(defaultProps.http.fetch).toHaveBeenCalledWith(
|
||||
'/internal/elastic_assistant/current_user/conversations/_find',
|
||||
'/api/security_ai_assistant/current_user/conversations/_find',
|
||||
{
|
||||
method: 'GET',
|
||||
query: {
|
||||
page: 1,
|
||||
perPage: 100,
|
||||
},
|
||||
version: '1',
|
||||
version: '2023-10-31',
|
||||
signal: undefined,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -47,7 +47,7 @@ export const CONVERSATIONS_QUERY_KEYS = [
|
|||
ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
|
||||
query.page,
|
||||
query.perPage,
|
||||
API_VERSIONS.internal.v1,
|
||||
API_VERSIONS.public.v1,
|
||||
];
|
||||
|
||||
export const useFetchCurrentUserConversations = ({
|
||||
|
@ -62,7 +62,7 @@ export const useFetchCurrentUserConversations = ({
|
|||
async () =>
|
||||
http.fetch<FetchConversationsResponse>(ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
query,
|
||||
signal,
|
||||
}),
|
||||
|
|
|
@ -49,7 +49,7 @@ describe('bulkUpdatePrompts', () => {
|
|||
|
||||
expect(httpMock.fetch).toHaveBeenCalledWith(ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION, {
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify({
|
||||
create: [],
|
||||
update: [],
|
||||
|
@ -69,7 +69,7 @@ describe('bulkUpdatePrompts', () => {
|
|||
|
||||
expect(httpMock.fetch).toHaveBeenCalledWith(ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION, {
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify({
|
||||
create: [prompt1, prompt2],
|
||||
update: [],
|
||||
|
@ -88,7 +88,7 @@ describe('bulkUpdatePrompts', () => {
|
|||
|
||||
expect(httpMock.fetch).toHaveBeenCalledWith(ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION, {
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify({
|
||||
update: [prompt1, prompt2],
|
||||
delete: { ids: [] },
|
||||
|
|
|
@ -26,7 +26,7 @@ export const bulkUpdatePrompts = async (
|
|||
ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION,
|
||||
{
|
||||
method: 'POST',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
body: JSON.stringify(prompts),
|
||||
}
|
||||
);
|
||||
|
|
|
@ -44,14 +44,14 @@ describe('useFetchPrompts', () => {
|
|||
await act(async () => {
|
||||
const { waitForNextUpdate } = renderHook(() => useFetchPrompts());
|
||||
await waitForNextUpdate();
|
||||
expect(http.fetch).toHaveBeenCalledWith('/internal/elastic_assistant/prompts/_find', {
|
||||
expect(http.fetch).toHaveBeenCalledWith('/api/security_ai_assistant/prompts/_find', {
|
||||
method: 'GET',
|
||||
query: {
|
||||
page: 1,
|
||||
per_page: 1000,
|
||||
filter: 'consumer:*',
|
||||
},
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal: undefined,
|
||||
});
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ export const useFetchPrompts = (payload?: UseFetchPromptsParams) => {
|
|||
QUERY.page,
|
||||
QUERY.per_page,
|
||||
QUERY.filter,
|
||||
API_VERSIONS.internal.v1,
|
||||
API_VERSIONS.public.v1,
|
||||
];
|
||||
|
||||
return useQuery<FindPromptsResponse, unknown, FindPromptsResponse>(
|
||||
|
@ -52,7 +52,7 @@ export const useFetchPrompts = (payload?: UseFetchPromptsParams) => {
|
|||
async () =>
|
||||
http.fetch(ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
query: QUERY,
|
||||
signal: payload?.signal,
|
||||
}),
|
||||
|
@ -87,7 +87,7 @@ export const getPrompts = async ({
|
|||
try {
|
||||
return await http.fetch<FindPromptsResponse>(ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND, {
|
||||
method: 'GET',
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
signal,
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
|
@ -118,7 +118,7 @@ export const bulkActionAnonymizationFieldsRoute = (
|
|||
) => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_BULK_ACTION,
|
||||
options: {
|
||||
tags: ['access:securitySolution-updateAIAssistantAnonymization'],
|
||||
|
@ -129,7 +129,7 @@ export const bulkActionAnonymizationFieldsRoute = (
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(PerformBulkActionRequestBody),
|
||||
|
|
|
@ -30,7 +30,7 @@ export const findAnonymizationFieldsRoute = (
|
|||
) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_ANONYMIZATION_FIELDS_URL_FIND,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -38,7 +38,7 @@ export const findAnonymizationFieldsRoute = (
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
query: buildRouteValidationWithZod(FindAnonymizationFieldsRequestQuery),
|
||||
|
|
|
@ -112,7 +112,7 @@ const buildBulkResponse = (
|
|||
export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: Logger) => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_PROMPTS_URL_BULK_ACTION,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -123,7 +123,7 @@ export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(PerformBulkActionRequestBody),
|
||||
|
|
|
@ -23,7 +23,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const findPromptsRoute = (router: ElasticAssistantPluginRouter, logger: Logger) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_PROMPTS_URL_FIND,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -31,7 +31,7 @@ export const findPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
query: buildRouteValidationWithZod(FindPromptsRequestQuery),
|
||||
|
|
|
@ -21,7 +21,7 @@ import { performChecks } from '../helpers';
|
|||
export const createConversationRoute = (router: ElasticAssistantPluginRouter): void => {
|
||||
router.versioned
|
||||
.post({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL,
|
||||
|
||||
options: {
|
||||
|
@ -30,7 +30,7 @@ export const createConversationRoute = (router: ElasticAssistantPluginRouter): v
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(ConversationCreateProps),
|
||||
|
|
|
@ -19,7 +19,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const deleteConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.delete({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -27,7 +27,7 @@ export const deleteConversationRoute = (router: ElasticAssistantPluginRouter) =>
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
params: buildRouteValidationWithZod(DeleteConversationRequestParams),
|
||||
|
|
|
@ -26,7 +26,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const findUserConversationsRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_FIND,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -34,7 +34,7 @@ export const findUserConversationsRoute = (router: ElasticAssistantPluginRouter)
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
query: buildRouteValidationWithZod(FindConversationsRequestQuery),
|
||||
|
|
|
@ -21,7 +21,7 @@ import { UPGRADE_LICENSE_MESSAGE, hasAIAssistantLicense } from '../helpers';
|
|||
export const readConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -29,7 +29,7 @@ export const readConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
params: buildRouteValidationWithZod(ReadConversationRequestParams),
|
||||
|
|
|
@ -24,7 +24,7 @@ import { performChecks } from '../helpers';
|
|||
export const updateConversationRoute = (router: ElasticAssistantPluginRouter) => {
|
||||
router.versioned
|
||||
.put({
|
||||
access: 'internal',
|
||||
access: 'public',
|
||||
path: ELASTIC_AI_ASSISTANT_CONVERSATIONS_URL_BY_ID,
|
||||
options: {
|
||||
tags: ['access:elasticAssistant'],
|
||||
|
@ -32,7 +32,7 @@ export const updateConversationRoute = (router: ElasticAssistantPluginRouter) =>
|
|||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: API_VERSIONS.internal.v1,
|
||||
version: API_VERSIONS.public.v1,
|
||||
validate: {
|
||||
request: {
|
||||
body: buildRouteValidationWithZod(ConversationUpdateProps),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue