Skip to content

Commit

Permalink
Merge pull request #472 from reorproject/improve-chat-input
Browse files Browse the repository at this point in the history
Improve chat input
  • Loading branch information
samlhuillier authored Nov 10, 2024
2 parents fd1cb7c + 5985f4f commit 1500024
Show file tree
Hide file tree
Showing 21 changed files with 807 additions and 515 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ release
data
binaries
.env

# Sentry Config File
.env.sentry-build-plugin
6 changes: 6 additions & 0 deletions electron/main/llm/ipcHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const ollamaService = new OllamaService()
export const registerLLMSessionHandlers = (store: Store<StoreSchema>) => {
ipcMain.handle('set-default-llm', (event, modelName: string) => {
store.set(StoreKeys.DefaultLLM, modelName)
event.sender.send('llm-configs-changed')
})

ipcMain.handle('get-default-llm-name', () => store.get(StoreKeys.DefaultLLM))
Expand All @@ -22,24 +23,29 @@ export const registerLLMSessionHandlers = (store: Store<StoreSchema>) => {

ipcMain.handle('add-or-update-llm-config', async (event, llmConfig: LLMConfig) => {
await addOrUpdateLLMInStore(store, llmConfig)
event.sender.send('llm-configs-changed')
})

ipcMain.handle('add-or-update-llm-api-config', async (event, llmAPIConfig: LLMAPIConfig) => {
await addOrUpdateLLMAPIInStore(store, llmAPIConfig)
event.sender.send('llm-configs-changed')
})

ipcMain.handle('remove-llm', async (event, modelNameToDelete: string) => {
await removeLLM(store, ollamaService, modelNameToDelete)
event.sender.send('llm-configs-changed')
})

ipcMain.handle('pull-ollama-model', async (event, modelName: string) => {
const handleProgress = (progress: ProgressResponse) => {
event.sender.send('ollamaDownloadProgress', modelName, progress)
}
await ollamaService.pullModel(modelName, handleProgress)
event.sender.send('llm-configs-changed')
})

ipcMain.handle('delete-llm', async (event, modelName: string) => {
await ollamaService.deleteModel(modelName)
event.sender.send('llm-configs-changed')
})
}
Loading

0 comments on commit 1500024

Please sign in to comment.