Update claude explain configuration (#8069)

This commit is contained in:
Matt Godbolt
2025-08-27 11:35:35 -05:00
committed by GitHub
parent 74a7611f3e
commit b213c9a781
4 changed files with 6 additions and 4 deletions

View File

@@ -73,6 +73,8 @@ function setupClaudeExplainEnvironment() {
// Set up configuration
cy.visit('/', {
onBeforeLoad: (win: any) => {
// TODO remove this when we make claude explain generally available.
win.localStorage.setItem('claudeExplainTest', 'enabled');
stubConsoleOutput(win);
win.compilerExplorerOptions = win.compilerExplorerOptions || {};
win.compilerExplorerOptions.explainApiEndpoint = 'http://test.localhost/fake-api/explain';

View File

@@ -18,6 +18,7 @@ rescanCompilerSecs=3600
sentryDsn=https://8e4614f649ad4e3faf3e7e8827b935f9@sentry.io/102028
motdUrl=/motd/motd-prod.json
pageloadUrl=https://lambda.compiler-explorer.com/pageload
explainApiEndpoint=https://api.compiler-explorer.com/explain
storageSolution=s3
healthCheckFilePath=/efs/.health
showSponsors=true

View File

@@ -3,6 +3,3 @@ httpRoot=/beta
storageSolution=s3
motdUrl=/motd/motd-beta.json
sentryEnvironment=beta
# Claude Explain API endpoint, for beta
explainApiEndpoint=https://api.compiler-explorer.com/explain

View File

@@ -52,6 +52,7 @@ import * as Components from '../components.js';
import {createDragSource} from '../components.js';
import {Hub} from '../hub.js';
import * as LibUtils from '../lib-utils.js';
import {localStorage} from '../local.js';
import * as monacoConfig from '../monaco-config.js';
import {LanguageLibs} from '../options.interfaces.js';
import {options} from '../options.js';
@@ -971,7 +972,8 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
this.initToolButtons();
// Hide Claude Explain button if no API endpoint is configured
if (!options.explainApiEndpoint) {
// Or, temporarily, unless the user has manually opted in. TODO fix up the hack in UI tests too when we turn on.
if (!options.explainApiEndpoint || localStorage.get('claudeExplainTest', '') !== 'enabled') {
this.explainButton.hide();
}
}