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

@ -5,7 +5,7 @@ const { postLogin } = require("./api");
const { ipcEmit } = require("./utils/emitter");
const { launchSession, endSession } = require("./session");
// store.set("account", "smith12@gmail.com");
store.set("account", "smith12@gmail.com");
store.set("account", "adgundersen@gmail.com");
async function login(_e, email, password)

View file

@ -26,7 +26,9 @@ backgroundMitt.on("data", (int16Arr) => {
backgroundMitt.on("write", (int16Arr) => {
clearTimeout(setWriteId);
setWriteId = setTimeout(setPlaybackStatus.prototype.bind(null, false), 500);
setWriteId = setTimeout(() => {
setPlaybackStatus(false);
}, 500);
});
function setStreams()
@ -130,8 +132,3 @@ exports.initAudio = initAudio;
exports.terminateAudio = terminateAudio;
exports.playback = playback;
exports.streamState = streamState;
// setWriteId = setTimeout(() => {
// setPlaybackStatus(false);
// }, 500);

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);

View file

@ -1,7 +1,7 @@
html, body {
margin: 0;
padding: 0;
background-color: rgba(235, 235, 235, 0.75);
/*background-color: rgba(235, 235, 235, 0.75);*/
}
/* The first word of the class is the component that it modifys. */
@ -64,6 +64,8 @@ html, body {
font-family: SF Compact Display;
font-size: 12px;
color: #898989;
overflow: w;
word-wrap: break-word;
}
#header-menu {
@ -430,6 +432,10 @@ html, body {
align-items: flex-start;
}
.admin-message {
align-items: center;
}
.bubble {
position: relative;
max-width: 66vw;
@ -437,6 +443,7 @@ html, body {
font-size: 14px;
border-radius: 18px;
margin-bottom: 4px;
overflow-wrap: break-word;
}
.bubble-notify {

View file

@ -26,8 +26,6 @@ function handleMessageQueue()
{
const update = messageQueue.shift();
console.log(update);
if (update)
{
if (update.person)
@ -38,14 +36,10 @@ function handleMessageQueue()
{
ui.person = update;
}
else if (update.content)
else if (update.modifier)
{
ui.messages.push(update);
}
else if (typeof update == Array)
{
ui.messages.push(...update);
}
else if (update.category)
{
search(update.message).content.push(update);

View file

@ -42,6 +42,7 @@ function createWin()
frame: false,
minWidth: 350,
minHeight: 500,
backgroundColor: "#EBEBEB",
webPreferences: { preload: path.join(__dirname, "/render/preload.js") }
})