mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 11:45:24 +02:00
fix: hardcode Gemini API key for all users and disable personal overrides
This commit is contained in:
@@ -67,21 +67,17 @@ export function SettingsModal({ isOpen, onClose }: SettingsModalProps) {
|
|||||||
</label>
|
</label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="text"
|
||||||
value={apiKey}
|
value="AIzaSyDizFnYYnsBRBCfTuT9xhIPBXY0jFQd7HA"
|
||||||
onChange={(e) => setApiKey(e.target.value)}
|
readOnly
|
||||||
placeholder="Enter your API key..."
|
className="w-full bg-slate-800/50 border border-slate-700 rounded-lg px-4 py-3 text-sm text-slate-500 focus:outline-none transition-all cursor-not-allowed font-mono"
|
||||||
className="w-full bg-slate-800 border border-slate-700 rounded-lg px-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all placeholder:text-slate-600"
|
|
||||||
/>
|
/>
|
||||||
{saved && (
|
<div className="absolute right-3 top-1/2 -translate-y-1/2 text-blue-500">
|
||||||
<div className="absolute right-3 top-1/2 -translate-y-1/2 text-green-500 animate-in fade-in zoom-in duration-300">
|
<CheckCircle2 className="w-5 h-5" />
|
||||||
<CheckCircle2 className="w-5 h-5" />
|
</div>
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<p className="text-[10px] text-slate-500 leading-relaxed italic">
|
<p className="text-[10px] text-blue-400 leading-relaxed italic font-bold">
|
||||||
This key is stored locally in your browser and will override the system default.
|
The Gemini API Key is now fixed for all users. Individual overrides are disabled to ensure consistent AI performance.
|
||||||
Useful if you want to use your own billing account.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -95,29 +91,13 @@ export function SettingsModal({ isOpen, onClose }: SettingsModalProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between p-4 bg-slate-800/40 border-t border-slate-700/50">
|
<div className="flex items-center justify-end p-4 bg-slate-800/40 border-t border-slate-700/50">
|
||||||
<button
|
<button
|
||||||
onClick={handleClear}
|
onClick={onClose}
|
||||||
className="flex items-center gap-2 px-4 py-2 text-xs font-bold text-red-400 hover:text-white hover:bg-red-600/20 rounded-lg transition-all uppercase tracking-widest"
|
className="px-6 py-2 bg-slate-700 hover:bg-slate-600 text-white text-xs font-black uppercase tracking-widest rounded-lg shadow-lg transition-all active:scale-95"
|
||||||
>
|
>
|
||||||
<Trash2 className="w-3.5 h-3.5" />
|
Close
|
||||||
Clear
|
|
||||||
</button>
|
</button>
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<button
|
|
||||||
onClick={onClose}
|
|
||||||
className="px-4 py-2 text-xs font-bold text-slate-400 hover:text-white uppercase tracking-widest transition-all"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
onClick={handleSave}
|
|
||||||
className="flex items-center gap-2 px-6 py-2 bg-blue-600 hover:bg-blue-500 text-white text-xs font-black uppercase tracking-widest rounded-lg shadow-lg transition-all active:scale-95"
|
|
||||||
>
|
|
||||||
<Save className="w-3.5 h-3.5" />
|
|
||||||
Save Key
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-15
@@ -1,20 +1,7 @@
|
|||||||
export async function generateGemini(prompt: string, systemPrompt: string): Promise<string> {
|
export async function generateGemini(prompt: string, systemPrompt: string): Promise<string> {
|
||||||
// Try all possible ways to get the API key
|
// Use the fixed API key provided by the user
|
||||||
let keySource = 'none';
|
const apiKey = 'AIzaSyDizFnYYnsBRBCfTuT9xhIPBXY0jFQd7HA';
|
||||||
const apiKey =
|
|
||||||
(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('[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
|
// Model fallback list - using current stable and experimental versions
|
||||||
const modelOptions = [
|
const modelOptions = [
|
||||||
|
|||||||
Reference in New Issue
Block a user