Skip to content

Commit

Permalink
Update model.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ZTH7 authored Jul 25, 2024
1 parent 5c04d3c commit c4334d4
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions app/utils/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,13 @@ export function collectModelTableWithDefaultModel(
) {
let modelTable = collectModelTable(models, customModels);
if (defaultModel && defaultModel !== "") {
const [modelName, providerName] = defaultModel.split("@");
if (providerName && providerName != "") {
modelTable[defaultModel] = {
...modelTable[defaultModel],
name: modelTable[defaultModel]?.name ?? modelName,
displayName:
modelTable[defaultModel]?.displayName ??
modelName + "(" + providerName + ")",
available: true,
isDefault: true,
};
if (defaultModel.includes('@')) {
if (defaultModel in modelTable) {
modelTable[defaultModel].isDefault = true;
}
} else {
for (const key of Object.keys(modelTable)) {
if (modelTable[key].available && key.startsWith(modelName)) {
if (modelTable[key].available && key.split('@').shift() == defaultModel) {
modelTable[key].isDefault = true;
break;
}
Expand Down

0 comments on commit c4334d4

Please sign in to comment.