feat: implement PocketBase database schema setup script and core API service for content management
This commit is contained in:
@@ -30,11 +30,11 @@ export const anthropicApi = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'anthropic-version': '2023-06-01',
|
||||
'anthropic-dangerous-direct-browser-access': 'true'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
model: model,
|
||||
max_tokens: 4000,
|
||||
temperature: 0,
|
||||
system: systemPrompt,
|
||||
messages: [{ role: 'user', content: userMessage }]
|
||||
})
|
||||
|
||||
@@ -205,7 +205,8 @@ export async function setLearnDone(userId, weekNumber) {
|
||||
// ── Leaderboard ───────────────────────────────────────────────────────────────
|
||||
|
||||
export async function getLeaderboard() {
|
||||
return pb.collection('leaderboard').getFullList({ sort: '-points' });
|
||||
const entries = await pb.collection('leaderboard').getFullList();
|
||||
return entries.sort((a, b) => (b.points || 0) - (a.points || 0));
|
||||
}
|
||||
|
||||
export async function upsertLeaderboardEntry(userId, name, pointsDelta, testsCompletedDelta = 0) {
|
||||
|
||||
@@ -104,7 +104,7 @@ const Admin = () => {
|
||||
<div>
|
||||
<p className="font-medium">{source.name}</p>
|
||||
<p className="text-xs text-fg-muted flex items-center gap-1 mt-1">
|
||||
<Clock size={12} /> {new Date(source.created).toLocaleString()}
|
||||
<Clock size={12} /> {source.created ? new Date(source.created).toLocaleString() : '—'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user