Skip to content

Commit

Permalink
fix user enabled models
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jan 9, 2025
1 parent ccbfe90 commit 46e260a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/database/repositories/aiInfra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,16 @@ export class AiInfraRepos {
.map<EnabledAiModel & { enabled?: boolean | null }>((item) => {
const user = allModels.find((m) => m.id === item.id && m.providerId === provider.id);

const enabled = !!user ? user.enabled : item.enabled;
const sort = !!user ? user.sort : undefined;
const displayName = !!user ? user.displayName : item.displayName;

return {
...item,
abilities: item.abilities || {},
displayName,
enabled,
abilities: !!user ? user.abilities : item.abilities || {},
config: !!user ? user.config : item.config,
contextWindowTokens: !!user ? user.contextWindowTokens : item.contextWindowTokens,
displayName: !!user ? user.displayName : item.displayName,
enabled: !!user ? user.enabled : item.enabled,
id: item.id,
providerId: provider.id,
sort,
sort: !!user ? user.sort : undefined,
type: item.type,
};
})
.filter((i) => i.enabled);
Expand Down

0 comments on commit 46e260a

Please sign in to comment.