Luca448 commited on
Commit
45cfc3d
·
1 Parent(s): 3d53316

Feat: Auto-correct user input in Schnelleingabe if AI detects a typo

Browse files
Files changed (2) hide show
  1. index.html +1 -1
  2. src/views/vocabulary-modal.js +6 -1
index.html CHANGED
@@ -74,7 +74,7 @@
74
  </head>
75
  <body class="dark-theme in-chat-view">
76
 
77
- <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.8.309</div>
78
 
79
  <!-- SVG Filters for Liquid Glass Refraction -->
80
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
 
74
  </head>
75
  <body class="dark-theme in-chat-view">
76
 
77
+ <div id="live-version-badge" style="position: fixed; top: 50px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--text-secondary); opacity: 0.6; z-index: 99999; pointer-events: none; font-weight: 500; font-family: monospace; letter-spacing: 1px; background: rgba(0,0,0,0.2); padding: 2px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.05);">BUILD 1.8.310</div>
78
 
79
  <!-- SVG Filters for Liquid Glass Refraction -->
80
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
src/views/vocabulary-modal.js CHANGED
@@ -133,8 +133,13 @@ Nur das rohe JSON:`;
133
  try {
134
  const parsed = await fetchAITranslation(word);
135
  if (input.value.trim() === word) {
 
 
 
 
 
136
  currentTranslationResult = parsed;
137
- currentPreviewWord = word;
138
  previewText.innerHTML = parsed.back;
139
 
140
  // Switch to "Hinzufügen" mode
 
133
  try {
134
  const parsed = await fetchAITranslation(word);
135
  if (input.value.trim() === word) {
136
+ // If the AI corrected a typo, update the input field visually
137
+ if (parsed.front && parsed.front.toLowerCase() !== word.toLowerCase()) {
138
+ input.value = parsed.front;
139
+ }
140
+
141
  currentTranslationResult = parsed;
142
+ currentPreviewWord = input.value.trim(); // Update to potentially corrected word
143
  previewText.innerHTML = parsed.back;
144
 
145
  // Switch to "Hinzufügen" mode