Skip to content

Commit

Permalink
rm logs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Oct 25, 2024
1 parent 693f2c0 commit ac0ad4d
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,13 @@ export const createConversation = async ({
refresh: 'wait_for',
});

console.log('===> response', response);
const createdConversation = await getConversation({
esClient,
conversationIndex,
id: response._id,
logger,
user,
});
console.log('===> getConversation', getConversation);
return createdConversation;
} catch (err) {
logger.error(`Error creating conversation: ${err} with title: ${conversation.title}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,15 @@ export function createResourceInstallationHelper(
const { result: commonInitResult, error: commonInitError } = await commonInitPromise;
if (commonInitResult) {
await installFn(namespace, timeoutMs);
console.log('===> installer case 1');
return successResult();
} else {
logger.warn(
`Common resources were not initialized, cannot initialize resources for ${namespace}`
);
console.log('===> installer case 2');
return errorResult(commonInitError);
}
} catch (err) {
logger.error(`Error initializing resources ${namespace} - ${err.message}`);
console.log('===> installer case 3');
return errorResult(err.message);
}
};
Expand Down Expand Up @@ -119,7 +116,6 @@ export function createResourceInstallationHelper(
return errorResult(`Unrecognized spaceId ${key}`);
}
const initializationState = await initializedResources.get(key);
console.log('===> initializationState promise', initializationState);
return initializationState ?? errorResult(`Initialize state returned undefined`);
} catch (e) {
return errorResult(`Initialize resources encountered an error: ${e.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export class AIAssistantService {
private async initializeResources(): Promise<InitializationPromise> {
this.isInitializing = true;
try {
console.trace('===> initializeResources');
this.options.logger.debug(`Initializing resources for AIAssistantService`);
const esClient = await this.options.elasticsearchClientPromise;

Expand Down Expand Up @@ -287,7 +286,6 @@ export class AIAssistantService {
const { result: initialized, error } = await this.getSpaceResourcesInitializationPromise(
opts.spaceId
);
console.log('===> checkResourcesInstallation', { initialized, error });

// If space level resources initialization failed, retry
if (!initialized && error) {
Expand Down Expand Up @@ -333,7 +331,6 @@ export class AIAssistantService {
opts: CreateAIAssistantClientParams
): Promise<AIAssistantConversationsDataClient | null> {
const res = await this.checkResourcesInstallation(opts);
console.log('===> conversations data client resources check', res);

if (res === null) {
return null;
Expand Down Expand Up @@ -422,7 +419,6 @@ export class AIAssistantService {
opts: CreateAIAssistantClientParams
): Promise<AIAssistantDataClient | null> {
const res = await this.checkResourcesInstallation(opts);
console.log('===> res createAIAssistantPromptsDataClient', res);

if (res === null) {
return null;
Expand Down Expand Up @@ -463,7 +459,6 @@ export class AIAssistantService {
const result = await this.resourceInitializationHelper.getInitializedResources(spaceId);
// If the spaceId is unrecognized and spaceId is not the default, we
// need to kick off resource installation and return the promise
console.log('===> getSpaceResourcesInitializationPromise', result);
if (
result.error &&
result.error.includes(`Unrecognized spaceId`) &&
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/elastic_assistant/server/routes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,6 @@ export const performChecks = ({
const assistantResponse = buildResponse(response);

if (license) {
console.log('===> create license', context.licensing.license);
if (!hasAIAssistantLicense(context.licensing.license)) {
return response.forbidden({
body: {
Expand All @@ -605,7 +604,6 @@ export const performChecks = ({
}

if (authenticatedUser) {
console.log('===> getCurrentUser', context.elasticAssistant.getCurrentUser());
if (context.elasticAssistant.getCurrentUser() == null) {
return assistantResponse.error({
body: `Authenticated user not found`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
try {
const ctx = await context.resolve(['core', 'elasticAssistant', 'licensing']);
const license = ctx.licensing.license;
console.log('===> bulk license', license);
if (!hasAIAssistantLicense(license)) {
return response.forbidden({
body: {
Expand All @@ -174,7 +173,6 @@ export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
});
}
const dataClient = await ctx.elasticAssistant.getAIAssistantPromptsDataClient();
console.log('===> bulk dataClient', dataClient);

if (body.create && body.create.length > 0) {
const result = await dataClient?.findDocuments<EsPromptsSchema>({
Expand All @@ -196,7 +194,6 @@ export const bulkPromptsRoute = (router: ElasticAssistantPluginRouter, logger: L
}

const writer = await dataClient?.getWriter();
console.log('===> writer', writer);
const changedAt = new Date().toISOString();
const {
errors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ export const createConversationRoute = (router: ElasticAssistantPluginRouter): v
request,
response,
});
console.log('===> checkResponse', checkResponse);

if (checkResponse) {
return checkResponse;
}
const dataClient = await ctx.elasticAssistant.getAIAssistantConversationsDataClient();
console.log('===> create dataClient', dataClient);

const createdConversation = await dataClient?.createConversation({
conversation: request.body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ export const AssistantProvider: FC<PropsWithChildren<unknown>> = ({ children })
const hasEnterpriseLicence = licenseService.isEnterprise();
useEffect(() => {
const migrateConversationsFromLocalStorage = once(async () => {
console.log('conversations useEffect', {
hasEnterpriseLicence,
assistantAvailability,
});
if (
hasEnterpriseLicence &&
assistantAvailability.isAssistantEnabled &&
Expand All @@ -182,10 +178,6 @@ export const AssistantProvider: FC<PropsWithChildren<unknown>> = ({ children })

useEffect(() => {
const createSecurityPrompts = once(async () => {
console.log('prompts useEffect', {
hasEnterpriseLicence,
assistantAvailability,
});
if (
hasEnterpriseLicence &&
assistantAvailability.isAssistantEnabled &&
Expand Down

0 comments on commit ac0ad4d

Please sign in to comment.