bug fixes and other minor improvments

This commit is contained in:
Andrew Gundersen 2022-01-27 16:45:35 -06:00
commit dac7edef21
10 changed files with 36 additions and 26 deletions

View file

@ -9,7 +9,15 @@ const Bubble =
}
Vue.onMounted(() => {
document.getElementById("messenger").dispatchEvent(new CustomEvent('adjust-scroll'));
const el = document.getElementById("messenger");
setTimeout(() => {
el.dispatchEvent(new CustomEvent('adjust-scroll'));
}, 100);
});
return { getUrl };
@ -28,7 +36,7 @@ const Bubble =
<img v-else-if="category == 'image'" :src="getUrl()" />
<a v-else :href="getUrl()">{{ text }}</a>
<a v-else :download="text" :href="getUrl()">{{ text }}</a>
</div>`
};

View file

@ -1,6 +1,11 @@
const onDrop = async (e) => {
const file = e.dataTransfer.items[0].getAsFile();
if (file.size >= 1 * 1000 * 1000) {
alert("File must be under 1MB.");
return;
}
const buffer = await file.arrayBuffer();
const b64String = await window.mainApi.invoke("encode", buffer);

View file

@ -46,11 +46,17 @@ function useText(elementId, left, typing)
if (e.key === "Enter" && el.value)
{
if (el.value.length >= 250) {
alert("250 character limit")
return;
}
window.mainApi.send("message", {
category: "text",
text: el.value,
blob: null
});
show.value = false;
}
});

View file

@ -18,10 +18,6 @@ const Message =
template: `
<div :id="id" :class="'message ' + modifier + '-message'">
<div class="message-session" v-if="context=='Crimata AI'">
New Session
</div>
<Bubble
v-for="(c, index) in content"
:category="c.category"

View file

@ -33,14 +33,10 @@ const Messenger = {
{
person.value = update;
}
else if (update.content)
else if (update.modifier)
{
messages.value.push(update);
}
else if (typeof update == Array)
{
messages.value.push(...update);
}
else if (update.category)
{
search(update.message).content.push(update);