Skip to content

Commit

Permalink
[frontend] Fix options for tone in message (#1126)
Browse files Browse the repository at this point in the history
  • Loading branch information
savacano28 authored and johanah29 committed Jul 16, 2024
1 parent e58a77c commit cdb89cf
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions openbas-front/src/admin/components/common/form/TextFieldAskAI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const TextFieldAskAI: FunctionComponent<TextFieldAskAiProps> = ({
const [openToneOptions, setOpenToneOptions] = useState(false);
const [openGenMessageOptions, setOpenGenMessageOptions] = useState(false);
const [openGenMediaOptions, setOpenGenMediaOptions] = useState(false);
const [tone, setTone] = useState<'tactical' | 'operational' | 'strategic'>('tactical');
const [messageContext, setMessageContext] = useState<string>(context ?? '');
const [messageInput, setMessageInput] = useState<string>(currentValue);
const [messageParagraphs, setMessageParagraphs] = useState<number>(5);
Expand Down Expand Up @@ -84,7 +83,7 @@ const TextFieldAskAI: FunctionComponent<TextFieldAskAiProps> = ({
const askFixSpelling = async () => aiFixSpelling(currentValue, format, (data: string) => setContent(data));
const askMakeShorter = async () => aiMakeShorter(currentValue, format, (data: string) => setContent(data));
const askMakeLonger = async () => aiMakeLonger(currentValue, format, (data: string) => setContent(data));
const askChangeTone = async () => aiChangeTone(currentValue, tone, format, (data: string) => setContent(data));
const askChangeTone = async () => aiChangeTone(currentValue, messageTone, format, (data: string) => setContent(data));
const askSummarize = async () => aiSummarize(currentValue, format, (data: string) => setContent(data));
const askExplain = async () => aiExplain(currentValue, (data: string) => setContent(data));
const askGenMessage = async () => aiGenMessage(
Expand Down Expand Up @@ -398,13 +397,19 @@ const TextFieldAskAI: FunctionComponent<TextFieldAskAiProps> = ({
<InputLabel id="tone">{t('Tone')}</InputLabel>
<Select
labelId="tone"
value={tone}
onChange={(event) => setTone(event.target.value as unknown as 'tactical' | 'operational' | 'strategic')}
value={messageTone}
onChange={(event) => setMessageTone(event.target.value as unknown as 'informal' | 'formal' | 'assertive' | 'sarcastic' | 'authoritative' | 'bitter' | 'critical' | 'arrogant' | 'aggressive')}
fullWidth={true}
>
<MenuItem value="tactical">{t('Tactical')}</MenuItem>
<MenuItem value="operational">{t('Operational')}</MenuItem>
<MenuItem value="strategic">{t('Strategic')}</MenuItem>
<MenuItem value="informal">{t('Informal')}</MenuItem>
<MenuItem value="formal">{t('Formal')}</MenuItem>
<MenuItem value="assertive">{t('Assertive')}</MenuItem>
<MenuItem value="sarcastic">{t('Sarcastic')}</MenuItem>
<MenuItem value="authoritative">{t('Authoritative')}</MenuItem>
<MenuItem value="bitter">{t('Bitter')}</MenuItem>
<MenuItem value="critical">{t('Critical')}</MenuItem>
<MenuItem value="arrogant">{t('Arrogant')}</MenuItem>
<MenuItem value="aggressive">{t('Aggressive')}</MenuItem>
</Select>
</FormControl>
</DialogContent>
Expand Down

0 comments on commit cdb89cf

Please sign in to comment.