nn-ui-v2 / build /server /chunks /LlmUtilsBackend-nsn9ZGUB.js
muryshev's picture
update
2ab515e
import { d as private_env } from './shared-server-49TKSBDM.js';
import { U as USE_PREDEFINED_LLM_LIST, L as LLM_LIST } from './constants-PEBBwOxo.js';
const getDefaultLlm = () => {
const list = getLlmList();
if (list === null) {
return null;
}
return findLlmInList(list);
};
const getLlmList = () => {
if (private_env.LLM_LIST_OVERRIDE) {
try {
return JSON.parse(private_env.LLM_LIST_OVERRIDE);
} catch (e) {
console.error("Malformed JSON in LLM_LIST_OVERRIDE environment variable.");
return null;
}
}
const listKey = private_env.USE_PREDEFINED_LLM_LIST || USE_PREDEFINED_LLM_LIST;
return listKey ? LLM_LIST[listKey] : null;
};
const getLlmParams = (llmName) => {
const llmList = getLlmList();
return llmList ? findLlmInList(llmList, llmName) : null;
};
const findLlmInList = (llmList, llmName) => {
if (llmName) {
const filtered = llmList.filter((o) => o.name === llmName);
if (filtered.length > 0) {
return filtered[0];
}
}
const filteredDefault = llmList.filter((o) => o.default);
return filteredDefault.length > 0 ? filteredDefault[0] : null;
};
export { getLlmParams as a, getLlmList as b, getDefaultLlm as g };
//# sourceMappingURL=LlmUtilsBackend-nsn9ZGUB.js.map