Leon4gr45 commited on
Commit
b699aa6
·
verified ·
1 Parent(s): 9537f47

Move mandatory endpoints to root /health and /api-docs

Browse files
Files changed (3) hide show
  1. Agent.md +2 -2
  2. app/api-docs/route.ts +107 -0
  3. app/health/route.ts +5 -0
Agent.md CHANGED
@@ -14,8 +14,8 @@ This codebase is configured for deployment on Hugging Face Spaces.
14
  - **SDK:** docker
15
 
16
  ## Mandatory Endpoints
17
- - /api/health: Returns HTTP 200 when ready.
18
- - /api/api-docs: Documentation of all API endpoints.
19
 
20
  ## HF Space Secrets
21
  To fully configure the application, the following secrets should be set in the Hugging Face Space settings:
 
14
  - **SDK:** docker
15
 
16
  ## Mandatory Endpoints
17
+ - /health: Returns HTTP 200 when ready.
18
+ - /api-docs: Documentation of all API endpoints.
19
 
20
  ## HF Space Secrets
21
  To fully configure the application, the following secrets should be set in the Hugging Face Space settings:
app/api-docs/route.ts ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { NextResponse } from 'next/server';
2
+
3
+ export async function GET() {
4
+ const docs = {
5
+ endpoints: [
6
+ {
7
+ path: "/health",
8
+ method: "GET",
9
+ purpose: "Health check endpoint",
10
+ response: { status: "ok" }
11
+ },
12
+ {
13
+ path: "/api-docs",
14
+ method: "GET",
15
+ purpose: "API Documentation",
16
+ response: { endpoints: "[]" }
17
+ },
18
+ {
19
+ path: "/api/submit-job",
20
+ method: "POST",
21
+ purpose: "Transform a research paper into code and push to GitHub",
22
+ request: {
23
+ arxivUrl: "string (optional)",
24
+ paperContent: "string (optional)",
25
+ repo: "string (required, e.g., 'owner/repo')",
26
+ paperName: "string (optional)",
27
+ model: "string (optional)"
28
+ },
29
+ response: {
30
+ success: true,
31
+ githubUrl: "string",
32
+ branch: "string",
33
+ filesCount: "number"
34
+ }
35
+ },
36
+ {
37
+ path: "/api/scrape-website",
38
+ method: "POST",
39
+ purpose: "Scrape a website and return its content in markdown/HTML",
40
+ request: {
41
+ url: "string (required)",
42
+ formats: "string[] (optional, default: ['markdown', 'html'])"
43
+ },
44
+ response: {
45
+ success: true,
46
+ data: {
47
+ title: "string",
48
+ content: "string",
49
+ markdown: "string",
50
+ html: "string"
51
+ }
52
+ }
53
+ },
54
+ {
55
+ path: "/api/search",
56
+ method: "POST",
57
+ purpose: "Perform a web search using Firecrawl",
58
+ request: {
59
+ query: "string (required)"
60
+ },
61
+ response: {
62
+ results: [
63
+ {
64
+ url: "string",
65
+ title: "string",
66
+ description: "string",
67
+ screenshot: "string | null",
68
+ markdown: "string"
69
+ }
70
+ ]
71
+ }
72
+ },
73
+ {
74
+ path: "/api/analyze-edit-intent",
75
+ method: "POST",
76
+ purpose: "Analyze intent for editing code",
77
+ request: {
78
+ prompt: "string",
79
+ files: "any[]"
80
+ },
81
+ response: {
82
+ intent: "string"
83
+ }
84
+ },
85
+ {
86
+ path: "/api/apply-ai-code",
87
+ method: "POST",
88
+ purpose: "Apply AI generated code changes",
89
+ request: {
90
+ code: "string",
91
+ sandboxId: "string"
92
+ },
93
+ response: {
94
+ success: "boolean"
95
+ }
96
+ },
97
+ {
98
+ path: "/api/conversation-state",
99
+ method: "GET/POST/DELETE",
100
+ purpose: "Manage conversation state",
101
+ request: "Varies",
102
+ response: "Varies"
103
+ }
104
+ ]
105
+ };
106
+ return NextResponse.json(docs);
107
+ }
app/health/route.ts ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import { NextResponse } from 'next/server';
2
+
3
+ export async function GET() {
4
+ return NextResponse.json({ status: 'ok' });
5
+ }