Compare commits
No commits in common. "ai-dev" and "master" have entirely different histories.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,17 +14,12 @@
|
|||||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<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;500;600;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
|
||||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -1,51 +1,145 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends "base.html" %}
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
{% block title %}ExamAid - AI-Powered Study Assistant{% endblock %}
|
{% block title %}{{ project_name }}{% 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">
|
||||||
|
<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;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||||
|
color: var(--text-color);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
body::before {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 0 0 1.2rem;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
opacity: 0.92;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loader {
|
||||||
|
margin: 1.5rem auto;
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border: 4px solid rgba(255, 255, 255, 0.25);
|
||||||
|
border-top-color: #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="bg-gradient-primary hero-section">
|
<main>
|
||||||
<div class="container text-center">
|
<div class="card">
|
||||||
<h1 class="display-4">Welcome to ExamAid</h1>
|
<h1>Analyzing your requirements and generating your app…</h1>
|
||||||
<p class="lead">Your AI-powered study assistant for competitive exams.</p>
|
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||||
|
<span class="sr-only">Loading…</span>
|
||||||
</div>
|
</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>
|
||||||
<div class="container my-5">
|
<p class="runtime">
|
||||||
<div class="row">
|
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
|
||||||
<div class="col-md-6">
|
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
|
||||||
<h2>Generate MCQs</h2>
|
</p>
|
||||||
<p>Enter a topic to generate multiple-choice questions with detailed explanations.</p>
|
</div>
|
||||||
<form method="post">
|
</main>
|
||||||
{% csrf_token %}
|
<footer>
|
||||||
<div class="mb-3">
|
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
||||||
<label for="topic" class="form-label">Topic</label>
|
</footer>
|
||||||
<input type="text" class="form-control" id="topic" name="topic" required>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">Generate MCQs</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<h2>Generated Questions</h2>
|
|
||||||
{% if mcqs %}
|
|
||||||
{% for mcq in mcqs %}
|
|
||||||
<div class="question-card">
|
|
||||||
<h5>{{ mcq.question }}</h5>
|
|
||||||
<ul class="options">
|
|
||||||
{% for option in mcq.options %}
|
|
||||||
<li>{{ option }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<div class="explanation">
|
|
||||||
<p><strong>Correct Answer:</strong> {{ mcq.correct_answer }}</p>
|
|
||||||
<p><strong>Explanation:</strong> {{ mcq.explanation }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
|
||||||
<p>No questions generated yet. Use the form to generate some!</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import index
|
from .views import home
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", index, name="index"),
|
path("", home, name="home"),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,39 +1,25 @@
|
|||||||
import json
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
|
from django import get_version as django_version
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from ai.local_ai_api import LocalAIApi
|
from django.utils import timezone
|
||||||
|
|
||||||
def index(request):
|
|
||||||
"""Render the landing page and handle MCQ generation."""
|
|
||||||
context = {}
|
|
||||||
if request.method == "POST":
|
|
||||||
topic = request.POST.get("topic")
|
|
||||||
if topic:
|
|
||||||
# This is a simplified example. In a real app, you would have
|
|
||||||
# more sophisticated error handling and prompt engineering.
|
|
||||||
response = LocalAIApi.create_response(
|
|
||||||
{
|
|
||||||
"input": [
|
|
||||||
{'role': 'system', 'content': 'You are an educational content generator. Produce a JSON array of 3 objects, where each object has the following structure: {"question": "...", "options": ["...", "...", "...", "..."], "correct_answer": "...", "explanation": "..."}. The topic is ' + topic + '. Return ONLY valid JSON.'}, {"role": "user", "content": "Generate 3 MCQs about " + topic},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if response.get("success"):
|
def home(request):
|
||||||
# The AI response might be a string that needs to be parsed as JSON.
|
"""Render the landing screen with loader and environment details."""
|
||||||
# It's important to handle potential JSON parsing errors.
|
host_name = request.get_host().lower()
|
||||||
try:
|
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
||||||
raw_text = LocalAIApi.extract_text(response)
|
now = timezone.now()
|
||||||
mcqs = json.loads(raw_text)
|
|
||||||
# Basic validation to ensure we have a list
|
|
||||||
if isinstance(mcqs, list):
|
|
||||||
context["mcqs"] = mcqs
|
|
||||||
else:
|
|
||||||
context["error"] = "AI returned data in an unexpected format."
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
context["error"] = "Failed to parse the response from the AI."
|
|
||||||
except Exception as e:
|
|
||||||
context["error"] = f"An unexpected error occurred: {e}"
|
|
||||||
else:
|
|
||||||
context["error"] = response.get("error", "An unknown error occurred with the AI service.")
|
|
||||||
|
|
||||||
|
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)
|
return render(request, "core/index.html", context)
|
||||||
|
|||||||
@ -1,77 +1,4 @@
|
|||||||
:root {
|
/* Custom styles for the application */
|
||||||
--bs-primary: #4F46E5;
|
|
||||||
--bs-secondary: #10B981;
|
|
||||||
--bs-accent: #F59E0B;
|
|
||||||
--bs-neutral-light: #F9FAFB;
|
|
||||||
--bs-neutral-dark: #111827;
|
|
||||||
--bs-font-sans-serif: "Inter", sans-serif;
|
|
||||||
--bs-font-monospace: "Poppins", sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: var(--bs-font-sans-serif);
|
font-family: system-ui, -apple-system, sans-serif;
|
||||||
background-color: var(--bs-neutral-light);
|
|
||||||
color: var(--bs-neutral-dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
font-family: var(--bs-font-monospace);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: var(--bs-primary);
|
|
||||||
border-color: var(--bs-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #4338ca;
|
|
||||||
border-color: #4338ca;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
background-color: var(--bs-secondary);
|
|
||||||
border-color: var(--bs-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary:hover {
|
|
||||||
background-color: #059669;
|
|
||||||
border-color: #059669;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-gradient-primary {
|
|
||||||
background: linear-gradient(90deg, var(--bs-primary), var(--bs-secondary));
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-section {
|
|
||||||
padding: 6rem 0;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card {
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
padding: 1.5rem;
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card h5 {
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card .options {
|
|
||||||
list-style-type: none;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card .options li {
|
|
||||||
padding: 0.5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card .explanation {
|
|
||||||
margin-top: 1rem;
|
|
||||||
padding-top: 1rem;
|
|
||||||
border-top: 1px solid #e5e7eb;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
}
|
||||||
@ -1,77 +1,21 @@
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
--bs-primary: #4F46E5;
|
--bg-color-start: #6a11cb;
|
||||||
--bs-secondary: #10B981;
|
--bg-color-end: #2575fc;
|
||||||
--bs-accent: #F59E0B;
|
--text-color: #ffffff;
|
||||||
--bs-neutral-light: #F9FAFB;
|
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||||
--bs-neutral-dark: #111827;
|
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||||
--bs-font-sans-serif: "Inter", sans-serif;
|
|
||||||
--bs-font-monospace: "Poppins", sans-serif;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: var(--bs-font-sans-serif);
|
margin: 0;
|
||||||
background-color: var(--bs-neutral-light);
|
font-family: 'Inter', sans-serif;
|
||||||
color: var(--bs-neutral-dark);
|
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||||
}
|
color: var(--text-color);
|
||||||
|
display: flex;
|
||||||
h1, h2, h3, h4, h5, h6 {
|
justify-content: center;
|
||||||
font-family: var(--bs-font-monospace);
|
align-items: center;
|
||||||
font-weight: 600;
|
min-height: 100vh;
|
||||||
}
|
text-align: center;
|
||||||
|
overflow: hidden;
|
||||||
.btn-primary {
|
position: relative;
|
||||||
background-color: var(--bs-primary);
|
|
||||||
border-color: var(--bs-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: #4338ca;
|
|
||||||
border-color: #4338ca;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
background-color: var(--bs-secondary);
|
|
||||||
border-color: var(--bs-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary:hover {
|
|
||||||
background-color: #059669;
|
|
||||||
border-color: #059669;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-gradient-primary {
|
|
||||||
background: linear-gradient(90deg, var(--bs-primary), var(--bs-secondary));
|
|
||||||
}
|
|
||||||
|
|
||||||
.hero-section {
|
|
||||||
padding: 6rem 0;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card {
|
|
||||||
border: 1px solid #e5e7eb;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
padding: 1.5rem;
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card h5 {
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card .options {
|
|
||||||
list-style-type: none;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card .options li {
|
|
||||||
padding: 0.5rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.question-card .explanation {
|
|
||||||
margin-top: 1rem;
|
|
||||||
padding-top: 1rem;
|
|
||||||
border-top: 1px solid #e5e7eb;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user