auto-git:
[add] dist/assets/index-BFOWWhCS.css [add] dist/assets/index-Dm7DZNSo.js [change] dist/index.html [change] electron/main.cjs [change] src/App.jsx [unlink] dist/assets/index-CQjkNPEp.js [unlink] dist/assets/index-CzQQplJ5.css
This commit is contained in:
1
dist/assets/index-BFOWWhCS.css
vendored
Normal file
1
dist/assets/index-BFOWWhCS.css
vendored
Normal file
File diff suppressed because one or more lines are too long
73
dist/assets/index-CQjkNPEp.js
vendored
73
dist/assets/index-CQjkNPEp.js
vendored
File diff suppressed because one or more lines are too long
1
dist/assets/index-CzQQplJ5.css
vendored
1
dist/assets/index-CzQQplJ5.css
vendored
File diff suppressed because one or more lines are too long
74
dist/assets/index-Dm7DZNSo.js
vendored
Normal file
74
dist/assets/index-Dm7DZNSo.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
dist/index.html
vendored
4
dist/index.html
vendored
@@ -5,8 +5,8 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>LLM Desktop</title>
|
<title>LLM Desktop</title>
|
||||||
<script type="module" crossorigin src="/assets/index-CQjkNPEp.js"></script>
|
<script type="module" crossorigin src="/assets/index-Dm7DZNSo.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CzQQplJ5.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-BFOWWhCS.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const DEFAULT_UI_SCALE = 1
|
|||||||
const MIN_UI_SCALE = 0.7
|
const MIN_UI_SCALE = 0.7
|
||||||
const MAX_UI_SCALE = 1.3
|
const MAX_UI_SCALE = 1.3
|
||||||
const DEFAULT_OPEN_DEVTOOLS_ON_STARTUP = false
|
const DEFAULT_OPEN_DEVTOOLS_ON_STARTUP = false
|
||||||
const DEFAULT_AUDIO_INPUT_ENABLED = false
|
const DEFAULT_AUDIO_INPUT_ENABLED = true
|
||||||
const DEFAULT_AUDIO_INPUT_DEVICE_ID = ''
|
const DEFAULT_AUDIO_INPUT_DEVICE_ID = ''
|
||||||
|
|
||||||
const defaultSettings = {
|
const defaultSettings = {
|
||||||
|
|||||||
17
src/App.jsx
17
src/App.jsx
@@ -533,18 +533,27 @@ export default function App() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const dataUrl = await readFileAsDataUrl(blob)
|
const dataUrl = await readFileAsDataUrl(blob)
|
||||||
const match = /^data:([^;]+);base64,([\s\S]+)$/i.exec(dataUrl)
|
const commaIndex = dataUrl.indexOf(',')
|
||||||
if (!match) {
|
if (commaIndex <= 5) {
|
||||||
throw new Error('Recorded audio could not be encoded for upload.')
|
throw new Error('Recorded audio could not be encoded for upload.')
|
||||||
}
|
}
|
||||||
|
const header = dataUrl.slice(0, commaIndex)
|
||||||
|
const payload = dataUrl.slice(commaIndex + 1)
|
||||||
|
if (!/^data:[^,]+;base64$/i.test(header) || !payload) {
|
||||||
|
throw new Error('Recorded audio could not be encoded for upload.')
|
||||||
|
}
|
||||||
|
const detectedMimeType = header
|
||||||
|
.slice(5)
|
||||||
|
.replace(/;base64$/i, '')
|
||||||
|
.trim()
|
||||||
|
|
||||||
const response = await fetch(`${backendApiUrl}/audio/transcribe`, {
|
const response = await fetch(`${backendApiUrl}/audio/transcribe`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
mime_type: mimeType || match[1] || 'audio/webm',
|
mime_type: mimeType || detectedMimeType || 'audio/webm',
|
||||||
audio_base64: match[2],
|
audio_base64: payload,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
const data = await expectBackendJson(response)
|
const data = await expectBackendJson(response)
|
||||||
|
|||||||
Reference in New Issue
Block a user