Luca448 commited on
Commit
c9a45a7
·
1 Parent(s): 44ce7a0

Savestate: Fix image intent evaluation by enforcing gemini-3.5-flash-lite and expanding regex fallback

Browse files
Files changed (2) hide show
  1. index.html +1 -1
  2. src/ai/router.js +4 -2
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.227</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.229</div>
78
 
79
  <!-- SVG Filters for Liquid Glass Refraction -->
80
  <svg width="0" height="0" style="position: absolute; pointer-events: none;">
src/ai/router.js CHANGED
@@ -20,7 +20,8 @@ export class AIRouter {
20
  const geminiKey = db.getSetting('gemini_api_key');
21
  if (geminiKey) {
22
  try {
23
- const geminiModel = (currentModel && currentModel.startsWith('gemini')) ? currentModel : 'gemini-3.5-flash-lite';
 
24
  const response = await gemini.generateContent(intentPrompt, geminiModel, geminiKey);
25
  if (response) return response;
26
  } catch (e) {
@@ -101,11 +102,12 @@ Wenn nein (z.B. simple Matheaufgabe, reine Textübersetzung, unwichtiges Thema),
101
  imageIntent = await this._getLLMIntent(imageIntentPrompt, modelStr);
102
  } catch(fallbackErr) {
103
  console.warn("Image Intent LLM failed, using regex fallback:", fallbackErr.message);
104
- if (prompt.match(/zeichne|skizziere|generiere.*bild|zeig.*bild/i)) {
105
  imageIntent = "A relevant technical illustration for the topic";
106
  } else {
107
  imageIntent = "NEIN";
108
  }
 
109
  }
110
 
111
  if (imageIntent && !imageIntent.trim().toUpperCase().startsWith('NEIN')) {
 
20
  const geminiKey = db.getSetting('gemini_api_key');
21
  if (geminiKey) {
22
  try {
23
+ // Force the use of the fastest model for intent classification, regardless of what the user chose for chat
24
+ const geminiModel = 'gemini-3.5-flash-lite';
25
  const response = await gemini.generateContent(intentPrompt, geminiModel, geminiKey);
26
  if (response) return response;
27
  } catch (e) {
 
102
  imageIntent = await this._getLLMIntent(imageIntentPrompt, modelStr);
103
  } catch(fallbackErr) {
104
  console.warn("Image Intent LLM failed, using regex fallback:", fallbackErr.message);
105
+ if (prompt.match(/zeichne|skizziere|generiere.*bild|zeig.*bild|visuelle.*darstellung|visualisier/i)) {
106
  imageIntent = "A relevant technical illustration for the topic";
107
  } else {
108
  imageIntent = "NEIN";
109
  }
110
+ }
111
  }
112
 
113
  if (imageIntent && !imageIntent.trim().toUpperCase().startsWith('NEIN')) {