Unverified Commit 96a004d4 authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #2921 from open-webui/dev

0.3.0
parents a8d80f93 1fa16d73
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
const i18n = getContext('i18n'); const i18n = getContext('i18n');
export let files;
export let prompt = ''; export let prompt = '';
let selectedCommandIdx = 0; let selectedCommandIdx = 0;
let filteredPromptCommands = []; let filteredPromptCommands = [];
...@@ -35,6 +36,32 @@ ...@@ -35,6 +36,32 @@
return '{{CLIPBOARD}}'; return '{{CLIPBOARD}}';
}); });
console.log(clipboardText);
const clipboardItems = await navigator.clipboard.read();
let imageUrl = null;
for (const item of clipboardItems) {
// Check for known image types
for (const type of item.types) {
if (type.startsWith('image/')) {
const blob = await item.getType(type);
imageUrl = URL.createObjectURL(blob);
console.log(`Image URL (${type}): ${imageUrl}`);
}
}
}
if (imageUrl) {
files = [
...files,
{
type: 'image',
url: imageUrl
}
];
}
text = command.content.replaceAll('{{CLIPBOARD}}', clipboardText); text = command.content.replaceAll('{{CLIPBOARD}}', clipboardText);
} }
...@@ -61,7 +88,7 @@ ...@@ -61,7 +88,7 @@
</script> </script>
{#if filteredPromptCommands.length > 0} {#if filteredPromptCommands.length > 0}
<div class="md:px-2 mb-3 text-left w-full absolute bottom-0 left-0 right-0"> <div class="pl-1 pr-12 mb-3 text-left w-full absolute bottom-0 left-0 right-0">
<div class="flex w-full px-2"> <div class="flex w-full px-2">
<div class=" bg-gray-100 dark:bg-gray-700 w-10 rounded-l-xl text-center"> <div class=" bg-gray-100 dark:bg-gray-700 w-10 rounded-l-xl text-center">
<div class=" text-lg font-semibold mt-2">/</div> <div class=" text-lg font-semibold mt-2">/</div>
......
This diff is collapsed.
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
class=" snap-center min-w-80 w-full max-w-full m-1 border {history.messages[ class=" snap-center min-w-80 w-full max-w-full m-1 border {history.messages[
currentMessageId currentMessageId
].model === model ].model === model
? 'border-gray-100 dark:border-gray-700 border-[1.5px]' ? 'border-gray-100 dark:border-gray-850 border-[1.5px]'
: 'border-gray-50 dark:border-gray-850 '} transition p-5 rounded-3xl" : 'border-gray-50 dark:border-gray-850 '} transition p-5 rounded-3xl"
on:click={() => { on:click={() => {
currentMessageId = groupedMessages[model].messages[groupedMessagesIdx[model]].id; currentMessageId = groupedMessages[model].messages[groupedMessagesIdx[model]].id;
......
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
} else { } else {
speaking = true; speaking = true;
if ($settings?.audio?.TTSEngine === 'openai') { if ($config.audio.tts.engine === 'openai') {
loadingSpeech = true; loadingSpeech = true;
const sentences = extractSentences(message.content).reduce((mergedTexts, currentText) => { const sentences = extractSentences(message.content).reduce((mergedTexts, currentText) => {
...@@ -244,9 +244,8 @@ ...@@ -244,9 +244,8 @@
for (const [idx, sentence] of sentences.entries()) { for (const [idx, sentence] of sentences.entries()) {
const res = await synthesizeOpenAISpeech( const res = await synthesizeOpenAISpeech(
localStorage.token, localStorage.token,
$settings?.audio?.speaker, $settings?.audio?.tts?.voice ?? $config?.audio?.tts?.voice,
sentence, sentence
$settings?.audio?.model
).catch((error) => { ).catch((error) => {
toast.error(error); toast.error(error);
...@@ -273,17 +272,29 @@ ...@@ -273,17 +272,29 @@
clearInterval(getVoicesLoop); clearInterval(getVoicesLoop);
const voice = const voice =
voices?.filter((v) => v.name === $settings?.audio?.speaker)?.at(0) ?? undefined; voices
?.filter(
(v) => v.voiceURI === ($settings?.audio?.tts?.voice ?? $config?.audio?.tts?.voice)
)
?.at(0) ?? undefined;
console.log(voice);
const speak = new SpeechSynthesisUtterance(message.content); const speak = new SpeechSynthesisUtterance(message.content);
console.log(speak);
speak.onend = () => { speak.onend = () => {
speaking = null; speaking = null;
if ($settings.conversationMode) { if ($settings.conversationMode) {
document.getElementById('voice-input-button')?.click(); document.getElementById('voice-input-button')?.click();
} }
}; };
if (voice) {
speak.voice = voice; speak.voice = voice;
}
speechSynthesis.speak(speak); speechSynthesis.speak(speak);
} }
}, 100); }, 100);
...@@ -757,7 +768,7 @@ ...@@ -757,7 +768,7 @@
</Tooltip> </Tooltip>
{#if $config?.features.enable_image_generation && !readOnly} {#if $config?.features.enable_image_generation && !readOnly}
<Tooltip content="Generate Image" placement="bottom"> <Tooltip content={$i18n.t('Generate Image')} placement="bottom">
<button <button
class="{isLastMessage class="{isLastMessage
? 'visible' ? 'visible'
......
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
<DropdownMenu.Content <DropdownMenu.Content
class=" z-40 {$mobile class=" z-40 {$mobile
? `w-full` ? `w-full`
: `${className}`} max-w-[calc(100vw-1rem)] justify-start rounded-xl bg-white dark:bg-gray-850 dark:text-white shadow-lg border border-gray-300/30 dark:border-gray-700/50 outline-none " : `${className}`} max-w-[calc(100vw-1rem)] justify-start rounded-xl bg-white dark:bg-gray-850 dark:text-white shadow-lg border border-gray-300/30 dark:border-gray-850/50 outline-none "
transition={flyAndScale} transition={flyAndScale}
side={$mobile ? 'bottom' : 'bottom-start'} side={$mobile ? 'bottom' : 'bottom-start'}
sideOffset={4} sideOffset={4}
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
</div> </div>
{/if} {/if}
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<div class="flex items-center"> <div class="flex items-center min-w-fit">
<div class="line-clamp-1"> <div class="line-clamp-1">
{item.label} {item.label}
</div> </div>
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
</div> </div>
{#if ollamaVersion} {#if ollamaVersion}
<hr class=" dark:border-gray-700" /> <hr class=" dark:border-gray-850" />
<div> <div>
<div class=" mb-2.5 text-sm font-medium">{$i18n.t('Ollama Version')}</div> <div class=" mb-2.5 text-sm font-medium">{$i18n.t('Ollama Version')}</div>
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
</div> </div>
{/if} {/if}
<hr class=" dark:border-gray-700" /> <hr class=" dark:border-gray-850" />
<div class="flex space-x-1"> <div class="flex space-x-1">
<a href="https://discord.gg/5rJgQTnV4s" target="_blank"> <a href="https://discord.gg/5rJgQTnV4s" target="_blank">
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
<UpdatePassword /> <UpdatePassword />
</div> </div>
<hr class=" dark:border-gray-700 my-4" /> <hr class=" dark:border-gray-850 my-4" />
<div class="flex justify-between items-center text-sm"> <div class="flex justify-between items-center text-sm">
<div class=" font-medium">{$i18n.t('API keys')}</div> <div class=" font-medium">{$i18n.t('API keys')}</div>
......
...@@ -556,7 +556,7 @@ ...@@ -556,7 +556,7 @@
type="number" type="number"
class=" bg-transparent text-center w-14" class=" bg-transparent text-center w-14"
min="-1" min="-1"
step="10" step="1"
/> />
</div> </div>
</div> </div>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
/> />
<div class="text-xs text-gray-500"> <div class="text-xs text-gray-500">
ⓘ Refer to yourself as "User" (e.g., "User is learning Spanish") {$i18n.t('Refer to yourself as "User" (e.g., "User is learning Spanish")')}
</div> </div>
</div> </div>
......
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