@@ -6,13 +6,16 @@ import { Group } from '@ui/components/editor/settings/Group/Group'
66
77type Props = {
88 gemini_user_id : number | null
9+ ai_studio_user_id : number | null
910 on_gemini_user_id_change : ( id : number | null ) => void
11+ on_ai_studio_user_id_change : ( id : number | null ) => void
1012 on_stuck_change : ( is_stuck : boolean ) => void
1113}
1214
1315export const PresetsSection = forwardRef < HTMLDivElement , Props > (
1416 ( props , ref ) => {
1517 const [ gemini_user_id_str , set_gemini_user_id_str ] = useState ( '' )
18+ const [ ai_studio_user_id_str , set_ai_studio_user_id_str ] = useState ( '' )
1619
1720 useEffect ( ( ) => {
1821 set_gemini_user_id_str (
@@ -22,6 +25,15 @@ export const PresetsSection = forwardRef<HTMLDivElement, Props>(
2225 )
2326 } , [ props . gemini_user_id ] )
2427
28+ useEffect ( ( ) => {
29+ set_ai_studio_user_id_str (
30+ props . ai_studio_user_id === null ||
31+ props . ai_studio_user_id === undefined
32+ ? ''
33+ : String ( props . ai_studio_user_id )
34+ )
35+ } , [ props . ai_studio_user_id ] )
36+
2537 const handle_gemini_user_id_blur = ( ) => {
2638 if ( gemini_user_id_str === '' ) {
2739 props . on_gemini_user_id_change ( null )
@@ -33,6 +45,17 @@ export const PresetsSection = forwardRef<HTMLDivElement, Props>(
3345 }
3446 }
3547
48+ const handle_ai_studio_user_id_blur = ( ) => {
49+ if ( ai_studio_user_id_str === '' ) {
50+ props . on_ai_studio_user_id_change ( null )
51+ return
52+ }
53+ const num_id = parseInt ( ai_studio_user_id_str , 10 )
54+ if ( ! isNaN ( num_id ) && num_id >= 0 ) {
55+ props . on_ai_studio_user_id_change ( num_id )
56+ }
57+ }
58+
3659 return (
3760 < Section
3861 ref = { ref }
@@ -54,6 +77,19 @@ export const PresetsSection = forwardRef<HTMLDivElement, Props>(
5477 />
5578 }
5679 />
80+ < Item
81+ title = "AI Studio User ID"
82+ description = "Run AI Studio chatbot as non-default user. Check URL for the numeric ID."
83+ slot_right = {
84+ < Input
85+ type = "number"
86+ value = { ai_studio_user_id_str }
87+ on_change = { set_ai_studio_user_id_str }
88+ on_blur = { handle_ai_studio_user_id_blur }
89+ max_width = { 60 }
90+ />
91+ }
92+ />
5793 </ Group >
5894 </ Section >
5995 )
0 commit comments