Skip to content

Conversation

lazeratops
Copy link
Contributor

This PR disables chat until the TensorFlow toxicity model has loaded. The chat icon remains an "X" and clicking it does nothing if the model does not yet exist.

The other (formatting) changes there are just from the automated prettier run in my IDE :)

@@ -1,8 +1,11 @@
<template>
<div :class="chatIsOpen ? 'chat-wrapper open' : 'chat-wrapper'">
<div>
<button class="chat" @click="handleChatClick">
<template v-if="chatIsOpen">
<button class="chat" @click="handleChatClick" :disabled="!model">
Copy link
Contributor Author

@lazeratops lazeratops May 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is where the main logic is to account for the potential timing issue of model load, basically disabling chat until the model exists. Let me know if that makes sense!

.then((model) => {
this.model = Object.freeze(model);
})
.catch((e) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding some error logging in case something goes wrong, for easier debugging should that happen on the user's end!

@lazeratops lazeratops requested a review from adamichelle May 3, 2023 07:55
Copy link

@adamichelle adamichelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@lazeratops lazeratops merged commit 9dc764e into feat/chat-moderation-with-tensorflow-js May 3, 2023
@lazeratops lazeratops deleted the ls/chat-mod-timing branch May 3, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants