更新至 v0.7.0_20251126 版本
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
|
||||
import { GoogleGenAI, Modality, Type } from "@google/genai";
|
||||
import { PronunciationFeedback, Language, ReadingLesson, ReadingDifficulty, OCRAnalysis, ListeningLesson } from "../types";
|
||||
import { base64ToUint8Array, uint8ArrayToBase64 } from "../utils/audioUtils";
|
||||
@@ -425,7 +426,7 @@ class GeminiService {
|
||||
const ai = this.getAi();
|
||||
const targetLangName = LANGUAGE_MAP[language];
|
||||
// Prompt asks for a conversation or monologue suitable for listening practice
|
||||
const prompt = `Create a Japanese listening practice script on "${topic}", level ${difficulty}. It should be a conversation or monologue.
|
||||
const prompt = `Create a Japanese listening practice script on "${topic}", level ${difficulty}.
|
||||
Output JSON with:
|
||||
- title
|
||||
- script (The full Japanese text of the conversation/monologue)
|
||||
@@ -433,6 +434,7 @@ class GeminiService {
|
||||
- vocabulary (Key words with meanings in ${targetLangName})
|
||||
- questions (3 multiple choice comprehension questions in ${targetLangName})
|
||||
- Each question needs: question, options (array of 3 strings), correctIndex (0-2), explanation (in ${targetLangName}).
|
||||
- grammarPoints (explanations in ${targetLangName}).
|
||||
`;
|
||||
|
||||
return this.retryOperation(async () => {
|
||||
@@ -461,9 +463,10 @@ class GeminiService {
|
||||
},
|
||||
required: ["question", "options", "correctIndex", "explanation"]
|
||||
}
|
||||
}
|
||||
},
|
||||
grammarPoints: { type: Type.ARRAY, items: { type: Type.OBJECT, properties: { point: { type: Type.STRING }, explanation: { type: Type.STRING } } } }
|
||||
},
|
||||
required: ["title", "script", "translation", "vocabulary", "questions"]
|
||||
required: ["title", "script", "translation", "vocabulary", "questions", "grammarPoints"]
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -558,4 +561,4 @@ class GeminiService {
|
||||
}
|
||||
}
|
||||
|
||||
export const geminiService = new GeminiService();
|
||||
export const geminiService = new GeminiService();
|
||||
Reference in New Issue
Block a user