1
- import React , { useEffect , useRef } from 'react' ;
1
+ import React , { useEffect , useRef , useState } from 'react' ;
2
2
import { useSelector , useDispatch } from 'react-redux' ;
3
3
import { SSE } from '~/utils/sse' ;
4
4
import SubmitButton from './SubmitButton' ;
@@ -15,14 +15,16 @@ import { setMessages } from '~/store/messageSlice';
15
15
import { setSubmitState , toggleCursor } from '~/store/submitSlice' ;
16
16
import { setText } from '~/store/textSlice' ;
17
17
import { useMessageHandler } from '../../utils/handleSubmit' ;
18
+ import AdjustToneButton from './AdjustToneButton' ;
18
19
19
20
export default function TextChat ( { messages } ) {
20
21
const inputRef = useRef ( null ) ;
21
22
const bingStylesRef = useRef ( null ) ;
23
+ const [ showBingToneSetting , setShowBingToneSetting ] = useState ( false ) ;
22
24
const isComposing = useRef ( false ) ;
23
25
const dispatch = useDispatch ( ) ;
24
26
const convo = useSelector ( state => state . convo ) ;
25
- const { isSubmitting, stopStream, submission, disabled } = useSelector ( state => state . submit ) ;
27
+ const { isSubmitting, stopStream, submission, disabled, model } = useSelector ( state => state . submit ) ;
26
28
const { text } = useSelector ( state => state . text ) ;
27
29
const { latestMessage } = convo ;
28
30
const { ask, regenerate, stopGenerating } = useMessageHandler ( ) ;
@@ -372,13 +374,17 @@ export default function TextChat({ messages }) {
372
374
return '' ;
373
375
} ;
374
376
377
+ const handleBingToneSetting = ( ) => {
378
+ setShowBingToneSetting ( ( show ) => ! show )
379
+ }
380
+
375
381
return (
376
382
< >
377
383
< div className = "input-panel md:bg-vert-light-gradient dark:md:bg-vert-dark-gradient fixed bottom-0 left-0 w-full border-t bg-white py-2 dark:border-white/20 dark:bg-gray-800 md:absolute md:border-t-0 md:border-transparent md:bg-transparent md:dark:border-transparent md:dark:bg-transparent" >
378
384
< form className = "stretch mx-2 flex flex-row gap-3 last:mb-2 md:pt-2 md:last:mb-6 lg:mx-auto lg:max-w-3xl lg:pt-6" >
379
385
< div className = "relative flex h-full flex-1 md:flex-col" >
380
386
< span className = "order-last ml-1 flex justify-center gap-0 md:order-none md:m-auto md:mb-2 md:w-full md:gap-2" >
381
- < BingStyles ref = { bingStylesRef } />
387
+ < BingStyles ref = { bingStylesRef } show = { showBingToneSetting } />
382
388
{ isSubmitting && ! isSearchView ? (
383
389
< button
384
390
onClick = { handleStopGenerating }
@@ -427,6 +433,9 @@ export default function TextChat({ messages }) {
427
433
submitMessage = { submitMessage }
428
434
disabled = { disabled || isNotAppendable }
429
435
/>
436
+ { messages ?. length && model === 'sydney' ?
437
+ < AdjustToneButton onClick = { handleBingToneSetting } /> :
438
+ null }
430
439
</ div >
431
440
</ div >
432
441
</ form >
0 commit comments