@@ -36,6 +36,7 @@ import {
3636 safeLocalStorage
3737} from "@/lib/question" ;
3838import { PlusIcon , XIcon } from "lucide-react" ;
39+ import { Textarea } from "@/components/ui/textarea" ;
3940
4041interface SettingsModalProps {
4142 language : string ;
@@ -63,6 +64,12 @@ export default function SettingsModal({
6364 ! [ "gpt-4" , "gpt-4o" , "gpt-3.5-turbo" ] . includes ( openAISettings . model ) ,
6465 ) ;
6566
67+ // Load system prompts from localStorage
68+ const [ systemPrompts , setSystemPrompts ] = useState ( {
69+ questionPrompt : safeLocalStorage . getItem ( "system_prompt_question" ) || "" ,
70+ answerPrompt : safeLocalStorage . getItem ( "system_prompt_answer" ) || "" ,
71+ } ) ;
72+
6673 const [ questionSettings , setQuestionSettings ] = useState ( {
6774 type : safeLocalStorage . getItem ( "question_type" ) || "all" ,
6875 category : safeLocalStorage . getItem ( "question_category" ) || "all" ,
@@ -162,6 +169,14 @@ export default function SettingsModal({
162169 safeLocalStorage . setItem ( "openai_token" , openAISettings . token ) ;
163170 }
164171
172+ // Save system prompts if they exist
173+ if ( systemPrompts . questionPrompt ) {
174+ safeLocalStorage . setItem ( "system_prompt_question" , systemPrompts . questionPrompt ) ;
175+ }
176+ if ( systemPrompts . answerPrompt ) {
177+ safeLocalStorage . setItem ( "system_prompt_answer" , systemPrompts . answerPrompt ) ;
178+ }
179+
165180 toast ( {
166181 title : t ( "toast.settings.title" ) ,
167182 description : t ( "toast.settings.description" ) ,
@@ -258,6 +273,12 @@ export default function SettingsModal({
258273 token : "" ,
259274 } ) ;
260275
276+ // Reset system prompts
277+ setSystemPrompts ( {
278+ questionPrompt : "" ,
279+ answerPrompt : "" ,
280+ } ) ;
281+
261282 // Reset custom model flag
262283 setIsCustomModel ( false ) ;
263284
@@ -279,6 +300,8 @@ export default function SettingsModal({
279300 safeLocalStorage . removeItem ( "openai_endpoint" ) ;
280301 safeLocalStorage . removeItem ( "openai_model" ) ;
281302 safeLocalStorage . removeItem ( "openai_token" ) ;
303+ safeLocalStorage . removeItem ( "system_prompt_question" ) ;
304+ safeLocalStorage . removeItem ( "system_prompt_answer" ) ;
282305
283306 setShowResetConfirmation ( false ) ;
284307
@@ -304,11 +327,12 @@ export default function SettingsModal({
304327 </ DialogHeader >
305328
306329 < Tabs defaultValue = "questions" onValueChange = { setActiveTab } >
307- < TabsList className = "grid grid-cols-2 mb-4" >
330+ < TabsList className = "grid grid-cols-3 mb-4" >
308331 < TabsTrigger value = "questions" >
309332 { t ( "settings.questions" ) }
310333 </ TabsTrigger >
311334 < TabsTrigger value = "openai" > { t ( "settings.openai" ) } </ TabsTrigger >
335+ < TabsTrigger value = "prompts" > { t ( "settings.prompts" ) } </ TabsTrigger >
312336 </ TabsList >
313337
314338 < TabsContent value = "questions" className = "space-y-4" >
@@ -675,6 +699,66 @@ export default function SettingsModal({
675699 </ div >
676700 </ div >
677701 </ TabsContent >
702+
703+ < TabsContent value = "prompts" className = "space-y-4" >
704+ < div className = "space-y-4" >
705+ < div className = "space-y-2" >
706+ < Label > { t ( "settings.questionSystemPrompt" ) || "Question Generation System Prompt" } </ Label >
707+ < Textarea
708+ placeholder = { t ( "settings.questionSystemPromptPlaceholder" ) || "Enter system prompt for question generation..." }
709+ value = { systemPrompts . questionPrompt }
710+ onChange = { ( e ) =>
711+ setSystemPrompts ( {
712+ ...systemPrompts ,
713+ questionPrompt : e . target . value
714+ } )
715+ }
716+ className = "min-h-24"
717+ />
718+ < p className = "text-xs text-muted-foreground" >
719+ { t ( "settings.questionSystemPromptHelp" ) || "This prompt guides the AI in generating interview questions." }
720+ </ p >
721+ </ div >
722+
723+ < div className = "space-y-2" >
724+ < Label > { t ( "settings.answerSystemPrompt" ) || "Answer Generation System Prompt" } </ Label >
725+ < Textarea
726+ placeholder = { t ( "settings.answerSystemPromptPlaceholder" ) || "Enter system prompt for answer generation..." }
727+ value = { systemPrompts . answerPrompt }
728+ onChange = { ( e ) =>
729+ setSystemPrompts ( {
730+ ...systemPrompts ,
731+ answerPrompt : e . target . value
732+ } )
733+ }
734+ className = "min-h-24"
735+ />
736+ < p className = "text-xs text-muted-foreground" >
737+ { t ( "settings.answerSystemPromptHelp" ) || "This prompt guides the AI in generating model answers to questions." }
738+ </ p >
739+ </ div >
740+
741+ < Button
742+ variant = "outline"
743+ onClick = { ( ) => {
744+ setSystemPrompts ( {
745+ questionPrompt : "" ,
746+ answerPrompt : ""
747+ } ) ;
748+ safeLocalStorage . removeItem ( "system_prompt_question" ) ;
749+ safeLocalStorage . removeItem ( "system_prompt_answer" ) ;
750+ toast ( {
751+ title : t ( "settings.promptsReset" ) || "Prompts Reset" ,
752+ description : t ( "settings.promptsResetDesc" ) || "System prompts have been reset to default" ,
753+ duration : 3000 ,
754+ } ) ;
755+ } }
756+ className = "w-full"
757+ >
758+ { t ( "settings.resetPrompts" ) || "Reset Prompts to Default" }
759+ </ Button >
760+ </ div >
761+ </ TabsContent >
678762 </ Tabs >
679763
680764 < DialogFooter >
0 commit comments