mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
dedup image models (#2475)
This commit is contained in:
@@ -176,9 +176,18 @@ export class AIImageGenerationService extends BaseService {
|
||||
}
|
||||
|
||||
models () {
|
||||
const seen = new Set<string>();
|
||||
return Object.entries(this.#modelIdMap)
|
||||
.map(([_, models]) => models)
|
||||
.flat()
|
||||
.filter(model => {
|
||||
const identity = `${model.provider}:${model.puterId || model.id}`;
|
||||
if ( seen.has(identity) ) {
|
||||
return false;
|
||||
}
|
||||
seen.add(identity);
|
||||
return true;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
if ( a.provider === b.provider ) {
|
||||
return a.id.localeCompare(b.id);
|
||||
|
||||
Reference in New Issue
Block a user