Track frontend as regular files instead of a submodule

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Dev
2026-11-02 15:52:53 +08:00
co-authored by Cursor
parent 328b6917a3
commit 41ca22f59e
100 changed files with 7316 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
import { Task } from '../types';
export const generatePlan = async (goal: string): Promise<Task[]> => {
try {
const response = await fetch('/api/generate-plan', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ goal }),
});
if (!response.ok) {
const errorData = await response.json().catch(() => ({ error: 'Failed to generate plan from server.' }));
throw new Error(errorData.error || `Server responded with status ${response.status}`);
}
const tasks: Omit<Task, 'status'>[] = await response.json();
// Add the 'status' property to each task, same as before.
return tasks.map(task => ({
...task,
status: 'todo',
}));
} catch (error) {
console.error("Error generating plan:", error);
const message = error instanceof Error ? error.message : "An unknown error occurred.";
throw new Error(`Failed to generate a plan. ${message}`);
}
};