From 5cc018fe828bd21163817df46f6522fcbaad74bc Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Fri, 26 Dec 2025 08:02:29 -0800 Subject: [PATCH 1/3] fix(WatsonxAPIService): specify API version in query parameter Signed-off-by: Edward Ly --- lib/Service/WatsonxAPIService.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Service/WatsonxAPIService.php b/lib/Service/WatsonxAPIService.php index 4e7ef51f..ec870f9b 100644 --- a/lib/Service/WatsonxAPIService.php +++ b/lib/Service/WatsonxAPIService.php @@ -106,10 +106,7 @@ public function getModels(string $userId): array { try { $this->logger->debug('Actually getting watsonx.ai models with a network request'); - $params = [ - 'version' => Application::WATSONX_API_VERSION, - ]; - $modelsResponse = $this->request($userId, '/ml/v1/foundation_model_specs', $params); + $modelsResponse = $this->request($userId, '/ml/v1/foundation_model_specs?version=' . Application::WATSONX_API_VERSION); } catch (Exception $e) { $this->logger->warning('Error retrieving models (exc): ' . $e->getMessage()); $this->areCredsValid = false; From 4569404f36e678b713b39706037801add126d511 Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Fri, 26 Dec 2025 08:04:03 -0800 Subject: [PATCH 2/3] fix(WatsonxAPIService): encode parameters for IAM requests to self-hosted IBM watsonx services Signed-off-by: Edward Ly --- lib/Service/WatsonxAPIService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/WatsonxAPIService.php b/lib/Service/WatsonxAPIService.php index ec870f9b..1e4787c5 100644 --- a/lib/Service/WatsonxAPIService.php +++ b/lib/Service/WatsonxAPIService.php @@ -768,7 +768,7 @@ public function requestIAM(array $params = [], string $method = 'POST'): array { $paramsContent = http_build_query($params); $url .= '?' . $paramsContent; } else { - $options['body'] = $params; + $options['body'] = $this->watsonxSettingsService->isUsingIbmCloud() ? $params : json_encode($params); } } From d1af5f9748748947c5b3caa9ed77edb9a2bbfe9e Mon Sep 17 00:00:00 2001 From: Edward Ly Date: Fri, 26 Dec 2025 08:09:28 -0800 Subject: [PATCH 3/3] fix(AdminSettings): specify API version in query parameter Signed-off-by: Edward Ly --- src/components/AdminSettings.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue index 3c73670e..24759e21 100644 --- a/src/components/AdminSettings.vue +++ b/src/components/AdminSettings.vue @@ -410,6 +410,7 @@ import { confirmPassword } from '@nextcloud/password-confirmation' import { generateUrl } from '@nextcloud/router' import debounce from 'debounce' +const API_VERSION = '2024-03-14' const DEFAULT_MODEL_ITEM = { id: 'Default', value: 'Default', label: 'Default' } export default { @@ -452,9 +453,9 @@ export default { computed: { modelEndpointUrl() { if (this.state.url === '') { - return 'https://us-south.ml.cloud.ibm.com/ml/v1/foundation_model_specs' + return 'https://us-south.ml.cloud.ibm.com/ml/v1/foundation_model_specs?version=' + API_VERSION } - return this.state.url.replace(/\/*$/, '/ml/v1/foundation_model_specs') + return this.state.url.replace(/\/*$/, '/ml/v1/foundation_model_specs?version=' + API_VERSION) }, configured() { return !!this.state.api_key && (this.isUsingIbmCloud || !!this.state.username)