Greatly simplify image generation config tools

This commit is contained in:
Alex Gleason committed 2025-12-07 22:20:05 -06:00
1 parent db2739cb77
commit 8aa04464db
2 files changed
+28 -60

No files matched your search

+20 -38
View File
@@ -26,67 +26,49 @@ export class ViewAvailableModelsTool implements Tool<Record<string, never>> {
return 'No AI models are currently available. Please configure at least one AI provider in Settings > AI.';
}
// Filter image-capable models
const filteredModels = this.models.filter(m => !m.modalities || m.modalities.includes('image'));
// Group models by provider
const modelsByProvider = new Map<string, ProviderModel[]>();
for (const model of this.models) {
for (const model of filteredModels) {
const providerModels = modelsByProvider.get(model.provider) || [];
providerModels.push(model);
modelsByProvider.set(model.provider, providerModels);
}
// Build output
let output = '# Available AI Models\n\n';
let output = '# Available Models\n\n';
// Add note about current image model if configured
if (this.currentImageModel) {
output += `**Current Image Model**: ${this.currentImageModel}\n\n`;
output += 'This indicates the user\'s current preference. When selecting a new model, consider choosing a similar provider or model family unless the user requests otherwise.\n\n';
output += `**Current Image Model**: ${this.currentImageModel} ⭐\n\n`;
} else {
output += '**Current Image Model**: Not configured\n\n';
}
output += '## Models by Provider\n\n';
if (filteredModels.length === 0) {
output += 'No models found in configured providers.\n';
output += `Total models available: ${this.models.length} (none support image generation)\n`;
return output;
}
output += `Found ${filteredModels.length} models:\n\n`;
for (const [provider, providerModels] of modelsByProvider) {
output += `### ${provider}\n\n`;
output += `### ${provider} (${providerModels.length} models)\n\n`;
for (const model of providerModels) {
const isCurrentModel = this.currentImageModel === model.fullId;
const marker = isCurrentModel ? ' ⭐ **CURRENT**' : '';
output += `- **${model.fullId}**${marker}\n`;
if (model.name && model.name !== model.id) {
output += ` - Name: ${model.name}\n`;
}
if (model.description) {
output += ` - Description: ${model.description}\n`;
}
if (model.contextLength) {
output += ` - Context Length: ${model.contextLength.toLocaleString()} tokens\n`;
}
if (model.modalities && model.modalities.length > 0) {
output += ` - Modalities: ${model.modalities.join(', ')}\n`;
// Highlight image generation capability
if (model.modalities.includes('image')) {
output += ` - ✅ **Supports image generation**\n`;
}
}
output += '\n';
const marker = isCurrentModel ? ' ⭐' : '';
output += `- ${model.fullId}${marker}\n`;
}
output += '\n';
}
output += '\n## Image Generation Recommendations\n\n';
output += 'When selecting an image model:\n';
output += '1. **Look for models with "image" in their modalities** - these support image generation\n';
output += '2. **Consider cost and quality** - Models like gpt-image-1, dall-e-3, or similar are good balanced choices\n';
output += '3. **Check the current model** (marked with ⭐) to understand user preferences\n';
output += '4. **Prefer models from the same provider** as the current model when possible\n';
if (this.currentImageModel) {
output += `Current selection (⭐) indicates user preference for this provider/model family.\n`;
}
return output;
}