MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / loadStore

Method loadStore

packages/node-runtime/src/ai/llm-config-store.ts:102–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 }
101
102 loadStore(): AIConfigStore {
103 const store = this.storage.readJson<AIConfigStore>('llm-config')
104 if (!store) {
105 return { configs: [], defaultAssistant: null, fastModel: null }
106 }
107
108 this.onStoreLoaded?.(store.configs)
109
110 const resolvedConfigs = this.resolveApiKey
111 ? store.configs.map((config) => {
112 const profileKey = this.resolveApiKey!(
113 config.provider,
114 (config as unknown as Record<string, unknown>).authProfile as string | undefined
115 )
116 return { ...config, apiKey: profileKey || config.apiKey || '' }
117 })
118 : store.configs
119
120 return {
121 ...store,
122 configs: resolvedConfigs,
123 defaultAssistant: resolveSlot(store.defaultAssistant, resolvedConfigs),
124 fastModel: resolveSlot(store.fastModel, resolvedConfigs),
125 }
126 }
127
128 saveStore(store: AIConfigStore): void {
129 this.storage.writeJson<AIConfigStore>('llm-config', {

Callers 12

getAllConfigsMethod · 0.95
getFastModelSlotMethod · 0.95
getFastModelConfigMethod · 0.95
getConfigByIdMethod · 0.95
addConfigMethod · 0.95
updateConfigMethod · 0.95
deleteConfigMethod · 0.95
setFastModelMethod · 0.95
registerAiLlmRoutesFunction · 0.80

Calls 2

readJsonMethod · 0.80
resolveSlotFunction · 0.70

Tested by

no test coverage detected