Support the model "type" property

This commit is contained in:
Alex Gleason committed 2025-12-07 23:56:56 -06:00
1 parent 0b076d2114
commit 465364ffc0
4 files changed
+25 -4

No files matched your search

+3 -2
View File
@@ -69,9 +69,10 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps)
// Also filter to only show text models (modalities absent or includes "text")
const providerModels = selectedProvider
? models.filter(model =>
model.provider === selectedProvider.id &&
model.provider === selectedProvider.id &&
model.type !== 'image' &&
(!model.modalities || model.modalities.includes('text'))
)
)
: [];
// Filter models by search query
+14 -1
View File
@@ -198,7 +198,20 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
const providerModel = models.find(m => m.fullId === settings.imageModel);
// Determine mode: 'chat' if model supports image output modality, otherwise 'image'
const mode = providerModel?.modalities?.includes('image') ? 'chat' : 'image';
let mode: 'chat' | 'image' = 'image';
if (providerModel?.type) {
switch (providerModel.type) {
case 'chat':
mode = 'chat';
break;
case 'image':
mode = 'image';
break;
}
} else if (providerModel?.modalities?.includes('image')) {
mode = 'chat';
}
tools.generate_image = new GenerateImageTool(
fs,
+6
View File
@@ -8,6 +8,7 @@ import { createAIClient } from '@/lib/ai-client';
interface ProviderModel {
id: string;
type?: "chat" | "image";
name?: string;
provider: string;
fullId: string; // provider/model format
@@ -21,6 +22,7 @@ interface ProviderModel {
/** Output/completion pricing per token */
completion: Decimal;
};
/** For "chat" type models - which output modalities are supported */
modalities?: string[];
}
@@ -65,6 +67,10 @@ export function useProviderModels(): ModelFetchResult {
fullId: `${provider.id}/${model.id}`,
};
if ('type' in model && (model.type === 'chat' || model.type === 'image')) {
providerModel.type = model.type;
}
if ('name' in model && typeof model.name === 'string') {
providerModel.name = model.name;
}
+2 -1
View File
@@ -3,6 +3,7 @@ import type { Tool } from './Tool';
interface ProviderModel {
id: string;
type?: 'chat' | 'image';
name?: string;
provider: string;
fullId: string;
@@ -27,7 +28,7 @@ export class ViewAvailableModelsTool implements Tool<Record<string, never>> {
}
// Filter image-capable models
const filteredModels = this.models.filter(m => !m.modalities || m.modalities.includes('image'));
const filteredModels = this.models.filter(m => m.type !== 'image' && (!m.modalities || m.modalities.includes('image')));
// Group models by provider
const modelsByProvider = new Map<string, ProviderModel[]>();