mirror of
https://github.com/HeyPuter/puter.git
synced 2026-10-08 04:42:35 +00:00
dedup image models (#2475)
This commit is contained in:
1 parent
5cd731db3d
commit
b209a94a80
1 file changed
+9
@@ -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