@@ -52,10 +52,10 @@ public List<String> getAvailableModels() {
5252 }
5353
5454 @ Override
55- public Flashcard generateFlashcard (String targetWord , FlashcardType flashcardType , Language language , Options options ) {
55+ public Flashcard generateFlashcard (String targetWord , FlashcardType flashcardType , Language sourceLanguage , Language targetLanguage , Options options ) {
5656 try {
5757 // Generate the prompt based on the flashcard type
58- String prompt = promptGenerator .generatePrompt (targetWord , flashcardType , language , options );
58+ String prompt = promptGenerator .generatePrompt (targetWord , flashcardType , sourceLanguage , targetLanguage , options );
5959 // Generate HTTP POST request body
6060 String requestBody = promptGenerator .generateRequestBody (prompt );
6161 // Send the POST request to the GPT API
@@ -73,10 +73,10 @@ public Flashcard generateFlashcard(String targetWord, FlashcardType flashcardTyp
7373 }
7474
7575 @ Override
76- public List <Flashcard > generateMultipleFlashcardsForWord (String targetWord , FlashcardType flashcardType , Language language , Options options , int count ) {
76+ public List <Flashcard > generateMultipleFlashcardsForWord (String targetWord , FlashcardType flashcardType , Language sourceLanguage , Language targetLanguage , Options options , int count ) {
7777 try {
7878 // Generate the prompt for multiple flashcards
79- String prompt = promptGenerator .generatePromptForMultipleFlashcards (targetWord , flashcardType , language , options , count );
79+ String prompt = promptGenerator .generatePromptForMultipleFlashcards (targetWord , flashcardType , sourceLanguage , targetLanguage , options , count );
8080 // Generate HTTP POST request body
8181 String requestBody = promptGenerator .generateRequestBody (prompt );
8282 // Send the POST request to the GPT API
@@ -94,7 +94,7 @@ public List<Flashcard> generateMultipleFlashcardsForWord(String targetWord, Flas
9494 }
9595
9696 @ Override
97- public List <Flashcard > generateFlashcardsInteractively (FlashcardType flashcardType , Language language , Options options ) throws IOException {
97+ public List <Flashcard > generateFlashcardsInteractively (FlashcardType flashcardType , Language sourceLanguage , Language targetLanguage , Options options ) throws IOException {
9898 List <Flashcard > flashcards = new ArrayList <>();
9999
100100 // Instantiate the interactive mode input service
@@ -118,7 +118,7 @@ public List<Flashcard> generateFlashcardsInteractively(FlashcardType flashcardTy
118118 }
119119
120120 // Otherwise generate the flashcard and ad it to the List
121- Flashcard flashcard = generateFlashcard (input , flashcardType , language , options );
121+ Flashcard flashcard = generateFlashcard (input , flashcardType , sourceLanguage , targetLanguage , options );
122122 flashcards .add (flashcard );
123123
124124 System .out .println (flashcard );
@@ -130,15 +130,15 @@ public List<Flashcard> generateFlashcardsInteractively(FlashcardType flashcardTy
130130 }
131131
132132 @ Override
133- public List <Flashcard > generateFlashcardsSequentially (List <String > targetWords , FlashcardType flashcardType , Language language , Options options ) {
133+ public List <Flashcard > generateFlashcardsSequentially (List <String > targetWords , FlashcardType flashcardType , Language sourceLanguage , Language targetLanguage , Options options ) {
134134 List <Flashcard > flashcards = new ArrayList <>();
135135
136136 // Track the start time
137137 long startTime = System .currentTimeMillis ();
138138
139139 // Iterate through words, generate flashcards and store them in the List<Flashcard>
140140 for (int i = 0 ; i < targetWords .size (); i ++) {
141- flashcards .add (generateFlashcard (targetWords .get (i ), flashcardType , language , options ));
141+ flashcards .add (generateFlashcard (targetWords .get (i ), flashcardType , sourceLanguage , targetLanguage , options ));
142142 System .out .println ("Flashcard " + (i + 1 ) + " of " + targetWords .size () + " generated." );
143143 }
144144
@@ -152,14 +152,14 @@ public List<Flashcard> generateFlashcardsSequentially(List<String> targetWords,
152152 }
153153
154154 @ Override
155- public List <Flashcard > generateFlashcardsConcurrently (List <String > targetWords , FlashcardType flashcardType , Language language , Options options ) throws InterruptedException , ExecutionException {
155+ public List <Flashcard > generateFlashcardsConcurrently (List <String > targetWords , FlashcardType flashcardType , Language sourceLanguage , Language targetLanguage , Options options ) throws InterruptedException , ExecutionException {
156156 List <Future <Flashcard >> futures = new ArrayList <>();
157157
158158 long startTime = System .currentTimeMillis ();
159159
160160 // Submit a task for each word and inform the client
161161 for (String targetWord : targetWords ) {
162- futures .add (executorService .submit (() -> generateFlashcard (targetWord , flashcardType , language , options )));
162+ futures .add (executorService .submit (() -> generateFlashcard (targetWord , flashcardType , sourceLanguage , targetLanguage , options )));
163163 }
164164
165165 System .out .println ("All tasks submitted. Waiting for results..." );
0 commit comments