MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / loadAuthProfiles

Function loadAuthProfiles

packages/config/src/auth-profiles.ts:32–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 * 加载 auth-profiles.json
31 */
32export function loadAuthProfiles(): AuthProfilesData {
33 const filePath = getAuthProfilesPath()
34 if (!fs.existsSync(filePath)) {
35 return { version: 1, profiles: {} }
36 }
37
38 try {
39 const content = fs.readFileSync(filePath, 'utf-8')
40 const data = JSON.parse(content) as AuthProfilesData
41 if (!data.profiles || typeof data.profiles !== 'object') {
42 return { version: 1, profiles: {} }
43 }
44 return data
45 } catch {
46 return { version: 1, profiles: {} }
47 }
48}
49
50/**
51 * 按 profile 名称获取 API Key

Callers 5

getApiKeyByProfileFunction · 0.85
getApiKeyByProviderFunction · 0.85
writeAuthProfileFunction · 0.85
deleteAuthProfileFunction · 0.85

Calls 2

getAuthProfilesPathFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected