Spaces:
Running
Running
Upload 36 files
Browse files- .copilot_token +1 -0
- Dockerfile +7 -0
- api/__init__.py +0 -0
- api/__pycache__/__init__.cpython-311.pyc +0 -0
- api/__pycache__/admin.cpython-311.pyc +0 -0
- api/__pycache__/apps.cpython-311.pyc +0 -0
- api/__pycache__/models.cpython-311.pyc +0 -0
- api/__pycache__/urls.cpython-311.pyc +0 -0
- api/__pycache__/views.cpython-311.pyc +0 -0
- api/admin.py +16 -0
- api/apps.py +6 -0
- api/migrations/0001_initial.py +94 -0
- api/migrations/0002_version_versioncount_version_versionmessage.py +22 -0
- api/migrations/0003_projects_totalversions.py +17 -0
- api/migrations/__init__.py +0 -0
- api/migrations/__pycache__/0001_initial.cpython-311.pyc +0 -0
- api/migrations/__pycache__/0002_version_versioncount_version_versionmessage.cpython-311.pyc +0 -0
- api/migrations/__pycache__/0003_projects_totalversions.cpython-311.pyc +0 -0
- api/migrations/__pycache__/__init__.cpython-311.pyc +0 -0
- api/models.py +36 -0
- api/tests.py +3 -0
- api/urls.py +12 -0
- api/views.py +301 -0
- data.json +1 -0
- db.sqlite3 +0 -0
- instabuild/__init__.py +0 -0
- instabuild/__pycache__/__init__.cpython-311.pyc +0 -0
- instabuild/__pycache__/settings.cpython-311.pyc +0 -0
- instabuild/__pycache__/urls.cpython-311.pyc +0 -0
- instabuild/__pycache__/wsgi.cpython-311.pyc +0 -0
- instabuild/asgi.py +16 -0
- instabuild/settings.py +137 -0
- instabuild/urls.py +8 -0
- instabuild/wsgi.py +16 -0
- manage.py +22 -0
- requirements.txt +15 -0
.copilot_token
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ghu_GefTyLn5REuJ7m07ntvISK7gyR7tB22sCfL1
|
Dockerfile
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3
|
2 |
+
WORKDIR /usr/src/app
|
3 |
+
COPY requirements.txt ./
|
4 |
+
RUN pip install -r requirements.txt
|
5 |
+
COPY . .
|
6 |
+
EXPOSE 7860
|
7 |
+
CMD ["python","./manage.py","runserver","0.0.0.0:7860"]
|
api/__init__.py
ADDED
File without changes
|
api/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (161 Bytes). View file
|
|
api/__pycache__/admin.cpython-311.pyc
ADDED
Binary file (1.16 kB). View file
|
|
api/__pycache__/apps.cpython-311.pyc
ADDED
Binary file (526 Bytes). View file
|
|
api/__pycache__/models.cpython-311.pyc
ADDED
Binary file (2.89 kB). View file
|
|
api/__pycache__/urls.cpython-311.pyc
ADDED
Binary file (865 Bytes). View file
|
|
api/__pycache__/views.cpython-311.pyc
ADDED
Binary file (13.5 kB). View file
|
|
api/admin.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.contrib import admin
|
2 |
+
from .models import Projects, Version
|
3 |
+
|
4 |
+
# Register your models here.
|
5 |
+
class ProjectsAdmin(admin.ModelAdmin):
|
6 |
+
list_display = ('title', 'slag', 'description', 'userEmail', 'created_at', 'updated_at', 'currentVersion')
|
7 |
+
search_fields = ('title', 'slag', 'description', 'userEmail', 'created_at', 'updated_at', 'currentVersion')
|
8 |
+
readonly_fields = ('created_at', 'updated_at')
|
9 |
+
|
10 |
+
class VersionAdmin(admin.ModelAdmin):
|
11 |
+
list_display = ('versionId', 'created_at', 'updated_at', 'project')
|
12 |
+
search_fields = ('versionId', 'created_at', 'updated_at', 'project')
|
13 |
+
readonly_fields = ('created_at', 'updated_at')
|
14 |
+
|
15 |
+
admin.site.register(Projects, ProjectsAdmin)
|
16 |
+
admin.site.register(Version, VersionAdmin)
|
api/apps.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.apps import AppConfig
|
2 |
+
|
3 |
+
|
4 |
+
class ApiConfig(AppConfig):
|
5 |
+
default_auto_field = "django.db.models.BigAutoField"
|
6 |
+
name = "api"
|
api/migrations/0001_initial.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Generated by Django 5.1.2 on 2024-11-03 14:11
|
2 |
+
|
3 |
+
import api.models
|
4 |
+
import django.db.models.deletion
|
5 |
+
from django.db import migrations, models
|
6 |
+
|
7 |
+
|
8 |
+
class Migration(migrations.Migration):
|
9 |
+
initial = True
|
10 |
+
|
11 |
+
dependencies = []
|
12 |
+
|
13 |
+
operations = [
|
14 |
+
migrations.CreateModel(
|
15 |
+
name="Projects",
|
16 |
+
fields=[
|
17 |
+
(
|
18 |
+
"id",
|
19 |
+
models.BigAutoField(
|
20 |
+
auto_created=True,
|
21 |
+
primary_key=True,
|
22 |
+
serialize=False,
|
23 |
+
verbose_name="ID",
|
24 |
+
),
|
25 |
+
),
|
26 |
+
(
|
27 |
+
"projectId",
|
28 |
+
models.CharField(
|
29 |
+
blank=True,
|
30 |
+
default=api.models.randomUUID,
|
31 |
+
max_length=50,
|
32 |
+
null=True,
|
33 |
+
),
|
34 |
+
),
|
35 |
+
("title", models.CharField(max_length=100)),
|
36 |
+
("slag", models.CharField(max_length=100, unique=True)),
|
37 |
+
("description", models.TextField(blank=True, null=True)),
|
38 |
+
("userEmail", models.EmailField(blank=True, max_length=254, null=True)),
|
39 |
+
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
40 |
+
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
41 |
+
(
|
42 |
+
"projectScreenshot",
|
43 |
+
models.URLField(
|
44 |
+
default="https://g-ti9mzpabk7s.vusercontent.net/placeholder.svg"
|
45 |
+
),
|
46 |
+
),
|
47 |
+
],
|
48 |
+
),
|
49 |
+
migrations.CreateModel(
|
50 |
+
name="Version",
|
51 |
+
fields=[
|
52 |
+
(
|
53 |
+
"id",
|
54 |
+
models.BigAutoField(
|
55 |
+
auto_created=True,
|
56 |
+
primary_key=True,
|
57 |
+
serialize=False,
|
58 |
+
verbose_name="ID",
|
59 |
+
),
|
60 |
+
),
|
61 |
+
(
|
62 |
+
"versionId",
|
63 |
+
models.CharField(
|
64 |
+
blank=True,
|
65 |
+
default=api.models.randomUUID,
|
66 |
+
max_length=50,
|
67 |
+
null=True,
|
68 |
+
),
|
69 |
+
),
|
70 |
+
("generatedCode", models.TextField(blank=True, null=True)),
|
71 |
+
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
72 |
+
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
73 |
+
(
|
74 |
+
"project",
|
75 |
+
models.ForeignKey(
|
76 |
+
blank=True,
|
77 |
+
null=True,
|
78 |
+
on_delete=django.db.models.deletion.CASCADE,
|
79 |
+
to="api.projects",
|
80 |
+
),
|
81 |
+
),
|
82 |
+
],
|
83 |
+
),
|
84 |
+
migrations.AddField(
|
85 |
+
model_name="projects",
|
86 |
+
name="currentVersion",
|
87 |
+
field=models.ForeignKey(
|
88 |
+
blank=True,
|
89 |
+
null=True,
|
90 |
+
on_delete=django.db.models.deletion.CASCADE,
|
91 |
+
to="api.version",
|
92 |
+
),
|
93 |
+
),
|
94 |
+
]
|
api/migrations/0002_version_versioncount_version_versionmessage.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Generated by Django 5.1.2 on 2024-11-03 14:14
|
2 |
+
|
3 |
+
from django.db import migrations, models
|
4 |
+
|
5 |
+
|
6 |
+
class Migration(migrations.Migration):
|
7 |
+
dependencies = [
|
8 |
+
("api", "0001_initial"),
|
9 |
+
]
|
10 |
+
|
11 |
+
operations = [
|
12 |
+
migrations.AddField(
|
13 |
+
model_name="version",
|
14 |
+
name="versionCount",
|
15 |
+
field=models.IntegerField(default=1),
|
16 |
+
),
|
17 |
+
migrations.AddField(
|
18 |
+
model_name="version",
|
19 |
+
name="versionMessage",
|
20 |
+
field=models.TextField(blank=True, null=True),
|
21 |
+
),
|
22 |
+
]
|
api/migrations/0003_projects_totalversions.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Generated by Django 5.1.2 on 2024-11-03 14:42
|
2 |
+
|
3 |
+
from django.db import migrations, models
|
4 |
+
|
5 |
+
|
6 |
+
class Migration(migrations.Migration):
|
7 |
+
dependencies = [
|
8 |
+
("api", "0002_version_versioncount_version_versionmessage"),
|
9 |
+
]
|
10 |
+
|
11 |
+
operations = [
|
12 |
+
migrations.AddField(
|
13 |
+
model_name="projects",
|
14 |
+
name="totalVersions",
|
15 |
+
field=models.IntegerField(default=1),
|
16 |
+
),
|
17 |
+
]
|
api/migrations/__init__.py
ADDED
File without changes
|
api/migrations/__pycache__/0001_initial.cpython-311.pyc
ADDED
Binary file (2.88 kB). View file
|
|
api/migrations/__pycache__/0002_version_versioncount_version_versionmessage.cpython-311.pyc
ADDED
Binary file (990 Bytes). View file
|
|
api/migrations/__pycache__/0003_projects_totalversions.cpython-311.pyc
ADDED
Binary file (844 Bytes). View file
|
|
api/migrations/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (172 Bytes). View file
|
|
api/models.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.db import models
|
2 |
+
import uuid
|
3 |
+
|
4 |
+
def randomUUID():
|
5 |
+
return str(uuid.uuid4())
|
6 |
+
|
7 |
+
# Create your models here.
|
8 |
+
class Projects(models.Model):
|
9 |
+
|
10 |
+
projectId = models.CharField( default=randomUUID, max_length=50,null=True,blank=True)
|
11 |
+
title = models.CharField(max_length=100)
|
12 |
+
slag = models.CharField(max_length=100, unique=True)
|
13 |
+
description = models.TextField(null=True, blank=True)
|
14 |
+
userEmail = models.EmailField(null=True, blank=True)
|
15 |
+
created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
|
16 |
+
updated_at = models.DateTimeField(auto_now=True, null=True, blank=True)
|
17 |
+
currentVersion = models.ForeignKey('Version', on_delete=models.CASCADE, null=True, blank=True)
|
18 |
+
projectScreenshot = models.URLField(default="https://g-ti9mzpabk7s.vusercontent.net/placeholder.svg")
|
19 |
+
totalVersions = models.IntegerField(default=1)
|
20 |
+
|
21 |
+
def __str__(self):
|
22 |
+
return self.title
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
class Version(models.Model):
|
27 |
+
versionId = models.CharField( default=randomUUID, max_length=50,null=True,blank=True)
|
28 |
+
versionCount = models.IntegerField(default=1)
|
29 |
+
versionMessage = models.TextField(null=True, blank=True)
|
30 |
+
generatedCode = models.TextField(null=True, blank=True)
|
31 |
+
created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
|
32 |
+
updated_at = models.DateTimeField(auto_now=True, null=True, blank=True)
|
33 |
+
project = models.ForeignKey('Projects', on_delete=models.CASCADE, null=True, blank=True)
|
34 |
+
|
35 |
+
def __str__(self):
|
36 |
+
return self.versionId
|
api/tests.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from django.test import TestCase
|
2 |
+
|
3 |
+
# Create your tests here.
|
api/urls.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.urls import path
|
2 |
+
|
3 |
+
from . import views
|
4 |
+
|
5 |
+
urlpatterns = [
|
6 |
+
path("", views.index, name="index"),
|
7 |
+
path("builder/", views.builder, name="builder"),
|
8 |
+
path("project-creator/", views.projectCreator, name="projectCreator"),
|
9 |
+
path("project-detail/<str:projectId>/", views.projectDetail, name="projectDetail"),
|
10 |
+
path("version-list/<str:projectId>/", views.versionList, name="versionList"),
|
11 |
+
path("project-list/", views.projectList, name="projectList"),
|
12 |
+
]
|
api/views.py
ADDED
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.http import HttpResponse, JsonResponse
|
2 |
+
import requests
|
3 |
+
import json
|
4 |
+
import time
|
5 |
+
from django.views.decorators.csrf import csrf_exempt
|
6 |
+
from .models import Projects, Version
|
7 |
+
|
8 |
+
|
9 |
+
MODEL = 'claude-3.5-sonnet'
|
10 |
+
mainPrompt = """
|
11 |
+
You are Tailwind Expert, an AI assistant specializing in HTML and TailwindCSS development. You excel at creating responsive, modern web interfaces using TailwindCSS best practices and utility-first principles.
|
12 |
+
<system_constraints>
|
13 |
+
You are operating in an environment called WebContainer, an in-browser runtime that emulates a Browser to some degree. All code is executed in the browser.
|
14 |
+
Key limitations:
|
15 |
+
|
16 |
+
- No backend server capabilities
|
17 |
+
- No database connections
|
18 |
+
- Limited to client-side functionality
|
19 |
+
- Cannot execute native binaries
|
20 |
+
- No Git support
|
21 |
+
|
22 |
+
The environment supports:
|
23 |
+
|
24 |
+
- HTML, CSS, and JavaScript
|
25 |
+
- TailwindCSS
|
26 |
+
</system_constraints>
|
27 |
+
|
28 |
+
<code_formatting_info>
|
29 |
+
|
30 |
+
Use 2 spaces for indentation
|
31 |
+
Follow TailwindCSS class ordering conventions:
|
32 |
+
|
33 |
+
- Layout (container, display, position)
|
34 |
+
- Box Model (width, height, padding, margin)
|
35 |
+
- Visual (colors, backgrounds, borders)
|
36 |
+
- Typography (text, font)
|
37 |
+
- Other (transitions, transforms)
|
38 |
+
</code_formatting_info>
|
39 |
+
|
40 |
+
<code_structure_info>
|
41 |
+
All the code should be written in HTML, CSS, and JavaScript in single file and code block
|
42 |
+
Always use a single root element in your HTML structure. This is a requirement for proper rendering in the WebContainer environment.
|
43 |
+
Example:
|
44 |
+
<html>
|
45 |
+
<head>
|
46 |
+
<title>My Webpage</title>
|
47 |
+
</head>
|
48 |
+
<body>
|
49 |
+
<div class="container mx-auto">
|
50 |
+
<h1 class="text-2xl font-bold text-center">Hello, World!</h1>
|
51 |
+
</div>
|
52 |
+
</body>
|
53 |
+
</html>
|
54 |
+
Only use TailwindCSS CDN for importing TailwindCSS. Do not use any other external libraries.
|
55 |
+
Example:
|
56 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
57 |
+
Avoid inline styles and scripts. Use style tag for CSS and script tag for JavaScript instead if needed.
|
58 |
+
make sure to include the necessary TailwindCSS classes in your HTML elements to style them.
|
59 |
+
Example:
|
60 |
+
<p class="text-blue-500">This is a blue paragraph.</p>
|
61 |
+
|
62 |
+
For all images create a attribute called data-caption and add a caption for the image.
|
63 |
+
Example:
|
64 |
+
<img src="image.jpg" data-caption="This images includes a dog and cat">
|
65 |
+
|
66 |
+
for any data storage requirements, use local storage.
|
67 |
+
</code_structure_info>
|
68 |
+
|
69 |
+
<important_info>
|
70 |
+
Please note that the WebContainer environment is a sandboxed environment and does not have access to the internet. This means that you cannot fetch data from external APIs or websites. You can only use the data provided in the prompt or any data you generate within the environment.
|
71 |
+
Do not include anything in the ouput other that code and comments.
|
72 |
+
No need to explain the code, the code should be self explanatory.
|
73 |
+
No need of any extra conversation, just the code.
|
74 |
+
Do not worry about the length of the code, write the code as you would normally do.
|
75 |
+
Do not skip any steps, follow the instructions carefully.
|
76 |
+
</important_info>
|
77 |
+
"""
|
78 |
+
|
79 |
+
|
80 |
+
def setup():
|
81 |
+
resp = requests.post('https://github.com/login/device/code', headers={
|
82 |
+
'accept': 'application/json',
|
83 |
+
'editor-version': 'Neovim/0.6.1',
|
84 |
+
'editor-plugin-version': 'copilot.vim/1.16.0',
|
85 |
+
'content-type': 'application/json',
|
86 |
+
'user-agent': 'GithubCopilot/1.155.0',
|
87 |
+
'accept-encoding': 'gzip,deflate,br'
|
88 |
+
}, data='{"client_id":"Iv1.b507a08c87ecfe98","scope":"read:user"}')
|
89 |
+
|
90 |
+
# Parse the response json, isolating the device_code, user_code, and verification_uri
|
91 |
+
resp_json = resp.json()
|
92 |
+
device_code = resp_json.get('device_code')
|
93 |
+
user_code = resp_json.get('user_code')
|
94 |
+
verification_uri = resp_json.get('verification_uri')
|
95 |
+
|
96 |
+
# Print the user code and verification uri
|
97 |
+
print(f'Please visit {verification_uri} and enter code {user_code} to authenticate.')
|
98 |
+
|
99 |
+
while True:
|
100 |
+
time.sleep(5)
|
101 |
+
resp = requests.post('https://github.com/login/oauth/access_token', headers={
|
102 |
+
'accept': 'application/json',
|
103 |
+
'editor-version': 'Neovim/0.6.1',
|
104 |
+
'editor-plugin-version': 'copilot.vim/1.16.0',
|
105 |
+
'content-type': 'application/json',
|
106 |
+
'user-agent': 'GithubCopilot/1.155.0',
|
107 |
+
'accept-encoding': 'gzip,deflate,br'
|
108 |
+
}, data=f'{{"client_id":"Iv1.b507a08c87ecfe98","device_code":"{device_code}","grant_type":"urn:ietf:params:oauth:grant-type:device_code"}}')
|
109 |
+
|
110 |
+
# Parse the response json, isolating the access_token
|
111 |
+
resp_json = resp.json()
|
112 |
+
access_token = resp_json.get('access_token')
|
113 |
+
|
114 |
+
if access_token:
|
115 |
+
break
|
116 |
+
|
117 |
+
# Save the access token to a file
|
118 |
+
with open('.copilot_token', 'w') as f:
|
119 |
+
f.write(access_token)
|
120 |
+
|
121 |
+
print('Authentication success!')
|
122 |
+
|
123 |
+
|
124 |
+
def get_token():
|
125 |
+
global token
|
126 |
+
# Check if the .copilot_token file exists
|
127 |
+
while True:
|
128 |
+
try:
|
129 |
+
with open('.copilot_token', 'r') as f:
|
130 |
+
access_token = f.read()
|
131 |
+
break
|
132 |
+
except FileNotFoundError:
|
133 |
+
setup()
|
134 |
+
# Get a session with the access token
|
135 |
+
resp = requests.get('https://api.github.com/copilot_internal/v2/token', headers={
|
136 |
+
'authorization': f'token {access_token}',
|
137 |
+
'editor-version': 'Neovim/0.6.1',
|
138 |
+
'editor-plugin-version': 'copilot.vim/1.16.0',
|
139 |
+
'user-agent': 'GithubCopilot/1.155.0'
|
140 |
+
})
|
141 |
+
|
142 |
+
# Parse the response json, isolating the token
|
143 |
+
resp_json = resp.json()
|
144 |
+
token = resp_json.get('token')
|
145 |
+
|
146 |
+
|
147 |
+
def chat(message):
|
148 |
+
global token
|
149 |
+
messages = []
|
150 |
+
# If the token is None, get a new one
|
151 |
+
if token is None:
|
152 |
+
get_token()
|
153 |
+
|
154 |
+
messages.append({
|
155 |
+
"content": mainPrompt + "\n\n---\n" + str(message),
|
156 |
+
"role": "user"
|
157 |
+
})
|
158 |
+
|
159 |
+
try:
|
160 |
+
resp = requests.post('https://api.githubcopilot.com/chat/completions', headers={
|
161 |
+
'authorization': f'Bearer {token}',
|
162 |
+
'Editor-Version': 'vscode/1.80.1',
|
163 |
+
}, json={
|
164 |
+
'intent': False,
|
165 |
+
'model': MODEL,
|
166 |
+
'temperature': 0,
|
167 |
+
'top_p': 1,
|
168 |
+
'n': 1,
|
169 |
+
# 'stream': True,
|
170 |
+
'messages': messages
|
171 |
+
})
|
172 |
+
except requests.exceptions.ConnectionError:
|
173 |
+
return ''
|
174 |
+
try:
|
175 |
+
result = resp.json()["choices"][0]["message"]["content"]
|
176 |
+
|
177 |
+
if result == '':
|
178 |
+
print(resp.status_code)
|
179 |
+
print(resp.text)
|
180 |
+
return result
|
181 |
+
except Exception as e:
|
182 |
+
return str(e)
|
183 |
+
|
184 |
+
|
185 |
+
get_token()
|
186 |
+
|
187 |
+
|
188 |
+
def index(request):
|
189 |
+
return HttpResponse("Hello, Moto")
|
190 |
+
|
191 |
+
|
192 |
+
@csrf_exempt
|
193 |
+
def builder(request):
|
194 |
+
if request.method == 'POST':
|
195 |
+
message = request.POST.get('message')
|
196 |
+
projectId = request.POST.get('projectId')
|
197 |
+
project = Projects.objects.filter(projectId=projectId).first()
|
198 |
+
try:
|
199 |
+
if project.currentVersion.generatedCode != "" and project.currentVersion.generatedCode is not None:
|
200 |
+
message = "This is my Previous Code:\n\n```\n"+project.currentVersion.generatedCode + "```\n\n" + message
|
201 |
+
except Exception as e:
|
202 |
+
print(e)
|
203 |
+
pass
|
204 |
+
response = chat(message)
|
205 |
+
data = {}
|
206 |
+
try:
|
207 |
+
response = response.replace("```html", "").replace("```", "")
|
208 |
+
newVersion = Version.objects.create(project=project, generatedCode=response, versionMessage=message)
|
209 |
+
newVersion.save()
|
210 |
+
project.currentVersion = newVersion
|
211 |
+
project.save()
|
212 |
+
data = {
|
213 |
+
"versionId": newVersion.versionId,
|
214 |
+
"versionMessage": newVersion.versionMessage,
|
215 |
+
"projectId": project.projectId,
|
216 |
+
"content": response,
|
217 |
+
"created_at": newVersion.created_at,
|
218 |
+
"updated_at": newVersion.updated_at,
|
219 |
+
}
|
220 |
+
except Exception as e:
|
221 |
+
print(e)
|
222 |
+
return JsonResponse({"html": response, "data": data})
|
223 |
+
else:
|
224 |
+
return HttpResponse("Invalid request method")
|
225 |
+
|
226 |
+
|
227 |
+
@csrf_exempt
|
228 |
+
def projectCreator(request):
|
229 |
+
if request.method == 'POST':
|
230 |
+
title = request.POST.get('title')
|
231 |
+
description = request.POST.get('description')
|
232 |
+
slug = request.POST.get('slug')
|
233 |
+
userEmail = request.POST.get('userEmail')
|
234 |
+
project = Projects.objects.create(title=title, description=description, slag=slug, userEmail=userEmail)
|
235 |
+
project.save()
|
236 |
+
initVersion = Version.objects.create(project=project, versionMessage="Initial version", generatedCode="")
|
237 |
+
initVersion.save()
|
238 |
+
project.currentVersion = initVersion
|
239 |
+
project.save()
|
240 |
+
data = {
|
241 |
+
"title": title,
|
242 |
+
"description": description,
|
243 |
+
"slag": slug,
|
244 |
+
"userEmail": userEmail,
|
245 |
+
"id": project.projectId,
|
246 |
+
"created_at": project.created_at,
|
247 |
+
"updated_at": project.updated_at,
|
248 |
+
"currentVersion": initVersion.versionId,
|
249 |
+
}
|
250 |
+
return JsonResponse(data)
|
251 |
+
else:
|
252 |
+
return HttpResponse("Invalid request method")
|
253 |
+
|
254 |
+
def projectList(request):
|
255 |
+
projects = Projects.objects.all()
|
256 |
+
data = []
|
257 |
+
for project in projects:
|
258 |
+
data.append({
|
259 |
+
"previewUrl": "/projects/deployed/"+project.projectId,
|
260 |
+
"imageUrl": project.projectScreenshot,
|
261 |
+
"customizeUrl": "/projects/"+project.projectId,
|
262 |
+
"title": project.title,
|
263 |
+
"description": project.description,
|
264 |
+
"slag": project.slag,
|
265 |
+
"userEmail": project.userEmail,
|
266 |
+
"id": project.projectId,
|
267 |
+
"created_at": project.created_at,
|
268 |
+
"updated_at": project.updated_at,
|
269 |
+
"currentVersion": project.currentVersion.versionId,
|
270 |
+
"currentCode": project.currentVersion.generatedCode,
|
271 |
+
})
|
272 |
+
return JsonResponse(data, safe=False)
|
273 |
+
|
274 |
+
def projectDetail(request, projectId):
|
275 |
+
project = Projects.objects.get(projectId=projectId)
|
276 |
+
data = {
|
277 |
+
"title": project.title,
|
278 |
+
"description": project.description,
|
279 |
+
"slag": project.slag,
|
280 |
+
"userEmail": project.userEmail,
|
281 |
+
"id": project.projectId,
|
282 |
+
"created_at": project.created_at,
|
283 |
+
"updated_at": project.updated_at,
|
284 |
+
"currentVersion": project.currentVersion.versionId,
|
285 |
+
"currentCode": project.currentVersion.generatedCode,
|
286 |
+
}
|
287 |
+
return JsonResponse(data)
|
288 |
+
|
289 |
+
|
290 |
+
def versionList(request, projectId):
|
291 |
+
project = Projects.objects.get(projectId=projectId)
|
292 |
+
versions = Version.objects.filter(project=project)
|
293 |
+
data = []
|
294 |
+
for version in versions:
|
295 |
+
data.append({
|
296 |
+
"versionId": version.versionId,
|
297 |
+
"versionMessage": version.versionMessage,
|
298 |
+
"created_at": version.created_at,
|
299 |
+
"updated_at": version.updated_at,
|
300 |
+
})
|
301 |
+
return JsonResponse(data, safe=False)
|
data.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
[{"model": "admin.logentry", "pk": 1, "fields": {"action_time": "2024-11-03T14:12:21.203Z", "user": 1, "content_type": 7, "object_id": "2", "object_repr": "Demo1", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 2, "fields": {"action_time": "2024-11-03T14:12:21.204Z", "user": 1, "content_type": 7, "object_id": "1", "object_repr": "Demo1", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 3, "fields": {"action_time": "2024-11-03T14:15:06.599Z", "user": 1, "content_type": 7, "object_id": "3", "object_repr": "Demo1", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 4, "fields": {"action_time": "2024-11-03T14:15:44.366Z", "user": 1, "content_type": 7, "object_id": "4", "object_repr": "Demo1", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 5, "fields": {"action_time": "2024-11-03T14:40:59.666Z", "user": 1, "content_type": 8, "object_id": "3", "object_repr": "b5edd376-5a2c-4cc2-b637-0c71fc4a7a48", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 6, "fields": {"action_time": "2024-11-03T14:41:04.096Z", "user": 1, "content_type": 8, "object_id": "4", "object_repr": "3a27b126-79b1-4149-9492-0343bd152a87", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 7, "fields": {"action_time": "2024-11-03T14:52:07.492Z", "user": 1, "content_type": 8, "object_id": "5", "object_repr": "18759cf6-83b8-4c11-ac16-5531a8ed9b1d", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"VersionMessage\", \"GeneratedCode\"]}}]"}}, {"model": "admin.logentry", "pk": 8, "fields": {"action_time": "2024-11-03T14:59:20.694Z", "user": 1, "content_type": 7, "object_id": "6", "object_repr": "Demo2", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"CurrentVersion\"]}}]"}}, {"model": "admin.logentry", "pk": 9, "fields": {"action_time": "2024-11-03T14:59:26.720Z", "user": 1, "content_type": 8, "object_id": "8", "object_repr": "560ee748-614a-459c-9534-c23d9faad559", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 10, "fields": {"action_time": "2024-11-03T14:59:26.720Z", "user": 1, "content_type": 8, "object_id": "7", "object_repr": "630c4a8d-a9c2-4a51-87cb-b9a7c97e54ba", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 11, "fields": {"action_time": "2024-11-03T14:59:26.720Z", "user": 1, "content_type": 8, "object_id": "6", "object_repr": "63d2aa92-b47d-4f10-888f-aff39bfb6361", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 12, "fields": {"action_time": "2024-11-03T15:01:00.322Z", "user": 1, "content_type": 7, "object_id": "6", "object_repr": "Demo2", "action_flag": 2, "change_message": "[]"}}, {"model": "admin.logentry", "pk": 13, "fields": {"action_time": "2024-11-03T15:02:07.213Z", "user": 1, "content_type": 7, "object_id": "6", "object_repr": "Demo2", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"CurrentVersion\"]}}]"}}, {"model": "admin.logentry", "pk": 14, "fields": {"action_time": "2024-11-03T15:02:14.382Z", "user": 1, "content_type": 8, "object_id": "10", "object_repr": "7a5e475e-44b6-4c2a-8767-809253366191", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 15, "fields": {"action_time": "2024-11-03T15:02:14.382Z", "user": 1, "content_type": 8, "object_id": "9", "object_repr": "94fa4833-90dc-4bc1-8e67-849a4d70583f", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 16, "fields": {"action_time": "2024-11-03T15:07:16.691Z", "user": 1, "content_type": 7, "object_id": "7", "object_repr": "Notes", "action_flag": 3, "change_message": ""}}, {"model": "admin.logentry", "pk": 17, "fields": {"action_time": "2024-11-03T15:59:23.793Z", "user": 1, "content_type": 7, "object_id": "6", "object_repr": "Demo2", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"ProjectScreenshot\"]}}]"}}, {"model": "admin.logentry", "pk": 18, "fields": {"action_time": "2024-11-03T16:00:23.521Z", "user": 1, "content_type": 7, "object_id": "8", "object_repr": "Notes", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"ProjectScreenshot\"]}}]"}}, {"model": "admin.logentry", "pk": 19, "fields": {"action_time": "2024-11-03T16:01:17.004Z", "user": 1, "content_type": 7, "object_id": "9", "object_repr": "create a app for voice activation chat", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"ProjectScreenshot\"]}}]"}}, {"model": "auth.permission", "pk": 1, "fields": {"name": "Can add log entry", "content_type": 1, "codename": "add_logentry"}}, {"model": "auth.permission", "pk": 2, "fields": {"name": "Can change log entry", "content_type": 1, "codename": "change_logentry"}}, {"model": "auth.permission", "pk": 3, "fields": {"name": "Can delete log entry", "content_type": 1, "codename": "delete_logentry"}}, {"model": "auth.permission", "pk": 4, "fields": {"name": "Can view log entry", "content_type": 1, "codename": "view_logentry"}}, {"model": "auth.permission", "pk": 5, "fields": {"name": "Can add permission", "content_type": 2, "codename": "add_permission"}}, {"model": "auth.permission", "pk": 6, "fields": {"name": "Can change permission", "content_type": 2, "codename": "change_permission"}}, {"model": "auth.permission", "pk": 7, "fields": {"name": "Can delete permission", "content_type": 2, "codename": "delete_permission"}}, {"model": "auth.permission", "pk": 8, "fields": {"name": "Can view permission", "content_type": 2, "codename": "view_permission"}}, {"model": "auth.permission", "pk": 9, "fields": {"name": "Can add group", "content_type": 3, "codename": "add_group"}}, {"model": "auth.permission", "pk": 10, "fields": {"name": "Can change group", "content_type": 3, "codename": "change_group"}}, {"model": "auth.permission", "pk": 11, "fields": {"name": "Can delete group", "content_type": 3, "codename": "delete_group"}}, {"model": "auth.permission", "pk": 12, "fields": {"name": "Can view group", "content_type": 3, "codename": "view_group"}}, {"model": "auth.permission", "pk": 13, "fields": {"name": "Can add user", "content_type": 4, "codename": "add_user"}}, {"model": "auth.permission", "pk": 14, "fields": {"name": "Can change user", "content_type": 4, "codename": "change_user"}}, {"model": "auth.permission", "pk": 15, "fields": {"name": "Can delete user", "content_type": 4, "codename": "delete_user"}}, {"model": "auth.permission", "pk": 16, "fields": {"name": "Can view user", "content_type": 4, "codename": "view_user"}}, {"model": "auth.permission", "pk": 17, "fields": {"name": "Can add content type", "content_type": 5, "codename": "add_contenttype"}}, {"model": "auth.permission", "pk": 18, "fields": {"name": "Can change content type", "content_type": 5, "codename": "change_contenttype"}}, {"model": "auth.permission", "pk": 19, "fields": {"name": "Can delete content type", "content_type": 5, "codename": "delete_contenttype"}}, {"model": "auth.permission", "pk": 20, "fields": {"name": "Can view content type", "content_type": 5, "codename": "view_contenttype"}}, {"model": "auth.permission", "pk": 21, "fields": {"name": "Can add session", "content_type": 6, "codename": "add_session"}}, {"model": "auth.permission", "pk": 22, "fields": {"name": "Can change session", "content_type": 6, "codename": "change_session"}}, {"model": "auth.permission", "pk": 23, "fields": {"name": "Can delete session", "content_type": 6, "codename": "delete_session"}}, {"model": "auth.permission", "pk": 24, "fields": {"name": "Can view session", "content_type": 6, "codename": "view_session"}}, {"model": "auth.permission", "pk": 25, "fields": {"name": "Can add projects", "content_type": 7, "codename": "add_projects"}}, {"model": "auth.permission", "pk": 26, "fields": {"name": "Can change projects", "content_type": 7, "codename": "change_projects"}}, {"model": "auth.permission", "pk": 27, "fields": {"name": "Can delete projects", "content_type": 7, "codename": "delete_projects"}}, {"model": "auth.permission", "pk": 28, "fields": {"name": "Can view projects", "content_type": 7, "codename": "view_projects"}}, {"model": "auth.permission", "pk": 29, "fields": {"name": "Can add version", "content_type": 8, "codename": "add_version"}}, {"model": "auth.permission", "pk": 30, "fields": {"name": "Can change version", "content_type": 8, "codename": "change_version"}}, {"model": "auth.permission", "pk": 31, "fields": {"name": "Can delete version", "content_type": 8, "codename": "delete_version"}}, {"model": "auth.permission", "pk": 32, "fields": {"name": "Can view version", "content_type": 8, "codename": "view_version"}}, {"model": "auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$870000$kZXuPu7MyRgwOIjrCCjeSm$qPLJvhYdNvT1I3iNkhtUj/xAvFvfKwaCW7ep2Hb+bwU=", "last_login": "2024-11-03T14:10:43.270Z", "is_superuser": true, "username": "thejagstudio", "first_name": "", "last_name": "", "email": "thejagstudio@gmail.com", "is_staff": true, "is_active": true, "date_joined": "2024-11-03T14:09:52.463Z", "groups": [], "user_permissions": []}}, {"model": "contenttypes.contenttype", "pk": 1, "fields": {"app_label": "admin", "model": "logentry"}}, {"model": "contenttypes.contenttype", "pk": 2, "fields": {"app_label": "auth", "model": "permission"}}, {"model": "contenttypes.contenttype", "pk": 3, "fields": {"app_label": "auth", "model": "group"}}, {"model": "contenttypes.contenttype", "pk": 4, "fields": {"app_label": "auth", "model": "user"}}, {"model": "contenttypes.contenttype", "pk": 5, "fields": {"app_label": "contenttypes", "model": "contenttype"}}, {"model": "contenttypes.contenttype", "pk": 6, "fields": {"app_label": "sessions", "model": "session"}}, {"model": "contenttypes.contenttype", "pk": 7, "fields": {"app_label": "api", "model": "projects"}}, {"model": "contenttypes.contenttype", "pk": 8, "fields": {"app_label": "api", "model": "version"}}, {"model": "sessions.session", "pk": "gravmzl91bcddtzekm52ghcv4ffn1i47", "fields": {"session_data": ".eJxVjDEOwjAMRe-SGUVOqiQOIztnqOzapQWUSE07Ie4OlTrA-t97_2V62tap35ou_SzmbJw5_W5Mw0PLDuRO5VbtUMu6zGx3xR602WsVfV4O9-9gojZ9a0gQfedRwXMYRlDNQTCoQ0AJSTqKocseHY2S3MhImbNETyyM4Mi8P8pMN9A:1t7bJT:DiLxW26SjGuB2bsFwWe5ocVI1ZthlwsXNc-a5xz4C9w", "expire_date": "2024-11-17T14:10:43.635Z"}}, {"model": "api.projects", "pk": 6, "fields": {"projectId": "3e9e5161-d9bc-4820-a8c3-194da734a48d", "title": "Demo2", "slag": "demo6", "description": "Demo description", "userEmail": "tempmailpatel@gmail.com", "created_at": "2024-11-03T14:17:01.372Z", "updated_at": "2024-11-03T15:59:23.791Z", "currentVersion": 12, "projectScreenshot": "https://i.ibb.co/L06bH7K/image.png", "totalVersions": 1}}, {"model": "api.projects", "pk": 8, "fields": {"projectId": "ac61f525-a988-4fed-b516-caccf05b084d", "title": "Notes", "slag": "notes", "description": "Project that can listen and give transcript of the audio on screen", "userEmail": "tempmailpatel@gmail.com", "created_at": "2024-11-03T15:07:31.925Z", "updated_at": "2024-11-03T16:00:23.501Z", "currentVersion": 18, "projectScreenshot": "https://i.ibb.co/98sV3Cy/image.png", "totalVersions": 1}}, {"model": "api.projects", "pk": 9, "fields": {"projectId": "3ebe8ca9-55f3-4d2f-b169-6df08c890917", "title": "create a app for voice activation chat", "slag": "19a3y", "description": "create a app for voice activation chat app which allow us to record audio and say to out files.", "userEmail": "tempmailpatel@gmail.com", "created_at": "2024-11-03T15:29:08.786Z", "updated_at": "2024-11-03T16:01:16.994Z", "currentVersion": 20, "projectScreenshot": "https://i.ibb.co/3s8336N/image.png", "totalVersions": 1}}, {"model": "api.version", "pk": 5, "fields": {"versionId": "18759cf6-83b8-4c11-ac16-5531a8ed9b1d", "versionCount": 1, "versionMessage": "Demo", "generatedCode": "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <title>TailwindCSS Demo</title>\r\n <script src=\"https://cdn.tailwindcss.com\"></script>\r\n</head>\r\n<body>\r\n <div class=\"min-h-screen bg-gradient-to-br from-blue-100 to-purple-100\">\r\n <!-- Header Section -->\r\n <header class=\"container mx-auto px-4 py-6\">\r\n <nav class=\"flex justify-between items-center\">\r\n <h1 class=\"text-2xl font-bold text-blue-600\">Demo 2</h1>\r\n <div class=\"space-x-4\">\r\n <button class=\"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors\">\r\n Sign In\r\n </button>\r\n <button class=\"px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors\">\r\n Sign Up\r\n </button>\r\n </div>\r\n </nav>\r\n </header>\r\n\r\n <!-- Main Content -->\r\n <main class=\"container mx-auto px-4 py-12\">\r\n <div class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8\">\r\n <!-- Card 1 -->\r\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\r\n <img src=\"https://picsum.photos/400/300\" alt=\"Demo image\" class=\"w-full h-48 object-cover\" \r\n data-caption=\"Beautiful landscape with mountains\">\r\n <div class=\"p-6\">\r\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 1</h2>\r\n <p class=\"text-gray-600\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\r\n <button class=\"mt-4 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 w-full\">\r\n Learn More\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <!-- Card 2 -->\r\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\r\n <img src=\"https://picsum.photos/400/301\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\r\n data-caption=\"Urban cityscape at sunset\">\r\n <div class=\"p-6\">\r\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 2</h2>\r\n <p class=\"text-gray-600\">Sed do eiusmod tempor incididunt ut labore et dolore.</p>\r\n <button class=\"mt-4 px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 w-full\">\r\n Learn More\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <!-- Card 3 -->\r\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\r\n <img src=\"https://picsum.photos/400/302\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\r\n data-caption=\"Natural forest scenery\">\r\n <div class=\"p-6\">\r\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 3</h2>\r\n <p class=\"text-gray-600\">Ut enim ad minim veniam, quis nostrud exercitation.</p>\r\n <button class=\"mt-4 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 w-full\">\r\n Learn More\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </main>\r\n\r\n <!-- Footer -->\r\n <footer class=\"container mx-auto px-4 py-8 mt-12\">\r\n <div class=\"text-center text-gray-600\">\r\n <p>© 2024 Demo 2. All rights reserved.</p>\r\n </div>\r\n </footer>\r\n </div>\r\n\r\n <script>\r\n document.addEventListener('DOMContentLoaded', function() {\r\n const buttons = document.querySelectorAll('button');\r\n buttons.forEach(button => {\r\n button.addEventListener('click', function() {\r\n alert('Button clicked!');\r\n });\r\n });\r\n });\r\n </script>\r\n</body>\r\n</html>", "created_at": "2024-11-03T14:37:47.125Z", "updated_at": "2024-11-03T14:52:07.489Z", "project": 6}}, {"model": "api.version", "pk": 11, "fields": {"versionId": "cb64b920-ccda-4c13-97e8-8679f5abc4d3", "versionCount": 1, "versionMessage": "This is my Previous Code:\n\n```\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n <meta charset=\"UTF-8\">\r\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n <title>TailwindCSS Demo</title>\r\n <script src=\"https://cdn.tailwindcss.com\"></script>\r\n</head>\r\n<body>\r\n <div class=\"min-h-screen bg-gradient-to-br from-blue-100 to-purple-100\">\r\n <!-- Header Section -->\r\n <header class=\"container mx-auto px-4 py-6\">\r\n <nav class=\"flex justify-between items-center\">\r\n <h1 class=\"text-2xl font-bold text-blue-600\">Demo 2</h1>\r\n <div class=\"space-x-4\">\r\n <button class=\"px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors\">\r\n Sign In\r\n </button>\r\n <button class=\"px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors\">\r\n Sign Up\r\n </button>\r\n </div>\r\n </nav>\r\n </header>\r\n\r\n <!-- Main Content -->\r\n <main class=\"container mx-auto px-4 py-12\">\r\n <div class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8\">\r\n <!-- Card 1 -->\r\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\r\n <img src=\"https://picsum.photos/400/300\" alt=\"Demo image\" class=\"w-full h-48 object-cover\" \r\n data-caption=\"Beautiful landscape with mountains\">\r\n <div class=\"p-6\">\r\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 1</h2>\r\n <p class=\"text-gray-600\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\r\n <button class=\"mt-4 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 w-full\">\r\n Learn More\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <!-- Card 2 -->\r\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\r\n <img src=\"https://picsum.photos/400/301\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\r\n data-caption=\"Urban cityscape at sunset\">\r\n <div class=\"p-6\">\r\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 2</h2>\r\n <p class=\"text-gray-600\">Sed do eiusmod tempor incididunt ut labore et dolore.</p>\r\n <button class=\"mt-4 px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 w-full\">\r\n Learn More\r\n </button>\r\n </div>\r\n </div>\r\n\r\n <!-- Card 3 -->\r\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\r\n <img src=\"https://picsum.photos/400/302\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\r\n data-caption=\"Natural forest scenery\">\r\n <div class=\"p-6\">\r\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 3</h2>\r\n <p class=\"text-gray-600\">Ut enim ad minim veniam, quis nostrud exercitation.</p>\r\n <button class=\"mt-4 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 w-full\">\r\n Learn More\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </main>\r\n\r\n <!-- Footer -->\r\n <footer class=\"container mx-auto px-4 py-8 mt-12\">\r\n <div class=\"text-center text-gray-600\">\r\n <p>© 2024 Demo 2. All rights reserved.</p>\r\n </div>\r\n </footer>\r\n </div>\r\n\r\n <script>\r\n document.addEventListener('DOMContentLoaded', function() {\r\n const buttons = document.querySelectorAll('button');\r\n buttons.forEach(button => {\r\n button.addEventListener('click', function() {\r\n alert('Button clicked!');\r\n });\r\n });\r\n });\r\n </script>\r\n</body>\r\n</html>```\n\nchange color to green", "generatedCode": "\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>TailwindCSS Demo</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body>\n <div class=\"min-h-screen bg-gradient-to-br from-green-100 to-emerald-100\">\n <!-- Header Section -->\n <header class=\"container mx-auto px-4 py-6\">\n <nav class=\"flex justify-between items-center\">\n <h1 class=\"text-2xl font-bold text-green-600\">Demo 2</h1>\n <div class=\"space-x-4\">\n <button class=\"px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors\">\n Sign In\n </button>\n <button class=\"px-4 py-2 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 transition-colors\">\n Sign Up\n </button>\n </div>\n </nav>\n </header>\n\n <!-- Main Content -->\n <main class=\"container mx-auto px-4 py-12\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8\">\n <!-- Card 1 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/300\" alt=\"Demo image\" class=\"w-full h-48 object-cover\" \n data-caption=\"Beautiful landscape with mountains\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 1</h2>\n <p class=\"text-gray-600\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\n <button class=\"mt-4 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n\n <!-- Card 2 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/301\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\n data-caption=\"Urban cityscape at sunset\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 2</h2>\n <p class=\"text-gray-600\">Sed do eiusmod tempor incididunt ut labore et dolore.</p>\n <button class=\"mt-4 px-4 py-2 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n\n <!-- Card 3 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/302\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\n data-caption=\"Natural forest scenery\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 3</h2>\n <p class=\"text-gray-600\">Ut enim ad minim veniam, quis nostrud exercitation.</p>\n <button class=\"mt-4 px-4 py-2 bg-teal-500 text-white rounded-lg hover:bg-teal-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n </div>\n </main>\n\n <!-- Footer -->\n <footer class=\"container mx-auto px-4 py-8 mt-12\">\n <div class=\"text-center text-gray-600\">\n <p>© 2024 Demo 2. All rights reserved.</p>\n </div>\n </footer>\n </div>\n\n <script>\n document.addEventListener('DOMContentLoaded', function() {\n const buttons = document.querySelectorAll('button');\n buttons.forEach(button => {\n button.addEventListener('click', function() {\n alert('Button clicked!');\n });\n });\n });\n </script>\n</body>\n</html>\n", "created_at": "2024-11-03T15:02:58.060Z", "updated_at": "2024-11-03T15:02:58.408Z", "project": 6}}, {"model": "api.version", "pk": 12, "fields": {"versionId": "941432b2-be8c-4bb7-9499-7225f1e7faea", "versionCount": 1, "versionMessage": "This is my Previous Code:\n\n```\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>TailwindCSS Demo</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body>\n <div class=\"min-h-screen bg-gradient-to-br from-green-100 to-emerald-100\">\n <!-- Header Section -->\n <header class=\"container mx-auto px-4 py-6\">\n <nav class=\"flex justify-between items-center\">\n <h1 class=\"text-2xl font-bold text-green-600\">Demo 2</h1>\n <div class=\"space-x-4\">\n <button class=\"px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors\">\n Sign In\n </button>\n <button class=\"px-4 py-2 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 transition-colors\">\n Sign Up\n </button>\n </div>\n </nav>\n </header>\n\n <!-- Main Content -->\n <main class=\"container mx-auto px-4 py-12\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8\">\n <!-- Card 1 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/300\" alt=\"Demo image\" class=\"w-full h-48 object-cover\" \n data-caption=\"Beautiful landscape with mountains\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 1</h2>\n <p class=\"text-gray-600\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\n <button class=\"mt-4 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n\n <!-- Card 2 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/301\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\n data-caption=\"Urban cityscape at sunset\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 2</h2>\n <p class=\"text-gray-600\">Sed do eiusmod tempor incididunt ut labore et dolore.</p>\n <button class=\"mt-4 px-4 py-2 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n\n <!-- Card 3 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/302\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\n data-caption=\"Natural forest scenery\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 3</h2>\n <p class=\"text-gray-600\">Ut enim ad minim veniam, quis nostrud exercitation.</p>\n <button class=\"mt-4 px-4 py-2 bg-teal-500 text-white rounded-lg hover:bg-teal-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n </div>\n </main>\n\n <!-- Footer -->\n <footer class=\"container mx-auto px-4 py-8 mt-12\">\n <div class=\"text-center text-gray-600\">\n <p>© 2024 Demo 2. All rights reserved.</p>\n </div>\n </footer>\n </div>\n\n <script>\n document.addEventListener('DOMContentLoaded', function() {\n const buttons = document.querySelectorAll('button');\n buttons.forEach(button => {\n button.addEventListener('click', function() {\n alert('Button clicked!');\n });\n });\n });\n </script>\n</body>\n</html>\n```\n\nchange ┬⌐ 2024 Demo 2. All rights reserved. to ┬⌐ 2025 TheJagStudio. All rights reserved.", "generatedCode": "\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>TailwindCSS Demo</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body>\n <div class=\"min-h-screen bg-gradient-to-br from-green-100 to-emerald-100\">\n <!-- Header Section -->\n <header class=\"container mx-auto px-4 py-6\">\n <nav class=\"flex justify-between items-center\">\n <h1 class=\"text-2xl font-bold text-green-600\">Demo 2</h1>\n <div class=\"space-x-4\">\n <button class=\"px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors\">\n Sign In\n </button>\n <button class=\"px-4 py-2 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 transition-colors\">\n Sign Up\n </button>\n </div>\n </nav>\n </header>\n\n <!-- Main Content -->\n <main class=\"container mx-auto px-4 py-12\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8\">\n <!-- Card 1 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/300\" alt=\"Demo image\" class=\"w-full h-48 object-cover\" \n data-caption=\"Beautiful landscape with mountains\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 1</h2>\n <p class=\"text-gray-600\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>\n <button class=\"mt-4 px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n\n <!-- Card 2 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/301\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\n data-caption=\"Urban cityscape at sunset\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 2</h2>\n <p class=\"text-gray-600\">Sed do eiusmod tempor incididunt ut labore et dolore.</p>\n <button class=\"mt-4 px-4 py-2 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n\n <!-- Card 3 -->\n <div class=\"bg-white rounded-xl shadow-lg overflow-hidden hover:shadow-xl transition-shadow\">\n <img src=\"https://picsum.photos/400/302\" alt=\"Demo image\" class=\"w-full h-48 object-cover\"\n data-caption=\"Natural forest scenery\">\n <div class=\"p-6\">\n <h2 class=\"text-xl font-semibold text-gray-800 mb-2\">Card Title 3</h2>\n <p class=\"text-gray-600\">Ut enim ad minim veniam, quis nostrud exercitation.</p>\n <button class=\"mt-4 px-4 py-2 bg-teal-500 text-white rounded-lg hover:bg-teal-600 w-full\">\n Learn More\n </button>\n </div>\n </div>\n </div>\n </main>\n\n <!-- Footer -->\n <footer class=\"container mx-auto px-4 py-8 mt-12\">\n <div class=\"text-center text-gray-600\">\n <p>© 2025 TheJagStudio. All rights reserved.</p>\n </div>\n </footer>\n </div>\n\n <script>\n document.addEventListener('DOMContentLoaded', function() {\n const buttons = document.querySelectorAll('button');\n buttons.forEach(button => {\n button.addEventListener('click', function() {\n alert('Button clicked!');\n });\n });\n });\n </script>\n</body>\n</html>\n", "created_at": "2024-11-03T15:03:36.515Z", "updated_at": "2024-11-03T15:03:36.906Z", "project": 6}}, {"model": "api.version", "pk": 15, "fields": {"versionId": "19338112-70a5-4da6-9a03-a3eb80037d69", "versionCount": 1, "versionMessage": "Initial version", "generatedCode": "", "created_at": "2024-11-03T15:07:32.677Z", "updated_at": "2024-11-03T15:07:32.993Z", "project": 8}}, {"model": "api.version", "pk": 16, "fields": {"versionId": "50e8755d-b2b8-4556-82ae-96c3cf2d2d19", "versionCount": 1, "versionMessage": "Notes\r\n\r\n---\r\n\r\nProject that can listen and give transcript of the audio on screen", "generatedCode": "\n<!DOCTYPE html>\n<html>\n<head>\n <title>Speech to Text</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"container mx-auto px-4 py-8\">\n <div class=\"max-w-2xl mx-auto\">\n <h1 class=\"text-3xl font-bold text-center mb-8 text-gray-800\">Speech to Text Transcriber</h1>\n \n <div class=\"bg-white rounded-lg shadow-md p-6\">\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <button id=\"startButton\" class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200\">\n Start Recording\n </button>\n \n <button id=\"stopButton\" class=\"bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200 hidden\">\n Stop Recording\n </button>\n </div>\n\n <div class=\"status-indicator flex items-center justify-center mb-4\">\n <div id=\"statusDot\" class=\"w-3 h-3 rounded-full bg-gray-400 mr-2\"></div>\n <span id=\"status\" class=\"text-gray-600\">Not Recording</span>\n </div>\n\n <div class=\"relative\">\n <textarea \n id=\"transcript\" \n class=\"w-full h-64 p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none\"\n placeholder=\"Your transcript will appear here...\"\n readonly\n ></textarea>\n \n <button \n id=\"copyButton\"\n class=\"absolute bottom-4 right-4 bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Copy\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <script>\n const startButton = document.getElementById('startButton');\n const stopButton = document.getElementById('stopButton');\n const transcript = document.getElementById('transcript');\n const status = document.getElementById('status');\n const statusDot = document.getElementById('statusDot');\n const copyButton = document.getElementById('copyButton');\n\n let recognition = null;\n\n if ('webkitSpeechRecognition' in window) {\n recognition = new webkitSpeechRecognition();\n recognition.continuous = true;\n recognition.interimResults = true;\n\n recognition.onstart = () => {\n status.textContent = 'Recording...';\n statusDot.classList.remove('bg-gray-400');\n statusDot.classList.add('bg-red-500');\n startButton.classList.add('hidden');\n stopButton.classList.remove('hidden');\n };\n\n recognition.onend = () => {\n status.textContent = 'Not Recording';\n statusDot.classList.remove('bg-red-500');\n statusDot.classList.add('bg-gray-400');\n startButton.classList.remove('hidden');\n stopButton.classList.add('hidden');\n };\n\n recognition.onresult = (event) => {\n let finalTranscript = '';\n let interimTranscript = '';\n\n for (let i = event.resultIndex; i < event.results.length; i++) {\n const result = event.results[i];\n if (result.isFinal) {\n finalTranscript += result[0].transcript;\n } else {\n interimTranscript += result[0].transcript;\n }\n }\n\n transcript.value = finalTranscript + '\\n' + interimTranscript;\n };\n\n recognition.onerror = (event) => {\n console.error('Speech recognition error:', event.error);\n status.textContent = 'Error: ' + event.error;\n };\n } else {\n startButton.disabled = true;\n status.textContent = 'Speech recognition not supported';\n }\n\n startButton.addEventListener('click', () => {\n if (recognition) {\n recognition.start();\n }\n });\n\n stopButton.addEventListener('click', () => {\n if (recognition) {\n recognition.stop();\n }\n });\n\n copyButton.addEventListener('click', () => {\n transcript.select();\n document.execCommand('copy');\n \n const originalText = copyButton.textContent;\n copyButton.textContent = 'Copied!';\n \n setTimeout(() => {\n copyButton.textContent = originalText;\n }, 2000);\n });\n\n // Auto-save transcript every 5 seconds\n setInterval(() => {\n if (transcript.value) {\n localStorage.setItem('savedTranscript', transcript.value);\n }\n }, 5000);\n\n // Load saved transcript on page load\n window.addEventListener('load', () => {\n const savedTranscript = localStorage.getItem('savedTranscript');\n if (savedTranscript) {\n transcript.value = savedTranscript;\n }\n });\n </script>\n</body>\n</html>\n", "created_at": "2024-11-03T15:08:01.629Z", "updated_at": "2024-11-03T15:08:01.990Z", "project": 8}}, {"model": "api.version", "pk": 17, "fields": {"versionId": "3a900a3a-5984-4f54-a720-4c2e65fad5e3", "versionCount": 1, "versionMessage": "This is my Previous Code:\n\n```\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>Speech to Text</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"container mx-auto px-4 py-8\">\n <div class=\"max-w-2xl mx-auto\">\n <h1 class=\"text-3xl font-bold text-center mb-8 text-gray-800\">Speech to Text Transcriber</h1>\n \n <div class=\"bg-white rounded-lg shadow-md p-6\">\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <button id=\"startButton\" class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200\">\n Start Recording\n </button>\n \n <button id=\"stopButton\" class=\"bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200 hidden\">\n Stop Recording\n </button>\n </div>\n\n <div class=\"status-indicator flex items-center justify-center mb-4\">\n <div id=\"statusDot\" class=\"w-3 h-3 rounded-full bg-gray-400 mr-2\"></div>\n <span id=\"status\" class=\"text-gray-600\">Not Recording</span>\n </div>\n\n <div class=\"relative\">\n <textarea \n id=\"transcript\" \n class=\"w-full h-64 p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none\"\n placeholder=\"Your transcript will appear here...\"\n readonly\n ></textarea>\n \n <button \n id=\"copyButton\"\n class=\"absolute bottom-4 right-4 bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Copy\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <script>\n const startButton = document.getElementById('startButton');\n const stopButton = document.getElementById('stopButton');\n const transcript = document.getElementById('transcript');\n const status = document.getElementById('status');\n const statusDot = document.getElementById('statusDot');\n const copyButton = document.getElementById('copyButton');\n\n let recognition = null;\n\n if ('webkitSpeechRecognition' in window) {\n recognition = new webkitSpeechRecognition();\n recognition.continuous = true;\n recognition.interimResults = true;\n\n recognition.onstart = () => {\n status.textContent = 'Recording...';\n statusDot.classList.remove('bg-gray-400');\n statusDot.classList.add('bg-red-500');\n startButton.classList.add('hidden');\n stopButton.classList.remove('hidden');\n };\n\n recognition.onend = () => {\n status.textContent = 'Not Recording';\n statusDot.classList.remove('bg-red-500');\n statusDot.classList.add('bg-gray-400');\n startButton.classList.remove('hidden');\n stopButton.classList.add('hidden');\n };\n\n recognition.onresult = (event) => {\n let finalTranscript = '';\n let interimTranscript = '';\n\n for (let i = event.resultIndex; i < event.results.length; i++) {\n const result = event.results[i];\n if (result.isFinal) {\n finalTranscript += result[0].transcript;\n } else {\n interimTranscript += result[0].transcript;\n }\n }\n\n transcript.value = finalTranscript + '\\n' + interimTranscript;\n };\n\n recognition.onerror = (event) => {\n console.error('Speech recognition error:', event.error);\n status.textContent = 'Error: ' + event.error;\n };\n } else {\n startButton.disabled = true;\n status.textContent = 'Speech recognition not supported';\n }\n\n startButton.addEventListener('click', () => {\n if (recognition) {\n recognition.start();\n }\n });\n\n stopButton.addEventListener('click', () => {\n if (recognition) {\n recognition.stop();\n }\n });\n\n copyButton.addEventListener('click', () => {\n transcript.select();\n document.execCommand('copy');\n \n const originalText = copyButton.textContent;\n copyButton.textContent = 'Copied!';\n \n setTimeout(() => {\n copyButton.textContent = originalText;\n }, 2000);\n });\n\n // Auto-save transcript every 5 seconds\n setInterval(() => {\n if (transcript.value) {\n localStorage.setItem('savedTranscript', transcript.value);\n }\n }, 5000);\n\n // Load saved transcript on page load\n window.addEventListener('load', () => {\n const savedTranscript = localStorage.getItem('savedTranscript');\n if (savedTranscript) {\n transcript.value = savedTranscript;\n }\n });\n </script>\n</body>\n</html>\n```\n\nwhat ever I say I should have a button to just save that for later.", "generatedCode": "\n<!DOCTYPE html>\n<html>\n<head>\n <title>Speech to Text</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"container mx-auto px-4 py-8\">\n <div class=\"max-w-2xl mx-auto\">\n <h1 class=\"text-3xl font-bold text-center mb-8 text-gray-800\">Speech to Text Transcriber</h1>\n \n <div class=\"bg-white rounded-lg shadow-md p-6\">\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <button id=\"startButton\" class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200\">\n Start Recording\n </button>\n \n <button id=\"stopButton\" class=\"bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200 hidden\">\n Stop Recording\n </button>\n </div>\n\n <div class=\"status-indicator flex items-center justify-center mb-4\">\n <div id=\"statusDot\" class=\"w-3 h-3 rounded-full bg-gray-400 mr-2\"></div>\n <span id=\"status\" class=\"text-gray-600\">Not Recording</span>\n </div>\n\n <div class=\"relative\">\n <textarea \n id=\"transcript\" \n class=\"w-full h-64 p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none\"\n placeholder=\"Your transcript will appear here...\"\n readonly\n ></textarea>\n \n <div class=\"absolute bottom-4 right-4 flex space-x-2\">\n <button \n id=\"copyButton\"\n class=\"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Copy\n </button>\n <button \n id=\"saveButton\"\n class=\"bg-green-500 hover:bg-green-600 text-white font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Save\n </button>\n </div>\n </div>\n\n <div id=\"savedTranscripts\" class=\"mt-6 space-y-3\">\n <h2 class=\"font-semibold text-gray-700 mb-2\">Saved Transcripts</h2>\n <div id=\"savedList\" class=\"space-y-2\"></div>\n </div>\n </div>\n </div>\n </div>\n\n <script>\n const startButton = document.getElementById('startButton');\n const stopButton = document.getElementById('stopButton');\n const transcript = document.getElementById('transcript');\n const status = document.getElementById('status');\n const statusDot = document.getElementById('statusDot');\n const copyButton = document.getElementById('copyButton');\n const saveButton = document.getElementById('saveButton');\n const savedList = document.getElementById('savedList');\n\n let recognition = null;\n\n function loadSavedTranscripts() {\n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n savedList.innerHTML = saved.map((item, index) => `\n <div class=\"flex items-center justify-between p-3 bg-gray-50 rounded\">\n <p class=\"text-sm text-gray-600 flex-1 mr-4\">${item.text.substring(0, 100)}${item.text.length > 100 ? '...' : ''}</p>\n <div class=\"flex space-x-2\">\n <button \n onclick=\"deleteSavedTranscript(${index})\" \n class=\"text-red-500 hover:text-red-600 text-sm\"\n >\n Delete\n </button>\n </div>\n </div>\n `).join('');\n }\n\n function saveTranscript() {\n if (!transcript.value.trim()) return;\n \n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n saved.push({\n text: transcript.value,\n date: new Date().toISOString()\n });\n localStorage.setItem('savedTranscripts', JSON.stringify(saved));\n loadSavedTranscripts();\n\n // Visual feedback\n saveButton.textContent = 'Saved!';\n setTimeout(() => {\n saveButton.textContent = 'Save';\n }, 2000);\n }\n\n function deleteSavedTranscript(index) {\n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n saved.splice(index, 1);\n localStorage.setItem('savedTranscripts', JSON.stringify(saved));\n loadSavedTranscripts();\n }\n\n if ('webkitSpeechRecognition' in window) {\n recognition = new webkitSpeechRecognition();\n recognition.continuous = true;\n recognition.interimResults = true;\n\n recognition.onstart = () => {\n status.textContent = 'Recording...';\n statusDot.classList.remove('bg-gray-400');\n statusDot.classList.add('bg-red-500');\n startButton.classList.add('hidden');\n stopButton.classList.remove('hidden');\n };\n\n recognition.onend = () => {\n status.textContent = 'Not Recording';\n statusDot.classList.remove('bg-red-500');\n statusDot.classList.add('bg-gray-400');\n startButton.classList.remove('hidden');\n stopButton.classList.add('hidden');\n };\n\n recognition.onresult = (event) => {\n let finalTranscript = '';\n let interimTranscript = '';\n\n for (let i = event.resultIndex; i < event.results.length; i++) {\n const result = event.results[i];\n if (result.isFinal) {\n finalTranscript += result[0].transcript;\n } else {\n interimTranscript += result[0].transcript;\n }\n }\n\n transcript.value = finalTranscript + '\\n' + interimTranscript;\n };\n\n recognition.onerror = (event) => {\n console.error('Speech recognition error:', event.error);\n status.textContent = 'Error: ' + event.error;\n };\n } else {\n startButton.disabled = true;\n status.textContent = 'Speech recognition not supported';\n }\n\n startButton.addEventListener('click', () => {\n if (recognition) {\n recognition.start();\n }\n });\n\n stopButton.addEventListener('click', () => {\n if (recognition) {\n recognition.stop();\n }\n });\n\n copyButton.addEventListener('click', () => {\n transcript.select();\n document.execCommand('copy');\n \n const originalText = copyButton.textContent;\n copyButton.textContent = 'Copied!';\n \n setTimeout(() => {\n copyButton.textContent = originalText;\n }, 2000);\n });\n\n saveButton.addEventListener('click', saveTranscript);\n\n // Load saved transcripts on page load\n window.addEventListener('load', loadSavedTranscripts);\n </script>\n</body>\n</html>\n", "created_at": "2024-11-03T15:09:44.594Z", "updated_at": "2024-11-03T15:09:44.985Z", "project": 8}}, {"model": "api.version", "pk": 18, "fields": {"versionId": "0e247516-5571-491d-a74e-8dae85ed1ff8", "versionCount": 1, "versionMessage": "This is my Previous Code:\n\n```\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>Speech to Text</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"container mx-auto px-4 py-8\">\n <div class=\"max-w-2xl mx-auto\">\n <h1 class=\"text-3xl font-bold text-center mb-8 text-gray-800\">Speech to Text Transcriber</h1>\n \n <div class=\"bg-white rounded-lg shadow-md p-6\">\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <button id=\"startButton\" class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200\">\n Start Recording\n </button>\n \n <button id=\"stopButton\" class=\"bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200 hidden\">\n Stop Recording\n </button>\n </div>\n\n <div class=\"status-indicator flex items-center justify-center mb-4\">\n <div id=\"statusDot\" class=\"w-3 h-3 rounded-full bg-gray-400 mr-2\"></div>\n <span id=\"status\" class=\"text-gray-600\">Not Recording</span>\n </div>\n\n <div class=\"relative\">\n <textarea \n id=\"transcript\" \n class=\"w-full h-64 p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none\"\n placeholder=\"Your transcript will appear here...\"\n readonly\n ></textarea>\n \n <div class=\"absolute bottom-4 right-4 flex space-x-2\">\n <button \n id=\"copyButton\"\n class=\"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Copy\n </button>\n <button \n id=\"saveButton\"\n class=\"bg-green-500 hover:bg-green-600 text-white font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Save\n </button>\n </div>\n </div>\n\n <div id=\"savedTranscripts\" class=\"mt-6 space-y-3\">\n <h2 class=\"font-semibold text-gray-700 mb-2\">Saved Transcripts</h2>\n <div id=\"savedList\" class=\"space-y-2\"></div>\n </div>\n </div>\n </div>\n </div>\n\n <script>\n const startButton = document.getElementById('startButton');\n const stopButton = document.getElementById('stopButton');\n const transcript = document.getElementById('transcript');\n const status = document.getElementById('status');\n const statusDot = document.getElementById('statusDot');\n const copyButton = document.getElementById('copyButton');\n const saveButton = document.getElementById('saveButton');\n const savedList = document.getElementById('savedList');\n\n let recognition = null;\n\n function loadSavedTranscripts() {\n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n savedList.innerHTML = saved.map((item, index) => `\n <div class=\"flex items-center justify-between p-3 bg-gray-50 rounded\">\n <p class=\"text-sm text-gray-600 flex-1 mr-4\">${item.text.substring(0, 100)}${item.text.length > 100 ? '...' : ''}</p>\n <div class=\"flex space-x-2\">\n <button \n onclick=\"deleteSavedTranscript(${index})\" \n class=\"text-red-500 hover:text-red-600 text-sm\"\n >\n Delete\n </button>\n </div>\n </div>\n `).join('');\n }\n\n function saveTranscript() {\n if (!transcript.value.trim()) return;\n \n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n saved.push({\n text: transcript.value,\n date: new Date().toISOString()\n });\n localStorage.setItem('savedTranscripts', JSON.stringify(saved));\n loadSavedTranscripts();\n\n // Visual feedback\n saveButton.textContent = 'Saved!';\n setTimeout(() => {\n saveButton.textContent = 'Save';\n }, 2000);\n }\n\n function deleteSavedTranscript(index) {\n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n saved.splice(index, 1);\n localStorage.setItem('savedTranscripts', JSON.stringify(saved));\n loadSavedTranscripts();\n }\n\n if ('webkitSpeechRecognition' in window) {\n recognition = new webkitSpeechRecognition();\n recognition.continuous = true;\n recognition.interimResults = true;\n\n recognition.onstart = () => {\n status.textContent = 'Recording...';\n statusDot.classList.remove('bg-gray-400');\n statusDot.classList.add('bg-red-500');\n startButton.classList.add('hidden');\n stopButton.classList.remove('hidden');\n };\n\n recognition.onend = () => {\n status.textContent = 'Not Recording';\n statusDot.classList.remove('bg-red-500');\n statusDot.classList.add('bg-gray-400');\n startButton.classList.remove('hidden');\n stopButton.classList.add('hidden');\n };\n\n recognition.onresult = (event) => {\n let finalTranscript = '';\n let interimTranscript = '';\n\n for (let i = event.resultIndex; i < event.results.length; i++) {\n const result = event.results[i];\n if (result.isFinal) {\n finalTranscript += result[0].transcript;\n } else {\n interimTranscript += result[0].transcript;\n }\n }\n\n transcript.value = finalTranscript + '\\n' + interimTranscript;\n };\n\n recognition.onerror = (event) => {\n console.error('Speech recognition error:', event.error);\n status.textContent = 'Error: ' + event.error;\n };\n } else {\n startButton.disabled = true;\n status.textContent = 'Speech recognition not supported';\n }\n\n startButton.addEventListener('click', () => {\n if (recognition) {\n recognition.start();\n }\n });\n\n stopButton.addEventListener('click', () => {\n if (recognition) {\n recognition.stop();\n }\n });\n\n copyButton.addEventListener('click', () => {\n transcript.select();\n document.execCommand('copy');\n \n const originalText = copyButton.textContent;\n copyButton.textContent = 'Copied!';\n \n setTimeout(() => {\n copyButton.textContent = originalText;\n }, 2000);\n });\n\n saveButton.addEventListener('click', saveTranscript);\n\n // Load saved transcripts on page load\n window.addEventListener('load', loadSavedTranscripts);\n </script>\n</body>\n</html>\n```\n\nI also want a popup when I click save because I want to add a title to my note", "generatedCode": "\n<!DOCTYPE html>\n<html>\n<head>\n <title>Speech to Text</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"container mx-auto px-4 py-8\">\n <div class=\"max-w-2xl mx-auto\">\n <h1 class=\"text-3xl font-bold text-center mb-8 text-gray-800\">Speech to Text Transcriber</h1>\n \n <!-- Modal -->\n <div id=\"saveModal\" class=\"fixed inset-0 bg-gray-600 bg-opacity-50 hidden\">\n <div class=\"flex items-center justify-center min-h-screen\">\n <div class=\"bg-white rounded-lg shadow-xl p-6 w-96\">\n <h3 class=\"text-lg font-semibold mb-4\">Save Transcript</h3>\n <input \n type=\"text\" \n id=\"transcriptTitle\"\n placeholder=\"Enter title for your transcript\"\n class=\"w-full p-2 border border-gray-300 rounded mb-4 focus:ring-2 focus:ring-blue-500 focus:border-transparent\"\n >\n <div class=\"flex justify-end space-x-2\">\n <button \n id=\"cancelSave\" \n class=\"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300 transition duration-200\"\n >\n Cancel\n </button>\n <button \n id=\"confirmSave\" \n class=\"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-200\"\n >\n Save\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"bg-white rounded-lg shadow-md p-6\">\n <div class=\"flex flex-col items-center gap-4 mb-6\">\n <button id=\"startButton\" class=\"bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200\">\n Start Recording\n </button>\n \n <button id=\"stopButton\" class=\"bg-red-500 hover:bg-red-600 text-white font-medium py-2 px-4 rounded-lg transition duration-200 hidden\">\n Stop Recording\n </button>\n </div>\n\n <div class=\"status-indicator flex items-center justify-center mb-4\">\n <div id=\"statusDot\" class=\"w-3 h-3 rounded-full bg-gray-400 mr-2\"></div>\n <span id=\"status\" class=\"text-gray-600\">Not Recording</span>\n </div>\n\n <div class=\"relative\">\n <textarea \n id=\"transcript\" \n class=\"w-full h-64 p-4 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none\"\n placeholder=\"Your transcript will appear here...\"\n readonly\n ></textarea>\n \n <div class=\"absolute bottom-4 right-4 flex space-x-2\">\n <button \n id=\"copyButton\"\n class=\"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Copy\n </button>\n <button \n id=\"saveButton\"\n class=\"bg-green-500 hover:bg-green-600 text-white font-medium py-1 px-3 rounded text-sm transition duration-200\"\n >\n Save\n </button>\n </div>\n </div>\n\n <div id=\"savedTranscripts\" class=\"mt-6 space-y-3\">\n <h2 class=\"font-semibold text-gray-700 mb-2\">Saved Transcripts</h2>\n <div id=\"savedList\" class=\"space-y-2\"></div>\n </div>\n </div>\n </div>\n </div>\n\n <script>\n const startButton = document.getElementById('startButton');\n const stopButton = document.getElementById('stopButton');\n const transcript = document.getElementById('transcript');\n const status = document.getElementById('status');\n const statusDot = document.getElementById('statusDot');\n const copyButton = document.getElementById('copyButton');\n const saveButton = document.getElementById('saveButton');\n const savedList = document.getElementById('savedList');\n const saveModal = document.getElementById('saveModal');\n const transcriptTitle = document.getElementById('transcriptTitle');\n const confirmSave = document.getElementById('confirmSave');\n const cancelSave = document.getElementById('cancelSave');\n\n let recognition = null;\n\n function loadSavedTranscripts() {\n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n savedList.innerHTML = saved.map((item, index) => `\n <div class=\"flex items-center justify-between p-3 bg-gray-50 rounded\">\n <div class=\"flex-1 mr-4\">\n <h3 class=\"font-medium text-gray-800 mb-1\">${item.title}</h3>\n <p class=\"text-sm text-gray-600\">${item.text.substring(0, 100)}${item.text.length > 100 ? '...' : ''}</p>\n </div>\n <div class=\"flex space-x-2\">\n <button \n onclick=\"deleteSavedTranscript(${index})\" \n class=\"text-red-500 hover:text-red-600 text-sm\"\n >\n Delete\n </button>\n </div>\n </div>\n `).join('');\n }\n\n function saveTranscript() {\n if (!transcript.value.trim()) return;\n \n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n saved.push({\n title: transcriptTitle.value || 'Untitled',\n text: transcript.value,\n date: new Date().toISOString()\n });\n localStorage.setItem('savedTranscripts', JSON.stringify(saved));\n loadSavedTranscripts();\n \n // Close modal and reset\n saveModal.classList.add('hidden');\n transcriptTitle.value = '';\n \n // Visual feedback\n saveButton.textContent = 'Saved!';\n setTimeout(() => {\n saveButton.textContent = 'Save';\n }, 2000);\n }\n\n function deleteSavedTranscript(index) {\n const saved = JSON.parse(localStorage.getItem('savedTranscripts') || '[]');\n saved.splice(index, 1);\n localStorage.setItem('savedTranscripts', JSON.stringify(saved));\n loadSavedTranscripts();\n }\n\n if ('webkitSpeechRecognition' in window) {\n recognition = new webkitSpeechRecognition();\n recognition.continuous = true;\n recognition.interimResults = true;\n\n recognition.onstart = () => {\n status.textContent = 'Recording...';\n statusDot.classList.remove('bg-gray-400');\n statusDot.classList.add('bg-red-500');\n startButton.classList.add('hidden');\n stopButton.classList.remove('hidden');\n };\n\n recognition.onend = () => {\n status.textContent = 'Not Recording';\n statusDot.classList.remove('bg-red-500');\n statusDot.classList.add('bg-gray-400');\n startButton.classList.remove('hidden');\n stopButton.classList.add('hidden');\n };\n\n recognition.onresult = (event) => {\n let finalTranscript = '';\n let interimTranscript = '';\n\n for (let i = event.resultIndex; i < event.results.length; i++) {\n const result = event.results[i];\n if (result.isFinal) {\n finalTranscript += result[0].transcript;\n } else {\n interimTranscript += result[0].transcript;\n }\n }\n\n transcript.value = finalTranscript + '\\n' + interimTranscript;\n };\n\n recognition.onerror = (event) => {\n console.error('Speech recognition error:', event.error);\n status.textContent = 'Error: ' + event.error;\n };\n } else {\n startButton.disabled = true;\n status.textContent = 'Speech recognition not supported';\n }\n\n startButton.addEventListener('click', () => {\n if (recognition) {\n recognition.start();\n }\n });\n\n stopButton.addEventListener('click', () => {\n if (recognition) {\n recognition.stop();\n }\n });\n\n copyButton.addEventListener('click', () => {\n transcript.select();\n document.execCommand('copy');\n \n const originalText = copyButton.textContent;\n copyButton.textContent = 'Copied!';\n \n setTimeout(() => {\n copyButton.textContent = originalText;\n }, 2000);\n });\n\n saveButton.addEventListener('click', () => {\n if (transcript.value.trim()) {\n saveModal.classList.remove('hidden');\n }\n });\n\n confirmSave.addEventListener('click', saveTranscript);\n \n cancelSave.addEventListener('click', () => {\n saveModal.classList.add('hidden');\n transcriptTitle.value = '';\n });\n\n // Close modal when clicking outside\n saveModal.addEventListener('click', (e) => {\n if (e.target === saveModal) {\n saveModal.classList.add('hidden');\n transcriptTitle.value = '';\n }\n });\n\n // Load saved transcripts on page load\n window.addEventListener('load', loadSavedTranscripts);\n </script>\n</body>\n</html>\n", "created_at": "2024-11-03T15:11:38.135Z", "updated_at": "2024-11-03T15:11:38.571Z", "project": 8}}, {"model": "api.version", "pk": 19, "fields": {"versionId": "f0d4fe79-59cc-4b4e-8f1d-5f3687f56f66", "versionCount": 1, "versionMessage": "Initial version", "generatedCode": "", "created_at": "2024-11-03T15:29:09.789Z", "updated_at": "2024-11-03T15:29:10.170Z", "project": 9}}, {"model": "api.version", "pk": 20, "fields": {"versionId": "f4e23ae8-5677-425c-a99a-2bb05db7a113", "versionCount": 1, "versionMessage": "create a app for voice activation chat\r\n\r\n---\r\n\r\ncreate a app for voice activation chat app which allow us to record audio and say to out files.", "generatedCode": "\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Voice Chat App</title>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n</head>\n<body class=\"bg-gray-100\">\n <div class=\"container mx-auto px-4 py-8\">\n <div class=\"max-w-2xl mx-auto bg-white rounded-lg shadow-lg p-6\">\n <h1 class=\"text-3xl font-bold text-center text-gray-800 mb-8\">Voice Chat App</h1>\n\n <div class=\"flex flex-col items-center gap-4\">\n <button id=\"recordButton\" class=\"bg-blue-500 hover:bg-blue-600 text-white font-semibold py-3 px-6 rounded-full flex items-center gap-2 transition-colors\">\n <svg class=\"w-6 h-6\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <circle cx=\"12\" cy=\"12\" r=\"6\"></circle>\n </svg>\n <span>Start Recording</span>\n </button>\n\n <div id=\"recordingStatus\" class=\"text-gray-600 hidden\">\n Recording... <span id=\"timer\" class=\"font-mono\">00:00</span>\n </div>\n\n <div id=\"audioList\" class=\"w-full space-y-4 mt-6\">\n <!-- Audio clips will be added here -->\n </div>\n </div>\n </div>\n </div>\n\n <script>\n let mediaRecorder;\n let audioChunks = [];\n let isRecording = false;\n let timerInterval;\n let startTime;\n \n const recordButton = document.getElementById('recordButton');\n const recordingStatus = document.getElementById('recordingStatus');\n const timer = document.getElementById('timer');\n const audioList = document.getElementById('audioList');\n\n async function initializeRecording() {\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n mediaRecorder = new MediaRecorder(stream);\n\n mediaRecorder.ondataavailable = (event) => {\n audioChunks.push(event.data);\n };\n\n mediaRecorder.onstop = () => {\n const audioBlob = new Blob(audioChunks, { type: 'audio/wav' });\n const audioUrl = URL.createObjectURL(audioBlob);\n addAudioElement(audioUrl);\n audioChunks = [];\n };\n\n } catch (err) {\n console.error('Error accessing microphone:', err);\n alert('Unable to access microphone. Please check permissions.');\n }\n }\n\n function updateTimer() {\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n const minutes = Math.floor(elapsed / 60).toString().padStart(2, '0');\n const seconds = (elapsed % 60).toString().padStart(2, '0');\n timer.textContent = `${minutes}:${seconds}`;\n }\n\n function addAudioElement(audioUrl) {\n const timestamp = new Date().toLocaleTimeString();\n const audioContainer = document.createElement('div');\n audioContainer.className = 'bg-gray-50 p-4 rounded-lg';\n \n audioContainer.innerHTML = `\n <div class=\"flex items-center justify-between mb-2\">\n <span class=\"text-sm text-gray-500\">${timestamp}</span>\n <button class=\"text-red-500 hover:text-red-600\" onclick=\"this.parentElement.parentElement.remove()\">\n <svg class=\"w-5 h-5\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\"/>\n </svg>\n </button>\n </div>\n <audio controls class=\"w-full\" data-caption=\"Voice recording from ${timestamp}\">\n <source src=\"${audioUrl}\" type=\"audio/wav\">\n Your browser does not support the audio element.\n </audio>\n `;\n\n audioList.insertBefore(audioContainer, audioList.firstChild);\n }\n\n recordButton.addEventListener('click', async () => {\n if (!mediaRecorder) {\n await initializeRecording();\n }\n\n if (!isRecording) {\n mediaRecorder.start();\n isRecording = true;\n startTime = Date.now();\n timerInterval = setInterval(updateTimer, 1000);\n recordButton.innerHTML = `\n <svg class=\"w-6 h-6\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <rect x=\"6\" y=\"6\" width=\"12\" height=\"12\"/>\n </svg>\n <span>Stop Recording</span>\n `;\n recordButton.classList.replace('bg-blue-500', 'bg-red-500');\n recordButton.classList.replace('hover:bg-blue-600', 'hover:bg-red-600');\n recordingStatus.classList.remove('hidden');\n } else {\n mediaRecorder.stop();\n isRecording = false;\n clearInterval(timerInterval);\n recordButton.innerHTML = `\n <svg class=\"w-6 h-6\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n <circle cx=\"12\" cy=\"12\" r=\"6\"></circle>\n </svg>\n <span>Start Recording</span>\n `;\n recordButton.classList.replace('bg-red-500', 'bg-blue-500');\n recordButton.classList.replace('hover:bg-red-600', 'hover:bg-blue-600');\n recordingStatus.classList.add('hidden');\n }\n });\n </script>\n</body>\n</html>\n", "created_at": "2024-11-03T15:29:42.311Z", "updated_at": "2024-11-03T15:29:42.870Z", "project": 9}}]
|
db.sqlite3
ADDED
Binary file (213 kB). View file
|
|
instabuild/__init__.py
ADDED
File without changes
|
instabuild/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (168 Bytes). View file
|
|
instabuild/__pycache__/settings.cpython-311.pyc
ADDED
Binary file (2.89 kB). View file
|
|
instabuild/__pycache__/urls.cpython-311.pyc
ADDED
Binary file (525 Bytes). View file
|
|
instabuild/__pycache__/wsgi.cpython-311.pyc
ADDED
Binary file (696 Bytes). View file
|
|
instabuild/asgi.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
ASGI config for instabuild project.
|
3 |
+
|
4 |
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
5 |
+
|
6 |
+
For more information on this file, see
|
7 |
+
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
|
8 |
+
"""
|
9 |
+
|
10 |
+
import os
|
11 |
+
|
12 |
+
from django.core.asgi import get_asgi_application
|
13 |
+
|
14 |
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instabuild.settings")
|
15 |
+
|
16 |
+
application = get_asgi_application()
|
instabuild/settings.py
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
Django settings for instabuild project.
|
3 |
+
|
4 |
+
Generated by 'django-admin startproject' using Django 5.1.2.
|
5 |
+
|
6 |
+
For more information on this file, see
|
7 |
+
https://docs.djangoproject.com/en/5.1/topics/settings/
|
8 |
+
|
9 |
+
For the full list of settings and their values, see
|
10 |
+
https://docs.djangoproject.com/en/5.1/ref/settings/
|
11 |
+
"""
|
12 |
+
|
13 |
+
from pathlib import Path
|
14 |
+
|
15 |
+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
16 |
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
17 |
+
|
18 |
+
|
19 |
+
# Quick-start development settings - unsuitable for production
|
20 |
+
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
|
21 |
+
|
22 |
+
# SECURITY WARNING: keep the secret key used in production secret!
|
23 |
+
SECRET_KEY = "django-insecure-8rdfha5*q&t&z_=95tmz=le4np_bl(t^l(*6a36(%&lj_+5j+*"
|
24 |
+
|
25 |
+
# SECURITY WARNING: don't run with debug turned on in production!
|
26 |
+
DEBUG = True
|
27 |
+
|
28 |
+
ALLOWED_HOSTS = ["*"]
|
29 |
+
CORS_ORIGIN_ALLOW_ALL = True
|
30 |
+
CORS_ORIGIN_ALLOW_ALL = True
|
31 |
+
CORS_ALLOW_CREDENTIALS = False
|
32 |
+
|
33 |
+
|
34 |
+
# Application definition
|
35 |
+
|
36 |
+
INSTALLED_APPS = [
|
37 |
+
"django.contrib.admin",
|
38 |
+
"django.contrib.auth",
|
39 |
+
"django.contrib.contenttypes",
|
40 |
+
"django.contrib.sessions",
|
41 |
+
"django.contrib.messages",
|
42 |
+
"django.contrib.staticfiles",
|
43 |
+
"api",
|
44 |
+
"corsheaders",
|
45 |
+
"import_export",
|
46 |
+
]
|
47 |
+
|
48 |
+
MIDDLEWARE = [
|
49 |
+
"django.middleware.security.SecurityMiddleware",
|
50 |
+
"django.contrib.sessions.middleware.SessionMiddleware",
|
51 |
+
"corsheaders.middleware.CorsMiddleware",
|
52 |
+
"django.middleware.common.CommonMiddleware",
|
53 |
+
"django.middleware.csrf.CsrfViewMiddleware",
|
54 |
+
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
55 |
+
"django.contrib.messages.middleware.MessageMiddleware",
|
56 |
+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
57 |
+
]
|
58 |
+
|
59 |
+
ROOT_URLCONF = "instabuild.urls"
|
60 |
+
|
61 |
+
TEMPLATES = [
|
62 |
+
{
|
63 |
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
64 |
+
"DIRS": [],
|
65 |
+
"APP_DIRS": True,
|
66 |
+
"OPTIONS": {
|
67 |
+
"context_processors": [
|
68 |
+
"django.template.context_processors.debug",
|
69 |
+
"django.template.context_processors.request",
|
70 |
+
"django.contrib.auth.context_processors.auth",
|
71 |
+
"django.contrib.messages.context_processors.messages",
|
72 |
+
],
|
73 |
+
},
|
74 |
+
},
|
75 |
+
]
|
76 |
+
|
77 |
+
WSGI_APPLICATION = "instabuild.wsgi.application"
|
78 |
+
|
79 |
+
|
80 |
+
# Database
|
81 |
+
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
|
82 |
+
|
83 |
+
DATABASES = {
|
84 |
+
'default': {
|
85 |
+
'ENGINE': 'django.db.backends.postgresql',
|
86 |
+
'NAME': 'postgres',
|
87 |
+
'USER': 'postgres.hmfpsokyfhrqhmvmsgpk',
|
88 |
+
'PORT': 6543,
|
89 |
+
'PASSWORD': 'RSPuG9OZ3czmpiHh',
|
90 |
+
'HOST': 'aws-0-us-east-1.pooler.supabase.com',
|
91 |
+
}
|
92 |
+
}
|
93 |
+
# "default": {
|
94 |
+
# "ENGINE": "django.db.backends.sqlite3",
|
95 |
+
# "NAME": BASE_DIR / "db.sqlite3",
|
96 |
+
# }
|
97 |
+
|
98 |
+
# Password validation
|
99 |
+
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
|
100 |
+
|
101 |
+
AUTH_PASSWORD_VALIDATORS = [
|
102 |
+
{
|
103 |
+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
104 |
+
},
|
105 |
+
{
|
106 |
+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
107 |
+
},
|
108 |
+
{
|
109 |
+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
110 |
+
},
|
111 |
+
{
|
112 |
+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
113 |
+
},
|
114 |
+
]
|
115 |
+
|
116 |
+
|
117 |
+
# Internationalization
|
118 |
+
# https://docs.djangoproject.com/en/5.1/topics/i18n/
|
119 |
+
|
120 |
+
LANGUAGE_CODE = "en-us"
|
121 |
+
|
122 |
+
TIME_ZONE = "UTC"
|
123 |
+
|
124 |
+
USE_I18N = True
|
125 |
+
|
126 |
+
USE_TZ = True
|
127 |
+
|
128 |
+
|
129 |
+
# Static files (CSS, JavaScript, Images)
|
130 |
+
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
131 |
+
|
132 |
+
STATIC_URL = "static/"
|
133 |
+
|
134 |
+
# Default primary key field type
|
135 |
+
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
136 |
+
|
137 |
+
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
instabuild/urls.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from django.contrib import admin
|
2 |
+
from django.urls import path
|
3 |
+
from django.urls import include, path
|
4 |
+
|
5 |
+
urlpatterns = [
|
6 |
+
path("api/", include("api.urls")),
|
7 |
+
path("admin/", admin.site.urls),
|
8 |
+
]
|
instabuild/wsgi.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
WSGI config for instabuild project.
|
3 |
+
|
4 |
+
It exposes the WSGI callable as a module-level variable named ``application``.
|
5 |
+
|
6 |
+
For more information on this file, see
|
7 |
+
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
|
8 |
+
"""
|
9 |
+
|
10 |
+
import os
|
11 |
+
|
12 |
+
from django.core.wsgi import get_wsgi_application
|
13 |
+
|
14 |
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instabuild.settings")
|
15 |
+
|
16 |
+
application = get_wsgi_application()
|
manage.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
"""Django's command-line utility for administrative tasks."""
|
3 |
+
import os
|
4 |
+
import sys
|
5 |
+
|
6 |
+
|
7 |
+
def main():
|
8 |
+
"""Run administrative tasks."""
|
9 |
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "instabuild.settings")
|
10 |
+
try:
|
11 |
+
from django.core.management import execute_from_command_line
|
12 |
+
except ImportError as exc:
|
13 |
+
raise ImportError(
|
14 |
+
"Couldn't import Django. Are you sure it's installed and "
|
15 |
+
"available on your PYTHONPATH environment variable? Did you "
|
16 |
+
"forget to activate a virtual environment?"
|
17 |
+
) from exc
|
18 |
+
execute_from_command_line(sys.argv)
|
19 |
+
|
20 |
+
|
21 |
+
if __name__ == "__main__":
|
22 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
asgiref==3.8.1
|
2 |
+
certifi==2024.8.30
|
3 |
+
charset-normalizer==3.4.0
|
4 |
+
diff-match-patch==20241021
|
5 |
+
Django==5.1.2
|
6 |
+
django-cors-headers==4.6.0
|
7 |
+
django-import-export==4.2.0
|
8 |
+
idna==3.10
|
9 |
+
pillow==11.0.0
|
10 |
+
requests==2.32.3
|
11 |
+
sqlparse==0.5.1
|
12 |
+
tablib==3.7.0
|
13 |
+
tzdata==2024.2
|
14 |
+
urllib3==2.2.3
|
15 |
+
psycopg2==2.9.10
|