fix(BingAI): show censored message, fix toneStyle UI bug (#644)

* fix(frontend/BingAI): prevent Settings from not showing on new conversation, also prevent showing toneStyle change without jailbreak

* fix(Input/index.jsx): fix typo in comment, change "also prevents toneStyle change without jailbreak" to "also prevents showing toneStyle change without jailbreak"

* fix(BingAI): show message despite censor trigger
This commit is contained in:
Danny Avila 2023-07-14 10:57:24 -04:00 committed by GitHub
parent 1a5144be76
commit 1a21eb5bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 48 deletions

View file

@ -1,6 +1,6 @@
import React from 'react';
import { Settings2 } from 'lucide-react';
export default function AdjustButton({ onClick }) {
export default function AdjustToneButton({ onClick }) {
const clickHandler = (e) => {
e.preventDefault();
onClick();

View file

@ -11,7 +11,7 @@ import NewConversationMenu from './NewConversationMenu';
import AdjustToneButton from './AdjustToneButton';
import Footer from './Footer';
import TextareaAutosize from 'react-textarea-autosize';
import { useMessageHandler } from '../../utils/handleSubmit';
import { useMessageHandler } from '~/utils/handleSubmit';
import store from '~/store';
@ -36,8 +36,20 @@ export default function TextChat({ isSearchView = false }) {
// auto focus to input, when enter a conversation.
useEffect(() => {
if (conversation?.conversationId !== 'search') inputRef.current?.focus();
}, [conversation?.conversationId]);
const { conversationId } = conversation || {};
if (!conversationId) {
return;
}
// Prevents Settings from not showing on new conversation, also prevents showing toneStyle change without jailbreak
if (conversationId === 'new' || !conversation?.jailbreak) {
setShowBingToneSetting(false);
}
if (conversationId !== 'search') {
inputRef.current?.focus();
}
}, [conversation]);
useEffect(() => {
const timeoutId = setTimeout(() => {
@ -146,7 +158,7 @@ export default function TextChat({ isSearchView = false }) {
>
<NewConversationMenu />
<TextareaAutosize
// set test id for e2e testing
// set test id for e2e testing
data-testid="text-input"
tabIndex="0"
autoFocus

View file

@ -209,7 +209,9 @@ export default function Message({
{!isSubmitting && unfinished ? (
<div className="flex flex min-h-[20px] flex-grow flex-col items-start gap-2 gap-4 text-red-500">
<div className="rounded-md border border-blue-400 bg-blue-500/10 px-3 py-2 text-sm text-gray-600 dark:text-gray-100">
{'This is an unfinished message. The AI may still be generating a response or it was aborted. Refresh or visit later to see more updates.'}
{
'This is an unfinished message. The AI may still be generating a response, it was aborted, or a censor was triggered. Refresh or visit later to see more updates.'
}
</div>
</div>
) : null}