diff --git a/backend/open_webui/apps/audio/main.py b/backend/open_webui/apps/audio/main.py index 148430da8..b138f82de 100644 --- a/backend/open_webui/apps/audio/main.py +++ b/backend/open_webui/apps/audio/main.py @@ -522,7 +522,8 @@ def transcription( else: data = transcribe(file_path) - return data + file_path = file_path.split("/")[-1] + return {**data, "filename": file_path} except Exception as e: log.exception(e) raise HTTPException( diff --git a/src/lib/components/chat/MessageInput.svelte b/src/lib/components/chat/MessageInput.svelte index 6875dea53..ce48d9dfb 100644 --- a/src/lib/components/chat/MessageInput.svelte +++ b/src/lib/components/chat/MessageInput.svelte @@ -361,8 +361,8 @@ document.getElementById('chat-input')?.focus(); }} on:confirm={async (e) => { - const response = e.detail; - prompt = `${prompt}${response} `; + const { text, filename } = e.detail; + prompt = `${prompt}${text} `; recording = false; diff --git a/src/lib/components/chat/MessageInput/VoiceRecording.svelte b/src/lib/components/chat/MessageInput/VoiceRecording.svelte index a92016879..03b5cec1e 100644 --- a/src/lib/components/chat/MessageInput/VoiceRecording.svelte +++ b/src/lib/components/chat/MessageInput/VoiceRecording.svelte @@ -1,6 +1,6 @@
+ +
+ {#if loading} +
+ +
+ {:else} + - {/if} + + + + + {/if} +
diff --git a/src/lib/components/icons/SparklesSolid.svelte b/src/lib/components/icons/SparklesSolid.svelte new file mode 100644 index 000000000..d69e0c8b6 --- /dev/null +++ b/src/lib/components/icons/SparklesSolid.svelte @@ -0,0 +1,12 @@ + + + + + diff --git a/src/lib/components/playground/Notes.svelte b/src/lib/components/playground/Notes.svelte new file mode 100644 index 000000000..6b616cf46 --- /dev/null +++ b/src/lib/components/playground/Notes.svelte @@ -0,0 +1,121 @@ + + +
+ {#if loading} +
+
+ +
+
+ {/if} + +
+
+
+ +
+
+ +
+ +
+
+ +
+
+ {#if voiceInput} +
+ { + voiceInput = false; + }} + on:confirm={(e) => { + const { text, filename } = e.detail; + + // url is hostname + /cache/audio/transcription/ + filename + const url = `${window.location.origin}/cache/audio/transcription/${filename}`; + + // Open in new tab + + if (content.trim() !== '') { + content = `${content}\n\n${text}\n\nRecording: ${url}\n\n`; + } else { + content = `${content}${text}\n\nRecording: ${url}\n\n`; + } + + voiceInput = false; + }} + /> +
+ {:else} + + + + {/if} + + +
+
+
diff --git a/src/lib/components/workspace/Knowledge/Collection/AddTextContentModal.svelte b/src/lib/components/workspace/Knowledge/Collection/AddTextContentModal.svelte index 82e64f3ed..40553b4c9 100644 --- a/src/lib/components/workspace/Knowledge/Collection/AddTextContentModal.svelte +++ b/src/lib/components/workspace/Knowledge/Collection/AddTextContentModal.svelte @@ -85,8 +85,8 @@ voiceInput = false; }} on:confirm={(e) => { - const response = e.detail; - content = `${content}${response} `; + const { text, filename } = e.detail; + content = `${content}${text} `; voiceInput = false; }} diff --git a/src/routes/(app)/playground/+layout.svelte b/src/routes/(app)/playground/+layout.svelte index c4f2e808b..38d2e6f3f 100644 --- a/src/routes/(app)/playground/+layout.svelte +++ b/src/routes/(app)/playground/+layout.svelte @@ -51,6 +51,15 @@ href="/playground">{$i18n.t('Chat')} + {$i18n.t('Notes')} +