revert: remove maxTokens update functionality from init
This functionality was out of scope for the Claude Code provider PR. The automatic updating of maxTokens values in config.json during initialization is a general improvement that should be in a separate PR. Additionally, Claude Code ignores maxTokens and temperature parameters anyway, making this change irrelevant for the Claude Code integration. Removed: - scripts/modules/update-config-tokens.js - Import and usage in scripts/init.js
This commit is contained in:
committed by
Ralph Khreish
parent
9995075093
commit
30b895be2c
@@ -28,7 +28,6 @@ import {
|
|||||||
convertAllRulesToProfileRules,
|
convertAllRulesToProfileRules,
|
||||||
getRulesProfile
|
getRulesProfile
|
||||||
} from '../src/utils/rule-transformer.js';
|
} from '../src/utils/rule-transformer.js';
|
||||||
import { updateConfigMaxTokens } from './modules/update-config-tokens.js';
|
|
||||||
|
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import {
|
import {
|
||||||
@@ -508,14 +507,6 @@ function createProjectStructure(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update config.json with correct maxTokens values from supported-models.json
|
|
||||||
const configPath = path.join(targetDir, TASKMASTER_CONFIG_FILE);
|
|
||||||
if (updateConfigMaxTokens(configPath)) {
|
|
||||||
log('info', 'Updated config with correct maxTokens values');
|
|
||||||
} else {
|
|
||||||
log('warn', 'Could not update maxTokens in config');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy .gitignore
|
// Copy .gitignore
|
||||||
copyTemplateFile('gitignore', path.join(targetDir, GITIGNORE_FILE));
|
copyTemplateFile('gitignore', path.join(targetDir, GITIGNORE_FILE));
|
||||||
|
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
/**
|
|
||||||
* update-config-tokens.js
|
|
||||||
* Updates config.json with correct maxTokens values from supported-models.json
|
|
||||||
*/
|
|
||||||
|
|
||||||
import fs from 'fs';
|
|
||||||
import path from 'path';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import { dirname } from 'path';
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = dirname(__filename);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the config file with correct maxTokens values from supported-models.json
|
|
||||||
* @param {string} configPath - Path to the config.json file to update
|
|
||||||
* @returns {boolean} True if successful, false otherwise
|
|
||||||
*/
|
|
||||||
export function updateConfigMaxTokens(configPath) {
|
|
||||||
try {
|
|
||||||
// Load supported models
|
|
||||||
const supportedModelsPath = path.join(__dirname, 'supported-models.json');
|
|
||||||
const supportedModels = JSON.parse(
|
|
||||||
fs.readFileSync(supportedModelsPath, 'utf-8')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Load config
|
|
||||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
||||||
|
|
||||||
// Update each role's maxTokens if the model exists in supported-models.json
|
|
||||||
const roles = ['main', 'research', 'fallback'];
|
|
||||||
|
|
||||||
for (const role of roles) {
|
|
||||||
if (config.models && config.models[role]) {
|
|
||||||
const provider = config.models[role].provider;
|
|
||||||
const modelId = config.models[role].modelId;
|
|
||||||
|
|
||||||
// Find the model in supported models
|
|
||||||
if (supportedModels[provider]) {
|
|
||||||
const modelData = supportedModels[provider].find(
|
|
||||||
(m) => m.id === modelId
|
|
||||||
);
|
|
||||||
if (modelData && modelData.max_tokens) {
|
|
||||||
config.models[role].maxTokens = modelData.max_tokens;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write back the updated config
|
|
||||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error updating config maxTokens:', error.message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user