From 07b65c915d3f0d8fdf8268c6411eac7c75062e64 Mon Sep 17 00:00:00 2001 From: Keven Leone Date: Mon, 11 Nov 2024 16:49:20 +0100 Subject: [PATCH] LPD-41296 Update Json Response --- .../src/services/oauth/AIWizardContentOAuth2.ts | 16 ++++++++++++---- .../ai/content/wizard/AIRestController.java | 3 +-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-custom-element/src/services/oauth/AIWizardContentOAuth2.ts b/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-custom-element/src/services/oauth/AIWizardContentOAuth2.ts index 27c4d9b72dd02a..35bb127019893f 100644 --- a/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-custom-element/src/services/oauth/AIWizardContentOAuth2.ts +++ b/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-custom-element/src/services/oauth/AIWizardContentOAuth2.ts @@ -8,7 +8,9 @@ import OAuth2Client from './OAuth2Client'; export default class AIWizardContentOAuth2 extends OAuth2Client { constructor() { - super('liferay-aicontentwizard-etc-spring-boot-oauth-application-user-agent'); + super( + 'liferay-aicontentwizard-etc-spring-boot-oauth-application-user-agent' + ); } async deleteSetting(id: number) { @@ -35,7 +37,9 @@ export default class AIWizardContentOAuth2 extends OAuth2Client { } async getSettingsStatus(): Promise { - return this.fetch('/settings/status'); + const response = await this.fetch('/settings/status'); + + return response.json(); } async getSetting(id: string): Promise { @@ -43,13 +47,17 @@ export default class AIWizardContentOAuth2 extends OAuth2Client { } async getSettings(): Promise { - return this.fetch('/settings'); + const response = await this.fetch('/settings'); + + return response.json(); } async saveSettings(data: unknown) { - return this.fetch('/settings', { + const response = await this.fetch('/settings', { body: JSON.stringify(data), method: 'POST', }); + + return response.json(); } } diff --git a/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-etc-spring-boot/src/main/java/com/liferay/ai/content/wizard/AIRestController.java b/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-etc-spring-boot/src/main/java/com/liferay/ai/content/wizard/AIRestController.java index ec3f5a7b5364f5..f59930e49b9f5c 100644 --- a/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-etc-spring-boot/src/main/java/com/liferay/ai/content/wizard/AIRestController.java +++ b/workspaces/liferay-aicontentwizard-workspace/client-extensions/liferay-aicontentwizard-etc-spring-boot/src/main/java/com/liferay/ai/content/wizard/AIRestController.java @@ -74,8 +74,7 @@ public ResponseEntity generate(@RequestBody String json) ).tools( new AccountTools(toolsContext), new BlogPostingTools(toolsContext), new KnowledgeBaseTools(toolsContext), - new SitePageTools(toolsContext), new SiteTools(toolsContext), - new TaxonomyTools(toolsContext) + new SitePageTools(toolsContext), new SiteTools(toolsContext) ).chatMemory( MessageWindowChatMemory.withMaxMessages(10) ).build();