@@ -30,8 +30,7 @@ import { ScreenshotAnalysisOperation } from '../operations/ScreenshotAnalysis';
3030// Database schema imports removed - using zero-storage OAuth flow
3131import { BaseSandboxService } from '../../services/sandbox/BaseSandboxService' ;
3232import { WebSocketMessageData , WebSocketMessageType } from '../../api/websocketTypes' ;
33- import { InferenceContext , AgentActionKey , ModelConfig } from '../inferutils/config.types' ;
34- import { AGENT_CONFIG , AGENT_CONSTRAINTS } from '../inferutils/config' ;
33+ import { InferenceContext , ModelConfig } from '../inferutils/config.types' ;
3534import { ModelConfigService } from '../../database/services/ModelConfigService' ;
3635import { fixProjectIssues } from '../../services/code-fixer' ;
3736import { GitVersionControl } from '../git' ;
@@ -1344,73 +1343,9 @@ export class SimpleCodeGeneratorAgent extends Agent<Env, CodeGenState> {
13441343 } ;
13451344 }
13461345
1347- /**
1348- * Get current model configurations (defaults + user overrides)
1349- * Used by WebSocket to provide configuration info to frontend
1350- */
1351- async getModelConfigsInfo ( ) {
1352- const userId = this . state . inferenceContext . userId ;
1353- if ( ! userId ) {
1354- throw new Error ( 'No user session available for model configurations' ) ;
1355- }
1356-
1357- try {
1358- const modelConfigService = new ModelConfigService ( this . env ) ;
1359-
1360- // Get all user configs
1361- const userConfigsRecord = await modelConfigService . getUserModelConfigs ( userId ) ;
1362-
1363- // Transform to match frontend interface with constraint info
1364- const agents = Object . entries ( AGENT_CONFIG ) . map ( ( [ key , config ] ) => {
1365- const constraint = AGENT_CONSTRAINTS . get ( key as AgentActionKey ) ;
1366- return {
1367- key,
1368- name : config . name ,
1369- description : config . description ,
1370- constraint : constraint ? {
1371- enabled : constraint . enabled ,
1372- allowedModels : Array . from ( constraint . allowedModels )
1373- } : undefined
1374- } ;
1375- } ) ;
1376-
1377- const userConfigs : Record < string , any > = { } ;
1378- const defaultConfigs : Record < string , any > = { } ;
1379-
1380- for ( const [ actionKey , mergedConfig ] of Object . entries ( userConfigsRecord ) ) {
1381- if ( mergedConfig . isUserOverride ) {
1382- userConfigs [ actionKey ] = {
1383- name : mergedConfig . name ,
1384- max_tokens : mergedConfig . max_tokens ,
1385- temperature : mergedConfig . temperature ,
1386- reasoning_effort : mergedConfig . reasoning_effort ,
1387- fallbackModel : mergedConfig . fallbackModel ,
1388- isUserOverride : true
1389- } ;
1390- }
1391-
1392- // Always include default config
1393- const defaultConfig = AGENT_CONFIG [ actionKey as AgentActionKey ] ;
1394- if ( defaultConfig ) {
1395- defaultConfigs [ actionKey ] = {
1396- name : defaultConfig . name ,
1397- max_tokens : defaultConfig . max_tokens ,
1398- temperature : defaultConfig . temperature ,
1399- reasoning_effort : defaultConfig . reasoning_effort ,
1400- fallbackModel : defaultConfig . fallbackModel
1401- } ;
1402- }
1403- }
1404-
1405- return {
1406- agents,
1407- userConfigs,
1408- defaultConfigs
1409- } ;
1410- } catch ( error ) {
1411- this . logger ( ) . error ( 'Error fetching model configs info:' , error ) ;
1412- throw error ;
1413- }
1346+ getModelConfigsInfo ( ) {
1347+ const modelService = new ModelConfigService ( this . env ) ;
1348+ return modelService . getModelConfigsInfo ( this . state . inferenceContext . userId ) ;
14141349 }
14151350
14161351 getTotalFiles ( ) : number {
0 commit comments