Interactive Demo
+Click the button below to see some magic happen!
+ + +Counter Demo
+A simple counter implementation:
+To-Do List
+Add and manage your tasks:
+diff --git a/backend/agent/api.py b/backend/agent/api.py index 52f557e7..c0b1645f 100644 --- a/backend/agent/api.py +++ b/backend/agent/api.py @@ -84,6 +84,31 @@ async def restore_running_agent_runs(): "completed_at": datetime.now(timezone.utc).isoformat() }).eq("id", run['id']).execute() +async def check_for_active_project_agent_run(client, project_id: str): + """ + Check if there is an active agent run for any thread in the given project. + + Args: + client: The Supabase client + project_id: The project ID to check + + Raises: + HTTPException: If an agent run is already active for the project + """ + # Get all threads from this project + project_threads = await client.table('threads').select('thread_id').eq('project_id', project_id).execute() + project_thread_ids = [t['thread_id'] for t in project_threads.data] + + # Check if there are any active agent runs for any thread in this project + if project_thread_ids: + active_runs = await client.table('agent_runs').select('id').in_('thread_id', project_thread_ids).eq('status', 'running').execute() + + if active_runs.data and len(active_runs.data) > 0: + raise HTTPException( + status_code=409, + detail="Another agent is already running for this project. Please wait for it to complete or stop it before starting a new one." + ) + @router.post("/thread/{thread_id}/agent/start") async def start_agent(thread_id: str, user_id: str = Depends(get_current_user_id)): """Start an agent for a specific thread in the background.""" @@ -94,6 +119,16 @@ async def start_agent(thread_id: str, user_id: str = Depends(get_current_user_id # Verify user has access to this thread await verify_thread_access(client, thread_id, user_id) + # Get the project_id for this thread + thread_result = await client.table('threads').select('project_id').eq('thread_id', thread_id).execute() + if not thread_result.data: + raise HTTPException(status_code=404, detail="Thread not found") + + project_id = thread_result.data[0]['project_id'] + + # Check if there is already an active agent run for this project + await check_for_active_project_agent_run(client, project_id) + # Create a new agent run agent_run = await client.table('agent_runs').insert({ "thread_id": thread_id, diff --git a/backend/agent/workspace/README.md b/backend/agent/workspace/README.md deleted file mode 100644 index 8b705d12..00000000 --- a/backend/agent/workspace/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Brand Identity Business Card - -This is a modern, interactive business card design implemented with HTML, CSS, and JavaScript. - -## Features - -- Interactive flip animation to show front and back of the card -- Color theme customization with predefined color options -- Responsive design that works on different screen sizes -- Modern, clean aesthetic with attention to typography and spacing -- Social media icons and contact information - -## Usage - -1. Open `index.html` in any modern web browser -2. Click the "Flip Card" button to see both sides of the business card -3. Use the color dots below to change the card's color theme -4. You can also double-click on the card to flip it - -## Customization - -To customize this business card for your own use: - -1. Edit the HTML to change the name, title, and contact information -2. Modify the logo and branding elements in the CSS -3. Add or remove social media icons as needed -4. Adjust the color palette by changing the color option values - -## Technologies Used - -- HTML5 -- CSS3 (with variables, flexbox, and transitions) -- JavaScript -- Font Awesome for icons -- Google Fonts (Montserrat and Playfair Display) \ No newline at end of file diff --git a/backend/agent/workspace/index.html b/backend/agent/workspace/index.html index dd5bf1c8..63ba0a8a 100644 --- a/backend/agent/workspace/index.html +++ b/backend/agent/workspace/index.html @@ -3,55 +3,52 @@
-Creative Director
- -(555) 123-4567
-alex@acmecreative.com
-123 Design Street, Creative City
-www.acmecreative.com
-This is a simple demonstration of web development capabilities.
+Click the button below to see some magic happen!
+ + +A simple counter implementation:
+Add and manage your tasks:
+