Skip to content

Fix: Follow override image gen service URL#352

Merged
julien-nc merged 3 commits intomainfrom
fix/noid/image-retrieval-auth
Mar 15, 2026
Merged

Fix: Follow override image gen service URL#352
julien-nc merged 3 commits intomainfrom
fix/noid/image-retrieval-auth

Conversation

@julien-nc
Copy link
Copy Markdown
Member

@julien-nc julien-nc commented Mar 4, 2026

  • to determine if we are using OpenAI (fixes the default toggle value)
  • to get the credentials when retrieving the images

Remaining issue for later: The user-defined credentials will be ignored if an admin overrides the image gen service URL.

@julien-nc julien-nc added bug Something isn't working 3. to review labels Mar 4, 2026
@julien-nc julien-nc force-pushed the fix/noid/image-retrieval-auth branch from e469e15 to 6579eaa Compare March 4, 2026 15:55
Copy link
Copy Markdown
Member

@lukasdotcom lukasdotcom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than one small thing. Nice catch on getIsImageRetrievalAuthenticated.

public function getImageRequestOptions(?string $userId): array {
$timeout = $this->openAiSettingsService->getRequestTimeout();
$requestOptions = [
'timeout' => $timeout,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout should always have some value. When ImageRetrieval isn't authenticated timeout will not be defined.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the last commit.

…are using OpenAI (fixes the default toggle value) and to get the credentials when retrieving the images

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…om a URL

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the fix/noid/image-retrieval-auth branch from 6579eaa to d4ed807 Compare March 12, 2026 09:40
@julien-nc julien-nc requested a review from lukasdotcom March 12, 2026 09:40
@julien-nc julien-nc force-pushed the fix/noid/image-retrieval-auth branch 3 times, most recently from f682d33 to d28bace Compare March 12, 2026 15:55
…ing them which can break scoping if there actually is an update (the pkg is reinstalled and not scoped anymore)

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the fix/noid/image-retrieval-auth branch from d28bace to 5501ca1 Compare March 12, 2026 16:49
@julien-nc
Copy link
Copy Markdown
Member Author

@marcelklehr It took me a while to figure out the psalm issue in this PR. With no change related with composer pkgs, psalm started to fail. It did not find the getid3 classes anymore. They were not scoped in the CI but everything was fine locally. This was actually because the steps we run in the psalm-matrix action triggered an upgrade of james-heinrich/getid3 "after" running php-scoper.

Wdyt about the fix? (last commit) It prevents upgrading pkgs as a side effect of running composer require SOMETHING like we do in the CI (we run composer require --dev roave/security-advisories:dev-latest). composer require is an update operation which triggers the post-update-cmd.

"grep -r 'OCA\\\\OpenAi\\\\Vendor' ./vendor || vendor/bin/php-scoper add-prefix --prefix='OCA\\OpenAi\\Vendor' --output-dir=\".\" --working-dir=\"./vendor/\" -f --config=\"../scoper.inc.php\"",
"composer dump-autoload",
"composer update --no-scripts"
"composer install --no-scripts"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 We should also do this in integration_replicate, I think

@julien-nc julien-nc merged commit 14eda14 into main Mar 15, 2026
27 checks passed
@julien-nc julien-nc deleted the fix/noid/image-retrieval-auth branch March 15, 2026 15:30
@lukasdotcom lukasdotcom mentioned this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants