File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -593,12 +593,17 @@ public function getImageRequestOptions(?string $userId): array {
593
593
],
594
594
];
595
595
596
- $ useBasicAuth = $ this ->openAiSettingsService ->getUseBasicAuth ();
597
- if ($ useBasicAuth && !$ this ->isUsingOpenAi ()) {
598
- $ basicUser = $ this ->openAiSettingsService ->getUserBasicUser ($ userId , true );
599
- $ basicPassword = $ this ->openAiSettingsService ->getUserBasicPassword ($ userId , true );
600
- if ($ basicUser !== '' && $ basicPassword !== '' ) {
601
- $ requestOptions ['headers ' ]['Authorization ' ] = 'Basic ' . base64_encode ($ basicUser . ': ' . $ basicPassword );
596
+ if (!$ this ->isUsingOpenAi ()) {
597
+ $ useBasicAuth = $ this ->openAiSettingsService ->getUseBasicAuth ();
598
+ if ($ useBasicAuth ) {
599
+ $ basicUser = $ this ->openAiSettingsService ->getUserBasicUser ($ userId , true );
600
+ $ basicPassword = $ this ->openAiSettingsService ->getUserBasicPassword ($ userId , true );
601
+ if ($ basicUser !== '' && $ basicPassword !== '' ) {
602
+ $ requestOptions ['headers ' ]['Authorization ' ] = 'Basic ' . base64_encode ($ basicUser . ': ' . $ basicPassword );
603
+ }
604
+ } else {
605
+ $ apiKey = $ this ->openAiSettingsService ->getUserApiKey ($ userId , true );
606
+ $ requestOptions ['headers ' ]['Authorization ' ] = 'Bearer ' . $ apiKey ;
602
607
}
603
608
}
604
609
return $ requestOptions ;
You can’t perform that action at this time.
0 commit comments