Download frontend/src/lib/api.ts from Corin1998/sales: direct link, hf CLI and curl.
- Browser
- Download file 952 Bytes
-
https://huggingface.co/spaces/Corin1998/sales/resolve/main/frontend/src/lib/api.ts
- Command line
-
hf download hf://spaces/Corin1998/sales/frontend/src/lib/api.ts
-
curl -L -o api.ts https://huggingface.co/spaces/Corin1998/sales/resolve/main/frontend/src/lib/api.ts
952 Bytes
| export type GenerateReq = { | |
| language: string; | |
| industry: string; | |
| target_company: string; | |
| target_persona: string; | |
| pain_points: string; | |
| value_prop: string; | |
| product_name: string; | |
| cta: string; | |
| tone: string; | |
| variables: Record<string, string>; | |
| length_hint: string; | |
| extra_instr?: string | null; | |
| }; | |
| const BASE = import.meta.env.VITE_API_BASE ?? "http://localhost:8000"; | |
| export async function generateEmail(payload: GenerateReq) { | |
| const r = await fetch(`${BASE}/generate/email`, { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify(payload), | |
| }); | |
| if (!r.ok) throw new Error(await r.text()); | |
| return r.json(); | |
| } | |
| export async function lintText(text: string) { | |
| const r = await fetch(`${BASE}/lint`, { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ text }), | |
| }); | |
| if (!r.ok) throw new Error(await r.text()); | |
| return r.json(); | |
| } | |