MCPcopy Index your code
hub / github.com/ChatGPTNextWeb/NextChat / collectModelTableWithDefaultModel

Function collectModelTableWithDefaultModel

app/utils/model.ts:138–162  ·  view source on GitHub ↗
(
  models: readonly LLMModel[],
  customModels: string,
  defaultModel: string,
)

Source from the content-addressed store, hash-verified

136}
137
138export function collectModelTableWithDefaultModel(
139 models: readonly LLMModel[],
140 customModels: string,
141 defaultModel: string,
142) {
143 let modelTable = collectModelTable(models, customModels);
144 if (defaultModel && defaultModel !== "") {
145 if (defaultModel.includes("@")) {
146 if (defaultModel in modelTable) {
147 modelTable[defaultModel].isDefault = true;
148 }
149 } else {
150 for (const key of Object.keys(modelTable)) {
151 if (
152 modelTable[key].available &&
153 getModelProvider(key)[0] == defaultModel
154 ) {
155 modelTable[key].isDefault = true;
156 break;
157 }
158 }
159 }
160 }
161 return modelTable;
162}
163
164/**
165 * Generate full model table.

Callers 1

Calls 2

collectModelTableFunction · 0.85
getModelProviderFunction · 0.85

Tested by

no test coverage detected