fix: strict anti-hallucination default prompt

- Replace creative/warm tone with factual summarization
- Explicitly forbid invention, assumption, or hallucination
- Model must ONLY use information from provided entries
- Acknowledge gaps rather than fill them
This commit is contained in:
lotherk
2026-03-26 20:29:40 +00:00
parent a4e7132244
commit 37871271cc
9 changed files with 120 additions and 37 deletions

View File

@@ -7,6 +7,7 @@ import History from './pages/History';
import Day from './pages/Day';
import Journal from './pages/Journal';
import Settings from './pages/Settings';
import { useTheme } from './lib/ThemeContext';
function PrivateRoute({ children }: { children: React.ReactNode }) {
const [isAuthenticated, setIsAuthenticated] = useState<boolean | null>(null);
@@ -25,29 +26,43 @@ function PrivateRoute({ children }: { children: React.ReactNode }) {
}
if (!isAuthenticated) {
return <Navigate to="/auth" replace />;
return <Navigate to="/login" replace />;
}
return <>{children}</>;
}
function Navbar() {
return (
<nav className="bg-slate-900 border-b border-slate-800 sticky top-0 z-50">
<div className="max-w-4xl mx-auto px-4 py-3 flex items-center justify-between">
<a href="/" className="flex items-center gap-2">
<span className="text-lg font-bold bg-gradient-to-r from-purple-400 to-pink-400 bg-clip-text text-transparent">
DearDiary.io
</span>
</a>
<div className="flex gap-6">
<a href="/" className="text-slate-300 hover:text-white transition">Today</a>
<a href="/history" className="text-slate-300 hover:text-white transition">History</a>
<a href="/settings" className="text-slate-300 hover:text-white transition">Settings</a>
</div>
</div>
</nav>
);
}
function App() {
const [isAuthenticated, setIsAuthenticated] = useState(false);
const [loading, setLoading] = useState(true);
const [isAuthenticated, setIsAuthenticated] = useState<boolean | null>(null);
const { resolvedTheme } = useTheme();
useEffect(() => {
const key = api.getApiKey();
setIsAuthenticated(!!key);
setLoading(false);
}, []);
const handleAuth = () => {
setIsAuthenticated(true);
};
if (loading) {
if (isAuthenticated === null) {
return (
<div className="min-h-screen flex items-center justify-center bg-slate-950">
<div className={`min-h-screen flex items-center justify-center ${resolvedTheme === 'dark' ? 'bg-slate-950' : 'bg-white'}`}>
<div className="animate-pulse text-slate-400">Loading...</div>
</div>
);
@@ -55,26 +70,11 @@ function App() {
return (
<BrowserRouter>
<div className="min-h-screen bg-slate-950 text-slate-100">
{isAuthenticated && (
<nav className="bg-slate-900 border-b border-slate-800 sticky top-0 z-50">
<div className="max-w-4xl mx-auto px-4 py-3 flex items-center justify-between">
<a href="/" className="flex items-center gap-2">
<span className="text-lg font-bold bg-gradient-to-r from-purple-400 to-pink-400 bg-clip-text text-transparent">
DearDiary.io
</span>
</a>
<div className="flex gap-6">
<a href="/" className="text-slate-300 hover:text-white transition">Today</a>
<a href="/history" className="text-slate-300 hover:text-white transition">History</a>
<a href="/settings" className="text-slate-300 hover:text-white transition">Settings</a>
</div>
</div>
</nav>
)}
<div className={`min-h-screen ${resolvedTheme === 'dark' ? 'bg-slate-950 text-slate-100' : 'bg-white text-slate-900'}`}>
{isAuthenticated ? <Navbar /> : null}
<Routes>
<Route path="/auth" element={
isAuthenticated ? <Navigate to="/" replace /> : <Auth onAuth={handleAuth} />
<Route path="/login" element={
isAuthenticated ? <Navigate to="/" replace /> : <Auth onAuth={() => setIsAuthenticated(true)} />
} />
<Route path="/" element={
<PrivateRoute><Home /></PrivateRoute>

View File

@@ -33,7 +33,7 @@ export default function SettingsPage() {
const handleLogout = () => {
api.clearApiKey();
window.location.href = '/auth';
window.location.href = '/login';
};
if (loading) {