Skip to content

Commit c275347

Browse files
committed
Cleanup and improvements
1 parent ded87fd commit c275347

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

docker/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ RUN git remote add upstream https://github.com/BrowserOperator/browser-operator-
5151
RUN git fetch upstream
5252
RUN git checkout upstream/main
5353

54-
# Copy our local modifications into the container
55-
COPY front_end/panels/ai_chat/core/EnvironmentConfig.ts /workspace/devtools/devtools-frontend/front_end/panels/ai_chat/core/EnvironmentConfig.ts
56-
COPY front_end/panels/ai_chat/ui/SettingsDialog.ts /workspace/devtools/devtools-frontend/front_end/panels/ai_chat/ui/SettingsDialog.ts
57-
COPY front_end/entrypoints/devtools_app/devtools_app.ts /workspace/devtools/devtools-frontend/front_end/entrypoints/devtools_app/devtools_app.ts
58-
59-
# Build Browser Operator version with our modifications
54+
# Build Browser Operator version (using upstream code to avoid TypeScript compilation issues)
55+
# Runtime API key injection will be handled by the entrypoint script
6056
RUN npm run build
6157

6258
# Production stage

front_end/panels/ai_chat/LLM/GroqProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export class GroqProvider extends LLMBaseProvider {
5454
*/
5555
private getApiKey(): string {
5656
// Constructor parameter (highest priority for backward compatibility)
57-
if (this.getApiKey() && this.getApiKey().trim() !== '') {
58-
return this.getApiKey().trim();
57+
if (this.apiKey && this.apiKey.trim() !== '') {
58+
return this.apiKey.trim();
5959
}
6060

6161
// Use environment config which handles localStorage -> build-time -> empty fallback

front_end/panels/ai_chat/LLM/OpenRouterProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,7 @@ export class OpenRouterProvider extends LLMBaseProvider {
651651

652652
logger.debug('API key check:');
653653
logger.debug('- API key exists:', !!apiKey);
654-
logger.debug('- API key length:', apiKey?.length || 0);
655-
logger.debug('- API key prefix:', apiKey?.substring(0, 8) + '...' || 'none');
654+
logger.debug('- API key presence:', apiKey ? '<redacted>' : 'none');
656655
logger.debug('- API key source:', source);
657656
logger.debug('- Build config available:', buildInfo.hasBuildConfig);
658657
logger.debug('- Build time:', buildInfo.buildTime);

front_end/panels/ai_chat/core/EnvironmentConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ export class EnvironmentConfig {
261261
return 'runtime';
262262
}
263263

264-
if (BUILD_CONFIG?.apiKeys?.[provider]) {
264+
if (typeof BUILD_CONFIG?.apiKeys?.[provider] === 'string' &&
265+
BUILD_CONFIG.apiKeys[provider].trim() !== '') {
265266
return 'build-time';
266267
}
267268

0 commit comments

Comments
 (0)