fix: resolve bugs 01 through 08 and set Ollama TTL to 1h
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// =======================================================================
|
||||
|
||||
import { api } from './api.js';
|
||||
import { escapeHtml, escapeRegex, shuffleArray, showToast, openModal, closeModal, playAudio } from './ui.js';
|
||||
import { escapeHtml, escapeRegex, shuffleArray, showToast, openModal, closeModal, playAudio, cleanPromptTranslation } from './ui.js';
|
||||
import { getAllCards } from './dictionary.js';
|
||||
|
||||
let srsQueue = [];
|
||||
@@ -330,7 +330,7 @@ export function initSrs() {
|
||||
fcBackPos.style.display = card.part_of_speech ? 'inline-block' : 'none';
|
||||
} else {
|
||||
fcFrontDirBadge.textContent = 'RU ➔ EN';
|
||||
fcFrontMain.textContent = card.translation;
|
||||
fcFrontMain.textContent = cleanPromptTranslation(card.translation);
|
||||
fcFrontPos.textContent = card.part_of_speech || '';
|
||||
fcFrontPhoneticWrap.style.display = 'none';
|
||||
fcHintBtn.style.display = 'none';
|
||||
@@ -447,18 +447,18 @@ export function initSrs() {
|
||||
|
||||
if (quizAudioBtn) quizAudioBtn.classList.remove('hidden');
|
||||
|
||||
const correctText = card.translation;
|
||||
const correctText = cleanPromptTranslation(card.translation);
|
||||
const all = getAllCards();
|
||||
const candidates = all
|
||||
.filter(c => c.id !== card.id && c.translation && c.translation !== correctText)
|
||||
.map(c => c.translation);
|
||||
.filter(c => c.id !== card.id && c.translation && cleanPromptTranslation(c.translation) !== correctText)
|
||||
.map(c => cleanPromptTranslation(c.translation));
|
||||
|
||||
shuffleArray(candidates);
|
||||
const options = [correctText, ...candidates.slice(0, 3)];
|
||||
let options = [correctText, ...candidates.slice(0, 3)];
|
||||
while (options.length < 4) {
|
||||
options.push(`Вариант ${options.length + 1}`);
|
||||
}
|
||||
shuffleArray(options);
|
||||
options = shuffleArray(options);
|
||||
quizCurrentOptions = options;
|
||||
|
||||
quizOptionsGrid.innerHTML = '';
|
||||
@@ -543,7 +543,7 @@ export function initSrs() {
|
||||
typingRatingBar.classList.add('hidden');
|
||||
|
||||
typingPos.textContent = card.part_of_speech || '';
|
||||
typingPromptRu.textContent = card.translation;
|
||||
typingPromptRu.textContent = cleanPromptTranslation(card.translation);
|
||||
if (card.context_sentence) {
|
||||
typingContextHint.textContent = `Контекст: “${card.context_sentence}”`;
|
||||
typingContextHint.classList.remove('hidden');
|
||||
@@ -590,7 +590,7 @@ export function initSrs() {
|
||||
clozeRatingBar.classList.add('hidden');
|
||||
|
||||
clozePos.textContent = card.part_of_speech || '';
|
||||
clozeTargetTranslation.textContent = card.translation;
|
||||
clozeTargetTranslation.textContent = cleanPromptTranslation(card.translation);
|
||||
|
||||
const context = card.context_sentence || `The word is ${card.term}.`;
|
||||
const re = new RegExp(escapeRegex(card.term), 'gi');
|
||||
@@ -635,7 +635,7 @@ export function initSrs() {
|
||||
dictationDetailsBox.classList.add('hidden');
|
||||
dictationRatingBar.classList.add('hidden');
|
||||
dictationHintText.classList.add('hidden');
|
||||
dictationHintText.textContent = card.translation;
|
||||
dictationHintText.textContent = cleanPromptTranslation(card.translation);
|
||||
|
||||
dictationInput.value = '';
|
||||
dictationInput.disabled = false;
|
||||
|
||||
Reference in New Issue
Block a user