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.
@ -3,8 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Baymax Healthcare Companion{% endblock %}</title>
|
||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
||||
{% if project_description %}
|
||||
<meta name="description" content="{{ project_description }}">
|
||||
<meta property="og:description" content="{{ project_description }}">
|
||||
@ -14,17 +13,13 @@
|
||||
<meta property="og:image" content="{{ project_image_url }}">
|
||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||
{% 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 %}
|
||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v=1">
|
||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% 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>
|
||||
|
||||
</html>
|
||||
|
||||
@ -1,51 +1,145 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% 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 %}
|
||||
<main>
|
||||
<section class="hero">
|
||||
<div class="container">
|
||||
<h1>Hello. I am Baymax.
|
||||
</h1>
|
||||
<p class="lead">Your personal healthcare companion. Describe your symptoms below, and I will do my best to help.</p>
|
||||
<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>
|
||||
</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 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>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="container mt-5">
|
||||
<p>© 2025 Baymax Healthcare Companion. All Rights Reserved.</p>
|
||||
<footer>
|
||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
||||
</footer>
|
||||
{% endblock %}
|
||||
@ -1,7 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import index
|
||||
from .views import home
|
||||
|
||||
urlpatterns = [
|
||||
path("", index, name="index"),
|
||||
path("", home, name="home"),
|
||||
]
|
||||
|
||||
@ -1,61 +1,25 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
from django import get_version as django_version
|
||||
from django.shortcuts import render
|
||||
from ai.local_ai_api import LocalAIApi
|
||||
import logging
|
||||
from django.utils import timezone
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def index(request):
|
||||
"""
|
||||
Render the Baymax Healthcare Companion landing page and handle the symptom checker 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()
|
||||
|
||||
context = {
|
||||
"project_name": "Baymax Healthcare Companion",
|
||||
"project_description": "An AI-assisted non-invasive health assistant for symptom triage.",
|
||||
"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", ""),
|
||||
}
|
||||
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)
|
||||
|
||||
@ -1,95 +1,4 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Lato:wght@400;700&display=swap');
|
||||
|
||||
: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);
|
||||
}
|
||||
|
||||
/* Custom styles for the application */
|
||||
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;
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user