Auto commit: 2026-03-12T13:34:18.743Z
This commit is contained in:
parent
75b41152b3
commit
ffe8cee686
BIN
assets/pasted-20260312-075015-5bfcde5a.png
Normal file
BIN
assets/pasted-20260312-075015-5bfcde5a.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 248 KiB |
BIN
assets/pasted-20260312-075439-a7d6936f.png
Normal file
BIN
assets/pasted-20260312-075439-a7d6936f.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 248 KiB |
BIN
assets/pasted-20260312-080648-eac18161.png
Normal file
BIN
assets/pasted-20260312-080648-eac18161.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 481 KiB |
BIN
assets/vm-shot-2026-03-12T07-54-30-697Z.jpg
Normal file
BIN
assets/vm-shot-2026-03-12T07-54-30-697Z.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -180,3 +180,6 @@ if EMAIL_USE_SSL:
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
LOGIN_REDIRECT_URL = '/projects/'
|
||||
LOGOUT_REDIRECT_URL = '/'
|
||||
@ -21,9 +21,10 @@ from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("accounts/", include("django.contrib.auth.urls")),
|
||||
path("", include("core.urls")),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets")
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
Binary file not shown.
Binary file not shown.
BIN
core/__pycache__/ai_views.cpython-311.pyc
Normal file
BIN
core/__pycache__/ai_views.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18
core/ai_views.py
Normal file
18
core/ai_views.py
Normal file
@ -0,0 +1,18 @@
|
||||
from django.http import JsonResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.contrib.auth.decorators import login_required
|
||||
import json
|
||||
|
||||
@csrf_exempt
|
||||
@login_required
|
||||
def ai_chat(request, pk):
|
||||
if request.method == 'POST':
|
||||
data = json.loads(request.body)
|
||||
user_message = data.get('message')
|
||||
|
||||
# In a real app, this would call your AI service (e.g., GPT, Gemini)
|
||||
# Here we mock the AI response
|
||||
ai_response = f"AI thinking about: {user_message}. Based on my analysis, you should consider..."
|
||||
|
||||
return JsonResponse({'response': ai_response})
|
||||
return JsonResponse({'error': 'Invalid request'}, status=400)
|
||||
52
core/migrations/0001_initial.py
Normal file
52
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,52 @@
|
||||
# Generated by Django 5.2.7 on 2026-03-12 07:49
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Project',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=200)),
|
||||
('industry', models.CharField(max_length=100)),
|
||||
('goal', models.TextField()),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='MindMapNode',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=200)),
|
||||
('summary', models.TextField()),
|
||||
('category', models.CharField(max_length=100)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='nodes', to='core.project')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='MindMapConnection',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('how', models.TextField(help_text='How they connect')),
|
||||
('why', models.TextField(help_text='Why they connect')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outgoing_connections', to='core.mindmapnode')),
|
||||
('target', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incoming_connections', to='core.mindmapnode')),
|
||||
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='connections', to='core.project')),
|
||||
],
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -1,3 +1,34 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
|
||||
# Create your models here.
|
||||
class Project(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
title = models.CharField(max_length=200)
|
||||
industry = models.CharField(max_length=100)
|
||||
goal = models.TextField()
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
class MindMapNode(models.Model):
|
||||
project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name='nodes')
|
||||
title = models.CharField(max_length=200)
|
||||
summary = models.TextField()
|
||||
category = models.CharField(max_length=100)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
class MindMapConnection(models.Model):
|
||||
project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name='connections')
|
||||
source = models.ForeignKey(MindMapNode, on_delete=models.CASCADE, related_name='outgoing_connections')
|
||||
target = models.ForeignKey(MindMapNode, on_delete=models.CASCADE, related_name='incoming_connections')
|
||||
how = models.TextField(help_text="How they connect")
|
||||
why = models.TextField(help_text="Why they connect")
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.source.title} -> {self.target.title}"
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
||||
{% if project_description %}
|
||||
<meta name="description" content="{{ project_description }}">
|
||||
@ -13,6 +14,10 @@
|
||||
<meta property="og:image" content="{{ project_image_url }}">
|
||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||
{% endif %}
|
||||
|
||||
<!-- Bootstrap 5 CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||
{% block head %}{% endblock %}
|
||||
@ -22,4 +27,4 @@
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
22
core/templates/core/create_project.html
Normal file
22
core/templates/core/create_project.html
Normal file
@ -0,0 +1,22 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h1>Create New Project</h1>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label for="title" class="form-label">Title</label>
|
||||
<input type="text" class="form-control" id="title" name="title" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="industry" class="form-label">Industry</label>
|
||||
<input type="text" class="form-control" id="industry" name="industry" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="goal" class="form-label">Goal</label>
|
||||
<textarea class="form-control" id="goal" name="goal" rows="3" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -1,145 +1,235 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ project_name }}{% endblock %}
|
||||
{% block title %}AI Business Planning & Mind Map{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Sora:wght@600;700;800&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
--primary: #0F766E;
|
||||
--primary-light: #38BDF8;
|
||||
--secondary: #0B132B;
|
||||
--accent: #F59E0B;
|
||||
--bg-color: #F8FAFC;
|
||||
--text-color: #334155;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body::before {
|
||||
.hero {
|
||||
position: relative;
|
||||
padding: 8rem 2rem 6rem;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
|
||||
color: white;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hero::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
bottom: -50px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100px;
|
||||
background: var(--bg-color);
|
||||
transform: skewY(-2deg);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes bg-pan {
|
||||
0% {
|
||||
background-position: 0% 0%;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-position: 100% 100%;
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2.5rem 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
|
||||
.hero-content {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
|
||||
font-weight: 700;
|
||||
margin: 0 0 1.2rem;
|
||||
letter-spacing: -0.02em;
|
||||
font-family: 'Sora', sans-serif;
|
||||
font-size: clamp(2.5rem, 5vw, 4.5rem);
|
||||
font-weight: 800;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 1.5rem;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
.hero p {
|
||||
font-size: 1.25rem;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 2.5rem;
|
||||
opacity: 0.9;
|
||||
max-width: 600px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 1rem 2rem;
|
||||
font-weight: 600;
|
||||
font-size: 1.1rem;
|
||||
opacity: 0.92;
|
||||
text-decoration: none;
|
||||
border-radius: 50px;
|
||||
transition: all 0.3s ease;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.loader {
|
||||
margin: 1.5rem auto;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border: 4px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
.btn-primary {
|
||||
background-color: var(--accent);
|
||||
color: white;
|
||||
box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 2px solid white;
|
||||
color: white;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
.btn-outline:hover {
|
||||
background: white;
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.features {
|
||||
padding: 6rem 2rem;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 3rem;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
background: white;
|
||||
padding: 2.5rem;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.feature-card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: rgba(15, 118, 110, 0.1);
|
||||
color: var(--primary);
|
||||
border-radius: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.feature-card h3 {
|
||||
font-family: 'Sora', sans-serif;
|
||||
color: var(--secondary);
|
||||
font-size: 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.feature-card p {
|
||||
color: var(--text-color);
|
||||
line-height: 1.6;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* 3D decorative shapes */
|
||||
.shape {
|
||||
position: absolute;
|
||||
background: rgba(255,255,255,0.1);
|
||||
backdrop-filter: blur(5px);
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
z-index: 1;
|
||||
animation: float 6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.shape-1 {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
top: 10%;
|
||||
left: 10%;
|
||||
animation-delay: 0s;
|
||||
}
|
||||
|
||||
.shape-2 {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
bottom: 20%;
|
||||
right: 15%;
|
||||
border-radius: 20px;
|
||||
transform: rotate(45deg);
|
||||
animation-delay: 2s;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.runtime code {
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
padding: 0.15rem 0.45rem;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
border: 0;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.75;
|
||||
@keyframes float {
|
||||
0% { transform: translateY(0px) rotate(0deg); }
|
||||
50% { transform: translateY(-20px) rotate(10deg); }
|
||||
100% { transform: translateY(0px) rotate(0deg); }
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your app…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
<section class="hero">
|
||||
<div class="shape shape-1"></div>
|
||||
<div class="shape shape-2"></div>
|
||||
|
||||
<div class="hero-content">
|
||||
<h1>Build Businesses from Scratch with AI</h1>
|
||||
<p>Your intelligent workspace for planning, validating, and pitching business ideas. Create dynamic mind maps that research, reason, and write for you.</p>
|
||||
|
||||
<div class="cta-group">
|
||||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'project_list' %}" class="btn btn-primary">Go to My Projects</a>
|
||||
{% else %}
|
||||
<a href="{% url 'project_list' %}" class="btn btn-primary">Start a Project</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
|
||||
<p class="runtime">
|
||||
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
|
||||
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="features">
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">🧠</div>
|
||||
<h3>Living Mind Maps</h3>
|
||||
<p>Connect your ideas with AI-powered 'how' and 'why' reasoning. Watch your initial concepts grow into comprehensive business models.</p>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">📚</div>
|
||||
<h3>Expert Research Layer</h3>
|
||||
<p>Upload articles, URLs, and notes. The AI learns from your specific sources to become an expert in your precise field and niche.</p>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">💼</div>
|
||||
<h3>Investor-Ready Docs</h3>
|
||||
<p>Automatically generate polished business plans, VC pitch decks, and vendor-finance proposals directly from your expanded mind map.</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
||||
</footer>
|
||||
{% endblock %}
|
||||
49
core/templates/core/project_detail.html
Normal file
49
core/templates/core/project_detail.html
Normal file
@ -0,0 +1,49 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h1>{{ project.title }}</h1>
|
||||
<p>Industry: {{ project.industry }}</p>
|
||||
<p>Goal: {{ project.goal }}</p>
|
||||
|
||||
<h3>Mind Map Nodes</h3>
|
||||
<ul>
|
||||
{% for node in nodes %}
|
||||
<li>{{ node.title }} - {{ node.category }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h3>Connections</h3>
|
||||
<ul>
|
||||
{% for conn in connections %}
|
||||
<li>{{ conn.source.title }} -> {{ conn.target.title }} (Why: {{ conn.why }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h3>Chat with AI</h3>
|
||||
<div id="chat-container" class="mb-3">
|
||||
<textarea id="ai-input" class="form-control" rows="2" placeholder="Ask AI..."></textarea>
|
||||
<button id="ai-submit" class="btn btn-primary mt-2">Send</button>
|
||||
</div>
|
||||
<div id="ai-response" class="card mt-2">
|
||||
<div class="card-body">Waiting for input...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('ai-submit').addEventListener('click', function() {
|
||||
const message = document.getElementById('ai-input').value;
|
||||
fetch("{% url 'ai_chat' project.pk %}", {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': '{{ csrf_token }}'
|
||||
},
|
||||
body: JSON.stringify({ message: message })
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('ai-response').querySelector('.card-body').innerText = data.response;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
20
core/templates/core/project_list.html
Normal file
20
core/templates/core/project_list.html
Normal file
@ -0,0 +1,20 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h1>My Projects</h1>
|
||||
<a href="{% url 'create_project' %}" class="btn btn-primary mb-3">New Project</a>
|
||||
<div class="row">
|
||||
{% for project in projects %}
|
||||
<div class="col-md-4">
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ project.title }}</h5>
|
||||
<p class="card-text">{{ project.industry }}</p>
|
||||
<a href="{% url 'project_detail' project.pk %}" class="btn btn-secondary">Open</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
23
core/templates/registration/login.html
Normal file
23
core/templates/registration/login.html
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container py-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body p-4 p-md-5">
|
||||
<h2 class="mb-4 text-center">Log In</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary w-100 py-2 mt-3">Log In</button>
|
||||
</form>
|
||||
<div class="mt-4 text-center">
|
||||
<p>Don't have an account? <a href="{% url 'signup' %}">Sign up here</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
23
core/templates/registration/signup.html
Normal file
23
core/templates/registration/signup.html
Normal file
@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container py-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body p-4 p-md-5">
|
||||
<h2 class="mb-4 text-center">Sign Up</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit" class="btn btn-primary w-100 py-2 mt-3">Create Account</button>
|
||||
</form>
|
||||
<div class="mt-4 text-center">
|
||||
<p>Already have an account? <a href="{% url 'login' %}">Log in here</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
11
core/urls.py
11
core/urls.py
@ -1,7 +1,12 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from .views import home, project_list, project_detail, create_project, signup
|
||||
from .ai_views import ai_chat
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
]
|
||||
path("projects/", project_list, name="project_list"),
|
||||
path("projects/new/", create_project, name="create_project"),
|
||||
path("projects/<int:pk>/", project_detail, name="project_detail"),
|
||||
path("projects/<int:pk>/ai/", ai_chat, name="ai_chat"),
|
||||
path("signup/", signup, name="signup"),
|
||||
]
|
||||
@ -1,25 +1,45 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
from django import get_version as django_version
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.forms import UserCreationForm
|
||||
from django.contrib.auth import login
|
||||
from .models import Project, MindMapNode, MindMapConnection
|
||||
|
||||
def signup(request):
|
||||
if request.method == 'POST':
|
||||
form = UserCreationForm(request.POST)
|
||||
if form.is_valid():
|
||||
user = form.save()
|
||||
login(request, user)
|
||||
return redirect('project_list')
|
||||
else:
|
||||
form = UserCreationForm()
|
||||
return render(request, 'registration/signup.html', {'form': form})
|
||||
|
||||
def home(request):
|
||||
"""Render the landing screen with loader and environment details."""
|
||||
host_name = request.get_host().lower()
|
||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
||||
now = timezone.now()
|
||||
return render(request, 'core/index.html')
|
||||
|
||||
context = {
|
||||
"project_name": "New Style",
|
||||
"agent_brand": agent_brand,
|
||||
"django_version": django_version(),
|
||||
"python_version": platform.python_version(),
|
||||
"current_time": now,
|
||||
"host_name": host_name,
|
||||
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
@login_required
|
||||
def project_list(request):
|
||||
projects = Project.objects.filter(user=request.user)
|
||||
return render(request, 'core/project_list.html', {'projects': projects})
|
||||
|
||||
@login_required
|
||||
def project_detail(request, pk):
|
||||
project = get_object_or_404(Project, pk=pk, user=request.user)
|
||||
nodes = project.nodes.all()
|
||||
connections = project.connections.all()
|
||||
return render(request, 'core/project_detail.html', {
|
||||
'project': project,
|
||||
'nodes': nodes,
|
||||
'connections': connections
|
||||
})
|
||||
|
||||
@login_required
|
||||
def create_project(request):
|
||||
if request.method == 'POST':
|
||||
title = request.POST.get('title')
|
||||
industry = request.POST.get('industry')
|
||||
goal = request.POST.get('goal')
|
||||
project = Project.objects.create(user=request.user, title=title, industry=industry, goal=goal)
|
||||
return redirect('project_detail', pk=project.pk)
|
||||
return render(request, 'core/create_project.html')
|
||||
Loading…
x
Reference in New Issue
Block a user