Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit b8d057f

Browse files
authored
Apply suggestion from @OskarStark
1 parent cc3c51a commit b8d057f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Platform/Bridge/Albert/PlatformFactory.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@ public static function create(
2222
if (!str_starts_with($baseUrl, 'https://')) {
2323
throw new InvalidArgumentException('The Albert URL must start with "https://".');
2424
}
25-
26-
$httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient);
27-
28-
// Validate that URL doesn't end with a slash
25+
2926
if (str_ends_with($baseUrl, '/')) {
3027
throw new InvalidArgumentException('The Albert URL must not end with a trailing slash.');
3128
}
3229

3330
// The base URL should include the full path to the API endpoint including version
3431
if (!preg_match('/\/v\d+$/', $baseUrl)) {
3532
throw new InvalidArgumentException('The Albert URL must include an API version (e.g., /v1, /v2).');
36-
}
33+
}
34+
35+
$httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient);
3736

3837
// Create Albert-specific model clients with custom base URL
3938
$gptClient = new GPTModelClient($httpClient, $apiKey, $baseUrl);

0 commit comments

Comments
 (0)