Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 2 additions & 5 deletions lib/Service/WatsonxAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -771,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);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/components/AdminSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down