Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tools/ui/src/lib/stores/models.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ class ModelsStore {
model: modelId,
description: details?.description,
capabilities: rawCapabilities.filter((value: unknown): value is string => Boolean(value)),
modalities: this.buildArchitectureModalities(item.architecture),
details: details?.details,
meta: item.meta ?? null,
parsedId: ModelsService.parseModelId(modelId),
Expand Down Expand Up @@ -1000,6 +1001,21 @@ class ModelsStore {
};
}

/** Map the router modalities, the only source available while a model is not loaded. */
private buildArchitectureModalities(
architecture: ApiModelDataEntry['architecture']
): ModelModalities | undefined {
if (!architecture) return undefined;

const inputs = architecture.input_modalities;

return {
vision: inputs.includes('image'),
audio: inputs.includes('audio'),
video: inputs.includes('video')
Comment thread
ServeurpersoCom marked this conversation as resolved.
Outdated
};
}

clear(): void {
this.unsubscribeStatus();
this.statusWaiters.forEach((waiter) => waiter.reject(new Error('Models store cleared')));
Expand Down
11 changes: 11 additions & 0 deletions tools/ui/src/lib/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,21 @@ export interface ApiModelDataEntry {
aliases?: string[];
/** Informational tags for this model */
tags?: string[];
/** Modality capabilities, reported by the router for every model regardless of load state */
architecture?: ApiModelArchitecture;
/** Legacy meta field (may be present in older responses) */
meta?: Record<string, unknown> | null;
}

/**
* Modality capabilities of a model, as advertised by the ROUTER /models endpoint.
* Read from the model manifest, so it is available before the model is loaded.
*/
export interface ApiModelArchitecture {
/** Accepted input modalities, always contains "text" */
input_modalities: string[];
}

/**
* Load stage reported by the /models/sse feed, in load order.
*/
Expand Down
Loading