Luca448 commited on
Commit
276bf11
·
1 Parent(s): 7edefc4

Fix: Native flashcard tool schema missing explanation and example

Browse files
Files changed (2) hide show
  1. index.html +1 -1
  2. src/ai/tools/flashcard-tool.js +10 -6
index.html CHANGED
@@ -51,7 +51,7 @@
51
  </head>
52
  <body class="dark-theme in-chat-view">
53
 
54
- <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.1.83</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
 
51
  </head>
52
  <body class="dark-theme in-chat-view">
53
 
54
+ <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.1.84</div>
55
 
56
  <!-- SVG Filters for Liquid Glass Refraction -->
57
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
src/ai/tools/flashcard-tool.js CHANGED
@@ -8,7 +8,7 @@ export const flashcardToolDef = {
8
  properties: {
9
  deck_title: {
10
  type: "string",
11
- description: "Name des Stapels (z.B. 'Spanisch Vokabeln' oder 'Biologie Klausur')"
12
  },
13
  cards: {
14
  type: "array",
@@ -16,11 +16,13 @@ export const flashcardToolDef = {
16
  items: {
17
  type: "object",
18
  properties: {
19
- front: { type: "string", description: "Vorderseite (Frage/Begriff)" },
20
- back: { type: "string", description: "Rückseite (Antwort/Erklärung)" },
21
- search_query: { type: "string", description: "Suchbegriff, um ein passendes Hintergrundbild auf Wikipedia zu finden (optional, idealerweise Englisch für bessere Ergebnisse)" }
 
 
22
  },
23
- required: ["front", "back"]
24
  }
25
  }
26
  },
@@ -76,7 +78,9 @@ export async function executeFlashcards(args, onStatus) {
76
  console.warn('Failed to fetch image for flashcard:', e);
77
  }
78
 
79
- db.addFlashcard(deck.id, card.front, card.back, imageUrl);
 
 
80
  addedCount++;
81
  }
82
 
 
8
  properties: {
9
  deck_title: {
10
  type: "string",
11
+ description: "Name des Stapels (z.B. 'Englisch Vokabeln')"
12
  },
13
  cards: {
14
  type: "array",
 
16
  items: {
17
  type: "object",
18
  properties: {
19
+ front: { type: "string", description: "Vorderseite (Frage/Begriff/Vokabel)" },
20
+ back: { type: "string", description: "Kurze Antwort/Übersetzung" },
21
+ explanation: { type: "string", description: "Erklärung in 1-2 Sätzen" },
22
+ example: { type: "string", description: "Ein passender Beispielsatz" },
23
+ search_query: { type: "string", description: "Ein SEHR SIMPLER englischer Suchbegriff für ein Wikipedia-Bild, das GANZ OFFENSICHTLICH zum Wort passt. Füge am Ende 'single photo, clear focus, high quality' hinzu." }
24
  },
25
+ required: ["front", "back", "explanation", "example", "search_query"]
26
  }
27
  }
28
  },
 
78
  console.warn('Failed to fetch image for flashcard:', e);
79
  }
80
 
81
+ const richBack = `${card.back}\n\n**Erklärung:** ${card.explanation || ''}\n\n**Beispiel:** ${card.example || ''}`;
82
+
83
+ db.addFlashcard(deck.id, card.front, richBack, imageUrl);
84
  addedCount++;
85
  }
86