Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 35x 7x 7x 32x 41x 41x | /**
* Live-city links for /llms.txt and /llms-full.txt.
*
* Both files read the same API answer as the footer and sitemap
* (`loadPublicCities` → `liveCities`), through `createApiClient` so the
* request carries `X-API-Key`. A bare fetch without the key is a 401 on
* every deployed env, and the files used to fall back to Hyderabad only
* while five other cities were live (#1118 QA).
*/
import { createApiClient } from "../api";
import {
HYDERABAD_FALLBACK,
liveCities,
loadPublicCities,
type PublicCity,
} from "./live-directory";
type LlmsEnv = { API_URL?: string; MARKETPLACE_API_KEY?: string };
export async function loadLlmsLiveCities(env: LlmsEnv): Promise<PublicCity[]> {
if (!env.API_URL) return [HYDERABAD_FALLBACK];
const api = createApiClient(env.API_URL, env.MARKETPLACE_API_KEY);
return liveCities(await loadPublicCities(api));
}
export function liveCityLinkLines(site: string, cities: PublicCity[]): string {
return cities
.map((city) => {
const extra =
city.slug === "hyderabad"
? " — zones, localities, BHK packages, services, and approved cost ranges"
: "";
return `- [Interior designers in ${city.publicName}](${site}/interiors/${city.slug})${extra}`;
})
.join("\n");
}
|