Skip to content

Commit

Permalink
fix: should show init error
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jul 8, 2024
1 parent b58508c commit 939f2cd
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/lib/init-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,30 @@ export function initTools(userConfig: any) {
if (initialized) return

initialized = true
const promptsFunc = new AIPromptsFunc(AIPromptsName, {dbPath: ':memory:', initDir: userConfig.promptsDir})
try {
const promptsFunc = new AIPromptsFunc(AIPromptsName, {dbPath: ':memory:', initDir: userConfig.promptsDir})

ServerTools.register(promptsFunc)
ServerTools.register(llm)
llamaCpp.register()
llm.setCurrentProvider(LlamaCppProviderName)
ServerTools.register(promptsFunc)
ServerTools.register(llm)
llamaCpp.register()
llm.setCurrentProvider(LlamaCppProviderName)

// the event-bus for server
ResServerTools.register(event)
backendEventable(ResServerTools)
ResServerTools.register(download)
// the event-bus for server
ResServerTools.register(event)
backendEventable(ResServerTools)
ResServerTools.register(download)

if (userConfig.brainDir) {
const brainsFunc = new LlmModelsFunc(BRAINS_FUNC_NAME, {rootDir: userConfig.brainDir, dbPath: '.brainsdb'})
ResServerTools.register(brainsFunc)
// brainsFunc.updateDBFromDir()
}
if (userConfig.brainDir) {
const brainsFunc = new LlmModelsFunc(BRAINS_FUNC_NAME, {rootDir: userConfig.brainDir, dbPath: '.brainsdb'})
ResServerTools.register(brainsFunc)
// brainsFunc.updateDBFromDir()
}

if (userConfig.apiUrl) {
llamaCpp.apiUrl = userConfig.apiUrl
if (userConfig.apiUrl) {
llamaCpp.apiUrl = userConfig.apiUrl
}
} catch (err) {
console.error('🚀 ~ initTools ~ err:', err)
throw err
}
}

0 comments on commit 939f2cd

Please sign in to comment.