mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 11:55:23 +02:00
debug: add API key source logging
This commit is contained in:
@@ -1289,7 +1289,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
|
||||
const colKey = `prc_${col.index}`;
|
||||
const width = columnWidths[colKey] ?? 100;
|
||||
return (
|
||||
<th key={col.index} style={{ width, ...(isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0 } : {}) }} className={cn(
|
||||
<th key={col.index} style={{ width, ...(isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0, zIndex: getStickyRank(colKey) ?? 0 } : {}) }} className={cn(
|
||||
"text-left px-3 py-3 text-xs font-semibold text-blue-400 uppercase tracking-wider whitespace-nowrap group cursor-pointer hover:bg-slate-800/50 transition-colors relative",
|
||||
isPinned(colKey) && "sticky bg-slate-900"
|
||||
)} onClick={() => handleSort(col.index)}>
|
||||
@@ -1332,7 +1332,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
|
||||
|
||||
<th style={{ width: columnWidths.unitsOuter, ...(isPinned('unitsOuter') ? { left: getStickyLeft('unitsOuter') ?? 0 } : {}) }} className={cn(
|
||||
"text-left px-3 py-3 text-xs font-semibold text-slate-400 uppercase tracking-wider whitespace-nowrap group cursor-pointer hover:bg-slate-800/50 transition-colors relative",
|
||||
isPinned('unitsOuter') && "sticky bg-slate-900 z-20"
|
||||
isPinned('unitsOuter') && "sticky bg-slate-900"
|
||||
)} onClick={() => handleSort('unitsOuter')}>
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="truncate flex items-center gap-1">
|
||||
@@ -1458,7 +1458,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
|
||||
const colKey = `con_${col.index}`;
|
||||
const width = columnWidths[colKey] ?? 110;
|
||||
return (
|
||||
<th key={col.index} style={{ width, ...(isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0 } : {}) }} className={cn(
|
||||
<th key={col.index} style={{ width, ...(isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0, zIndex: getStickyRank(colKey) ?? 0 } : {}) }} className={cn(
|
||||
"text-left px-3 py-3 text-xs font-semibold text-orange-400 uppercase tracking-wider whitespace-nowrap group cursor-pointer hover:bg-slate-800/50 transition-colors relative",
|
||||
isPinned(colKey) && "sticky bg-slate-900"
|
||||
)} onClick={() => handleSort(col.index)}>
|
||||
@@ -1697,7 +1697,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
|
||||
const colKey = `prc_${col.index}`;
|
||||
|
||||
return (
|
||||
<td key={col.index} className={cn("px-3 py-2 overflow-hidden", isPinned(colKey) && "sticky bg-slate-800 z-10")} style={isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0 } : {}}>
|
||||
<td key={col.index} className={cn("px-3 py-2 overflow-hidden", isPinned(colKey) && "sticky bg-slate-800 z-10")} style={isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0, zIndex: getStickyRank(colKey) ?? 0 } : {}}>
|
||||
{isEditing ? (
|
||||
<div className="flex items-center gap-1">
|
||||
<input
|
||||
@@ -1755,7 +1755,7 @@ export function PricingView({ data, headers, onSaveRow, onCaptureState, onEdit,
|
||||
{containerCols.map(col => {
|
||||
const colKey = `con_${col.index}`;
|
||||
return (
|
||||
<td key={col.index} className={cn("px-3 py-2.5 overflow-hidden truncate", isPinned(colKey) && "sticky bg-slate-800 z-10")} style={isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0 } : {}}>
|
||||
<td key={col.index} className={cn("px-3 py-2.5 overflow-hidden truncate", isPinned(colKey) && "sticky bg-slate-800 z-10")} style={isPinned(colKey) ? { left: getStickyLeft(colKey) ?? 0, zIndex: getStickyRank(colKey) ?? 0 } : {}}>
|
||||
{unitBadge(row[col.index], col.name)}
|
||||
</td>
|
||||
);
|
||||
|
||||
+10
-7
@@ -1,16 +1,19 @@
|
||||
export async function generateGemini(prompt: string, systemPrompt: string): Promise<string> {
|
||||
// Try all possible ways to get the API key
|
||||
let keySource = 'none';
|
||||
const apiKey =
|
||||
(window as any).GEMINI_API_KEY ||
|
||||
localStorage.getItem('GEMINI_API_KEY') ||
|
||||
import.meta.env.VITE_GEMINI_API_KEY ||
|
||||
import.meta.env.GEMINI_API_KEY ||
|
||||
(process.env as any).GEMINI_API_KEY ||
|
||||
(window as any).GEMINI_API_KEY ? (keySource = 'window', (window as any).GEMINI_API_KEY) :
|
||||
localStorage.getItem('GEMINI_API_KEY') ? (keySource = 'localStorage', localStorage.getItem('GEMINI_API_KEY')) :
|
||||
import.meta.env.VITE_GEMINI_API_KEY ? (keySource = 'import.meta.env.VITE_GEMINI_API_KEY', import.meta.env.VITE_GEMINI_API_KEY) :
|
||||
import.meta.env.GEMINI_API_KEY ? (keySource = 'import.meta.env.GEMINI_API_KEY', import.meta.env.GEMINI_API_KEY) :
|
||||
(process.env as any).GEMINI_API_KEY ? (keySource = 'process.env', (process.env as any).GEMINI_API_KEY) :
|
||||
'';
|
||||
|
||||
console.log(`[Gemini] API Key source: ${keySource}`);
|
||||
|
||||
if (!apiKey) {
|
||||
console.error('No Gemini API Key found in env or storage');
|
||||
throw new Error('Gemini API Key not found. Please set VITE_GEMINI_API_KEY in .env or GEMINI_API_KEY in localStorage.');
|
||||
console.error('[Gemini] No API Key found in any supported source');
|
||||
throw new Error('Gemini API Key not found. Please set VITE_GEMINI_API_KEY in .env or your environment variables.');
|
||||
}
|
||||
|
||||
// Model fallback list - using current stable and experimental versions
|
||||
|
||||
Reference in New Issue
Block a user