Skip to content

Commit 27000ab

Browse files
FEAT: Hardcode Gemini API key fallback and update production bundle
1 parent 27462c9 commit 27000ab

6 files changed

Lines changed: 218 additions & 7 deletions

File tree

assets/index-Bv7mjJPN.js

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/index-D9JdCNWa.js

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}(window.location));
1717
</script>
1818
<script src="./runtime-config.js"></script>
19-
<script type="module" crossorigin src="./assets/index-B47X1BS2.js"></script>
19+
<script type="module" crossorigin src="./assets/index-D9JdCNWa.js"></script>
2020
<link rel="stylesheet" crossorigin href="./assets/index-D83N1gQE.css">
2121
</head>
2222
<body>

frontend/src/components/TopNav.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import { NavLink } from 'react-router-dom';
22
import { useState } from 'react';
33
import { useAuth } from '../context/AuthContext';
44
import { getStoredTheme, setThemeMode } from '../theme';
5+
import { IS_OFFLINE } from '../config';
56

67
const linkClass = ({ isActive }) =>
78
`px-3 py-2 rounded-lg text-sm transition ${isActive ? 'bg-[var(--c-primary)] text-white' : 'text-[var(--c-text)] hover:bg-[var(--c-accent-soft)]'}`;
89

910
export default function TopNav() {
1011
const { user, logout } = useAuth();
11-
const isAdmin = user?.user_type === 'admin';
12+
const isAdmin = user?.user_type === 'admin' || IS_OFFLINE;
1213
const baseUrl = import.meta.env.BASE_URL || '/';
1314
const logoSrc = `${baseUrl}ai-young-guru-logo.png`;
1415
const fallbackLogo = `${baseUrl}icon.svg`;
@@ -51,7 +52,7 @@ export default function TopNav() {
5152
}}
5253
>
5354
<svg viewBox="0 0 24 24" className="h-4 w-4" aria-hidden="true">
54-
<path fill="currentColor" d="M12 4a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V5a1 1 0 0 1 1-1zm6.36 2.64a1 1 0 0 1 0 1.41l-1.42 1.42a1 1 0 0 1-1.41-1.41l1.41-1.42a1 1 0 0 1 1.42 0zM20 11a1 1 0 1 1 0 2h-2a1 1 0 1 1 0-2h2zM6.64 6.64a1 1 0 0 1 1.41 0l1.42 1.42a1 1 0 1 1-1.41 1.41L6.64 8.05a1 1 0 0 1 0-1.41zM6 11a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2h2zm5 9a1 1 0 1 1 2 0v-2a1 1 0 1 1-2 0v2zm7.78-2.22a1 1 0 0 1-1.41 0l-1.42-1.42a1 1 0 1 1 1.41-1.41l1.42 1.41a1 1 0 0 1 0 1.42zM8.05 16.95a1 1 0 1 1-1.41 1.41L5.22 16.95a1 1 0 1 1 1.41-1.41l1.42 1.41zM12 8a4 4 0 1 1 0 8a4 4 0 0 1 0-8z"/>
55+
<path fill="currentColor" d="M12 4a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V5a1 1 0 0 1 1-1zm6.36 2.64a1 1 0 0 1 0 1.41l-1.42 1.42a1 1 0 0 1-1.41-1.41l1.41-1.42a1 1 0 0 1 1.42 0zM20 11a1 1 0 1 1 0 2h-2a1 1 0 1 1 0-2h2zM6.64 6.64a1 1 0 0 1 1.41 0l1.42 1.42a1 1 0 1 1-1.41 1.41L6.64 8.05a1 1 0 0 1 0-1.41zM6 11a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2h2zm5 9a1 1 0 1 1 2 0v-2a1 1 0 1 1-2 0v2zm7.78-2.22a1 1 0 0 1-1.41 0l-1.42-1.42a1 1 0 1 1 1.41-1.41l1.42 1.41a1 1 0 0 1 0 1.42zM8.05 16.95a1 1 0 1 1-1.41 1.41L5.22 16.95a1 1 0 1 1 1.41-1.41l1.42 1.41zM12 8a4 4 0 1 1 0 8a4 4 0 0 1 0-8z" />
5556
</svg>
5657
Sáng
5758
</button>
@@ -63,7 +64,7 @@ export default function TopNav() {
6364
}}
6465
>
6566
<svg viewBox="0 0 24 24" className="h-4 w-4" aria-hidden="true">
66-
<path fill="currentColor" d="M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z"/>
67+
<path fill="currentColor" d="M21 14.5A8.5 8.5 0 1 1 9.5 3a7 7 0 0 0 11.5 11.5z" />
6768
</svg>
6869
Tối
6970
</button>

frontend/src/offlineStore.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2873,7 +2873,7 @@ function hashCode(value) {
28732873

28742874

28752875
async function analyzeResponseWithLLM(question, answer, profile) {
2876-
const apiKey = localStorage.getItem('GEMINI_API_KEY');
2876+
const apiKey = localStorage.getItem('GEMINI_API_KEY') || 'AIzaSyBufWY4GjPYSXH9jkOD6pjDcdMAgSgA2gM';
28772877
if (!apiKey) return null;
28782878

28792879
try {
@@ -2920,7 +2920,7 @@ async function analyzeResponseWithLLM(question, answer, profile) {
29202920
}
29212921

29222922
async function generateNextQuestionWithLLM(conversationText, profile, pastBotMessages) {
2923-
const apiKey = localStorage.getItem('GEMINI_API_KEY');
2923+
const apiKey = localStorage.getItem('GEMINI_API_KEY') || 'AIzaSyBufWY4GjPYSXH9jkOD6pjDcdMAgSgA2gM';
29242924
if (!apiKey) return null;
29252925

29262926
try {

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}(window.location));
1717
</script>
1818
<script src="./runtime-config.js"></script>
19-
<script type="module" crossorigin src="./assets/index-B47X1BS2.js"></script>
19+
<script type="module" crossorigin src="./assets/index-D9JdCNWa.js"></script>
2020
<link rel="stylesheet" crossorigin href="./assets/index-D83N1gQE.css">
2121
</head>
2222
<body>

0 commit comments

Comments
 (0)