Commit 71728fa5 authored by ali's avatar ali

feat: llm websocket 重写成 llm loop post

parent 19dfc9af
...@@ -118,17 +118,22 @@ export default class IPCs { ...@@ -118,17 +118,22 @@ export default class IPCs {
static initializeChildWindow(window: BrowserWindow) { static initializeChildWindow(window: BrowserWindow) {
ipcMain.on('fileUpload', async (event, path: string) => { ipcMain.on('fileUpload', async (event, path: string) => {
const content = IPCs.readFile(path)
const formData = new FormData() try {
const blob = new Blob([content], { type: 'audio/wav' }) const content = IPCs.readFile(path)
formData.append('file', blob) const formData = new FormData()
const response = await http({ const blob = new Blob([content], { type: 'audio/wav' })
url: 'https://beta.laihua.com/api/upload/file', formData.append('file', blob)
method: 'POST', const response = await http({
data: formData url: 'https://beta.laihua.com/api/upload/file',
}) method: 'POST',
data: formData
window.webContents.send('msgReceivedFileUploadResponse', response) })
window.webContents.send('msgReceivedFileUploadResponse', response)
} catch (error) {
window.webContents.send('msgReceivedFileUploadResponse', { code: 500, message: JSON.stringify(error) })
}
}) })
} }
} }
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment