Added some features :D, Codex limits are burned out by GPT 6 Astra D:

This commit is contained in:
2026-10-05 19:33:00 +05:00
parent b33db48b63
commit 923abdc472
23 changed files with 538 additions and 53 deletions

View File

@@ -180,7 +180,7 @@ export async function handle(request: NextRequest, path: string[]) {
.order("round_number"),
);
const signed = await mediaUrls([
`${revision.asset_root}/map.webp`,
manifest.mapPath ?? `${revision.asset_root}/map.webp`,
...rounds.flatMap((r) =>
faces.map((f) =>
panoramaPath(
@@ -332,7 +332,7 @@ export async function handle(request: NextRequest, path: string[]) {
await client
.from("datasets")
.select(
"*, upload_jobs(state,progress,error,updated_at,lease_until)",
"*, upload_jobs(state,progress,error,updated_at,lease_until,kind)",
)
.eq("owner_id", owner)
.order("created_at", { ascending: false }),
@@ -348,6 +348,56 @@ export async function handle(request: NextRequest, path: string[]) {
});
}
const d = await ownedDataset(request, path[1]);
if (path[2] === "refresh-map") {
if (method === "POST") {
const body = z
.object({ sourceId: idSchema })
.parse(await jsonBody(request));
await limit("map-refresh:" + d.owner_id, 6, 3600);
checkServiceError(
(
await client.rpc("refresh_map", {
p_dataset: d.id,
p_owner: d.owner_id,
p_source: body.sourceId,
})
).error,
);
return NextResponse.json({ ok: true });
}
if (method === "GET") {
const sources = required(
await client
.from("datasets")
.select(
"id,name,bounds,source,created_at,owner_id,parent_dataset_id,contribution_status",
)
.or("owner_id.eq." + d.owner_id + ",parent_dataset_id.eq." + d.id)
.not("map_path", "is", null)
.in("state", ["draft", "rejected", "review", "published"])
.order("created_at", { ascending: false }),
);
return NextResponse.json({
sources: sources
.filter(
(s) =>
(s.owner_id === d.owner_id ||
s.contribution_status === "accepted") &&
["minX", "minZ", "maxX", "maxZ"].every(
(k) =>
(s.bounds as Record<string, number>)[k] ===
(d.bounds as Record<string, number>)[k],
),
)
.map((s) => ({
id: s.id,
name: s.name,
source: s.source,
created_at: s.created_at,
})),
});
}
}
if (method === "GET" && path[2] === "panoramas") {
const input = required(
await client
@@ -385,7 +435,7 @@ export async function handle(request: NextRequest, path: string[]) {
description: manifest.description,
panorama_count: manifest.viewpoints.length,
manifest,
map: await mediaUrl(d.map_path),
map: await mediaUrl(manifest.mapPath ?? d.map_path),
previews: await Promise.all(
(manifest.availableViewpoints ?? manifest.viewpoints).map(
async (p, index) => ({
@@ -764,7 +814,7 @@ export async function handle(request: NextRequest, path: string[]) {
description: pending?.description ?? m.description,
panorama_count: pending?.viewpoints.length ?? m.panorama_count,
image: await mediaUrl(m.cover_path),
map: await mediaUrl(m.map_path),
map: await mediaUrl(pending?.mapPath ?? m.map_path),
};
}),
),