File size: 1,252 Bytes
9923f3d
2ab515e
9923f3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ab515e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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