@@ -9,6 +9,7 @@ import { FormattedMessage, useIntl } from "react-intl";
9
9
10
10
import { Checkbox , Panel } from "@cocalc/frontend/antd-bootstrap" ;
11
11
import { Rendered , redux , useTypedRedux } from "@cocalc/frontend/app-framework" ;
12
+ import { useLocalizationCtx } from "@cocalc/frontend/app/localize" ;
12
13
import {
13
14
A ,
14
15
HelpIcon ,
@@ -22,7 +23,7 @@ import {
22
23
import AIAvatar from "@cocalc/frontend/components/ai-avatar" ;
23
24
import { IS_MOBILE , IS_TOUCH } from "@cocalc/frontend/feature" ;
24
25
import LLMSelector from "@cocalc/frontend/frame-editors/llm/llm-selector" ;
25
- import { labels } from "@cocalc/frontend/i18n" ;
26
+ import { LOCALIZATIONS , labels } from "@cocalc/frontend/i18n" ;
26
27
import {
27
28
VBAR_EXPLANATION ,
28
29
VBAR_KEY ,
@@ -33,6 +34,7 @@ import { NewFilenameFamilies } from "@cocalc/frontend/project/utils";
33
34
import track from "@cocalc/frontend/user-tracking" ;
34
35
import { webapp_client } from "@cocalc/frontend/webapp-client" ;
35
36
import { DEFAULT_NEW_FILENAMES , NEW_FILENAMES } from "@cocalc/util/db-schema" ;
37
+ import { OTHER_SETTINGS_REPLY_ENGLISH_KEY } from "@cocalc/util/i18n/const" ;
36
38
import { dark_mode_mins , get_dark_mode_config } from "./dark-mode" ;
37
39
import { I18NSelector , I18N_MESSAGE , I18N_TITLE } from "./i18n-selector" ;
38
40
import Tours from "./tours" ;
@@ -60,6 +62,7 @@ interface Props {
60
62
61
63
export function OtherSettings ( props : Readonly < Props > ) : JSX . Element {
62
64
const intl = useIntl ( ) ;
65
+ const { locale } = useLocalizationCtx ( ) ;
63
66
const isCoCalcCom = useTypedRedux ( "customize" , "is_cocalc_com" ) ;
64
67
const user_defined_llm = useTypedRedux ( "customize" , "user_defined_llm" ) ;
65
68
@@ -552,6 +555,24 @@ export function OtherSettings(props: Readonly<Props>): JSX.Element {
552
555
) ;
553
556
}
554
557
558
+ function render_llm_reply_language ( ) : Rendered {
559
+ return (
560
+ < Checkbox
561
+ checked = { ! ! props . other_settings . get ( OTHER_SETTINGS_REPLY_ENGLISH_KEY ) }
562
+ onChange = { ( e ) => {
563
+ on_change ( OTHER_SETTINGS_REPLY_ENGLISH_KEY , e . target . checked ) ;
564
+ } }
565
+ >
566
+ < FormattedMessage
567
+ id = "account.other-settings.llm.reply_language"
568
+ defaultMessage = { `<strong>Always reply in English</strong>,
569
+ If set, the replies are always in English. Otherwise – the default – it replies in your interface language (currently {lang})` }
570
+ values = { { lang : intl . formatMessage ( LOCALIZATIONS [ locale ] . trans ) } }
571
+ />
572
+ </ Checkbox >
573
+ ) ;
574
+ }
575
+
555
576
function render_custom_llm ( ) : Rendered {
556
577
// on cocalc.com, do not even show that they're disabled
557
578
if ( isCoCalcCom && ! user_defined_llm ) return ;
@@ -578,6 +599,7 @@ export function OtherSettings(props: Readonly<Props>): JSX.Element {
578
599
>
579
600
{ render_disable_all_llm ( ) }
580
601
{ render_language_model ( ) }
602
+ { render_llm_reply_language ( ) }
581
603
{ render_custom_llm ( ) }
582
604
</ Panel >
583
605
) ;
0 commit comments