Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
9974cb6fbe Version 1.0 2025-12-19 16:46:59 +00:00
9 changed files with 197 additions and 159 deletions

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,8 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{% block title %}Knowledge Base{% endblock %}</title> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Baymax Healthcare Companion{% endblock %}</title>
{% if project_description %} {% if project_description %}
<meta name="description" content="{{ project_description }}"> <meta name="description" content="{{ project_description }}">
<meta property="og:description" content="{{ project_description }}"> <meta property="og:description" content="{{ project_description }}">
@ -13,13 +14,17 @@
<meta property="og:image" content="{{ project_image_url }}"> <meta property="og:image" content="{{ project_image_url }}">
<meta property="twitter:image" content="{{ project_image_url }}"> <meta property="twitter:image" content="{{ project_image_url }}">
{% endif %} {% endif %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
{% load static %} {% load static %}
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}"> <link rel="stylesheet" href="{% static 'css/custom.css' %}?v=1">
{% 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.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body> </body>
</html> </html>

View File

@ -1,145 +1,51 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %}
{% block title %}{{ project_name }}{% 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 %}
<main> <main>
<div class="card"> <section class="hero">
<h1>Analyzing your requirements and generating your app…</h1> <div class="container">
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <h1>Hello. I am Baymax.
<span class="sr-only">Loading…</span> </h1>
<p class="lead">Your personal healthcare companion. Describe your symptoms below, and I will do my best to help.</p>
</div>
</section>
<div class="container mt-4">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="checker-card">
<form method="POST" action="{% url 'index' %}">
{% csrf_token %}
<div class="mb-3">
<label for="symptoms" class="form-label h4">How are you feeling?</label>
<textarea class="form-control" id="symptoms" name="symptoms" rows="5"
placeholder="For example: 'I have a headache, a slight fever, and a runny nose.'">{{ symptoms|default:'' }}</textarea>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-lg">I am satisfied with my care.</button>
</div>
</form>
</div>
{% if ai_result %}
<div class="result-card mt-4">
<h3>Baymax's Analysis:</h3>
{{ ai_result|linebreaks }}
<p class="disclaimer mt-3">
<strong>Disclaimer:</strong> This is not a substitute for professional medical advice. Always consult a doctor
for any health concerns.
</p>
</div>
{% endif %}
</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>
<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> </div>
</main> </main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC) <footer class="container mt-5">
<p>&copy; 2025 Baymax Healthcare Companion. All Rights Reserved.</p>
</footer> </footer>
{% endblock %} {% endblock %}

View File

@ -1,7 +1,7 @@
from django.urls import path from django.urls import path
from .views import home from .views import index
urlpatterns = [ urlpatterns = [
path("", home, name="home"), path("", index, name="index"),
] ]

View File

@ -1,25 +1,61 @@
import os import os
import platform
from django import get_version as django_version
from django.shortcuts import render from django.shortcuts import render
from django.utils import timezone from ai.local_ai_api import LocalAIApi
import logging
logger = logging.getLogger(__name__)
def home(request): def index(request):
"""Render the landing screen with loader and environment details.""" """
host_name = request.get_host().lower() Render the Baymax Healthcare Companion landing page and handle the symptom checker form.
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic" """
now = timezone.now()
context = { context = {
"project_name": "New Style", "project_name": "Baymax Healthcare Companion",
"agent_brand": agent_brand, "project_description": "An AI-assisted non-invasive health assistant for symptom triage.",
"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", ""),
} }
ai_result = None
if request.method == "POST":
symptoms = request.POST.get("symptoms", "").strip()
context["symptoms"] = symptoms
if symptoms:
try:
# Construct the prompt for the AI
prompt = (
"A user has the following symptoms: '{symptoms}'. "
"Analyze these symptoms and provide a general, non-prescriptive triage suggestion. "
"Structure the response in markdown. Start with a friendly greeting. "
"Then, provide a section with a summary of possible causes. "
"Finally, provide a section with recommendations on what to do next (e.g., rest, see a doctor). "
"Begin the entire response with a clear, bolded disclaimer: "
"**Disclaimer: This is not a substitute for professional medical advice. Always consult a doctor for any health concerns.**"
).format(symptoms=symptoms)
# Call the AI API
response = LocalAIApi.create_response(
{
"input": [
{"role": "system", "content": "You are a friendly and helpful healthcare assistant."},
{"role": "user", "content": prompt},
],
},
{
"poll_interval": 5,
"poll_timeout": 300,
},
)
if response.get("success"):
text = LocalAIApi.extract_text(response)
ai_result = text if text else "I am sorry, but I couldn't process your request. Please try again."
else:
logger.error("AI API Error: %s", response.get("error"))
ai_result = "There was an error communicating with the AI. Please try again later."
except Exception as e:
logger.error("An exception occurred during AI processing: %s", e)
ai_result = "A system error occurred. Please try again later."
context["ai_result"] = ai_result
return render(request, "core/index.html", context) return render(request, "core/index.html", context)

View File

@ -1,4 +1,95 @@
/* Custom styles for the application */ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Lato:wght@400;700&display=swap');
body {
font-family: system-ui, -apple-system, sans-serif; :root {
--primary-color: #E74C3C;
--accent-color: #3498DB;
--text-color: #2F4F4F;
--bg-light: #F8F9FA;
--bg-white: #FFFFFF;
--border-radius: 12px;
--shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
body {
font-family: 'Lato', sans-serif;
color: var(--text-color);
background-color: var(--bg-light);
line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Poppins', sans-serif;
font-weight: 600;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
padding: 10px 25px;
border-radius: var(--border-radius);
font-weight: 600;
}
.btn-primary:hover {
background-color: #c0392b;
border-color: #c0392b;
}
.hero {
background: linear-gradient(180deg, var(--bg-white) 0%, var(--bg-light) 100%);
padding: 4rem 0;
text-align: center;
}
.hero h1 {
font-size: 3.5rem;
font-weight: 700;
color: var(--primary-color);
}
.hero p {
font-size: 1.25rem;
max-width: 600px;
margin: 1rem auto;
}
.checker-card {
background-color: var(--bg-white);
border-radius: var(--border-radius);
box-shadow: var(--shadow);
padding: 2rem;
margin-top: 2rem;
}
.checker-card textarea {
border-radius: var(--border-radius);
}
.result-card {
background-color: var(--bg-white);
border-radius: var(--border-radius);
box-shadow: var(--shadow);
padding: 2rem;
margin-top: 2rem;
text-align: left;
border-left: 5px solid var(--accent-color);
}
.result-card h3 {
color: var(--accent-color);
margin-top: 0;
}
.disclaimer {
font-size: 0.9rem;
font-style: italic;
color: #6c757d;
margin-top: 1rem;
}
footer.container {
padding: 2rem 0;
text-align: center;
font-size: 0.9rem;
color: #6c757d;
} }