From 604db7d8ee7682634e21e3d47f7ea65fc7715835 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sat, 6 Dec 2025 06:38:51 +0000 Subject: [PATCH] AI Chatbot --- core/__pycache__/admin.cpython-311.pyc | Bin 212 -> 365 bytes core/__pycache__/models.cpython-311.pyc | Bin 209 -> 1052 bytes core/__pycache__/urls.cpython-311.pyc | Bin 347 -> 348 bytes core/__pycache__/views.cpython-311.pyc | Bin 1364 -> 1194 bytes core/admin.py | 3 +- core/migrations/0001_initial.py | 23 +++ .../__pycache__/0001_initial.cpython-311.pyc | Bin 0 -> 1159 bytes core/models.py | 12 +- core/templates/base.html | 5 +- core/templates/core/index.html | 176 ++++-------------- core/urls.py | 4 +- core/views.py | 35 ++-- static/css/custom.css | 75 +++++++- staticfiles/css/custom.css | 82 ++++++-- 14 files changed, 229 insertions(+), 186 deletions(-) create mode 100644 core/migrations/0001_initial.py create mode 100644 core/migrations/__pycache__/0001_initial.cpython-311.pyc diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855b12f4883b1ba9de01c54245c53aacd714..282e691823c1916051aa1610ee4b3ce112f4d033 100644 GIT binary patch delta 271 zcmcb@_?D@DIWI340}#C0W1N`;q#uJgFu)9Dd=3IKrZc24q%h_%KjJH@5Q*tx&UV;<= zdECw!i6y?N#l?x~seYPl6a7VHZ?Wa(r=;c-7lF*b#ZsJEl6s4yC^bE^xFoe`Vu~Xd vFHjt$z1Vf)dMV=@4DuIH(E|q77Ov|I!j~9?CwO0EP`JXNZ~=yjxPcl0@%K5v delta 162 zcmaFMbcL~gIWI340}y=Q^((_3NIwQ~V1NnA_$&luOlL@8NMX!j$YqRTWMoKT3TDt` zehE^b$#{!3F(o%M&rg%-7GFwMVqSW_UUGh3Nl|7}5i?N1N`}uMb-#4=GxBp&^-GgV n^GZtfQ!7%FODBF%V1>|_N-Deeml3P4oE1{47Rsih`b diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b9d5171b2bb0d207f045e07f9fbbb95a64..a2a14ad42107cb83523c0bfa3fb3d05aa44e1238 100644 GIT binary patch literal 1052 zcmZuw&2JJx6rb5$V4;9yYZ?#QU_wkt4IDgRjP1eF)*gz9tseH^WXnwXaF@lMC9O>l znDpSW2a_He6Hiz}5B&rDBfyYI_GI+b8wO83`Gy5zQy)9Oc^@EuBA)+$FRcUgeB_q^^<%=#;WfP?X7s5*>5*dr#ZmE5uyDwgd^k?}3)G-@_3CajGa+P z$x{GL)Ys;|Yw2%Vx~nbpw1v)%MR-o#vjbo2sEb3I=t3i*}iWclf{_2rdKM~uu10|jTb!c6J~{cgSR7Ta@2E+-+5#PWvAwkj6$ zkA+=OxocQ;XBNU=kaH6@M-w2vsu76Xyav#m{(h*p`s&;uAkPJxg@KCV^Y35wVs}op z^H-f%z8lN;V)^E3AKW{=_?8TGKwSFRX6znBZ=c!I2*G=SliClAipy0sL09^;4 zieOPlD_)pZjatdh&~3lhz=rs*_$22A(<$*w^|3#+CFd>##B1dn00S9g+()-NSD%3r V!BGD?9NqhH|F`h}`A=|E?k_>l0UrPW literal 209 zcmZ3^%ge<81S>LrWmp2~#~=<2FhLogg@BCd3@HpLj5!Rsj8Tk?3@J>(44TX@K?*b( zZ?Wa(r=;c-`)M-W;!Md(%uCPLOGzqX21>4E_zY6>OHV%|KQ~psG^sSNq*On(A~m_R zB)>?%JijQrxF9h(RX;huC{-U~j9x+IFAf_ZyEG@&u80Guoe_wOWr4&8W=2NF8w@fR Ku%RM0pb7xTsWln^ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1f807fae1897c89361c99c5e868a26d00799b73f..f8b00c5751c6fede7f8f02c5e83dcaed0b1f61d1 100644 GIT binary patch delta 86 zcmcc3bccy|IWI340}$x!HO|bP$Xme1nwgi9S~0O{v6;jL1{Cyxje(W3!KFi}BXoxN a1s27NEQ(iH6hAOC@iR4WgJ2O4&>#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{V{1({O;rcLp zbn8~8;bZ#N-K>I)lP}D)(%ElxJ~WQ==G@E2X>;yB?fofk**s*t8SgdYv>Eeyvfntt zTW7bgq^-03^5VN^{L%yNQr_zCwfbqR&+FcP;}70Gx4o3M&+WD6)Al^C_x2lY-np>d zPdgXhX}q(z*I7(Ei@d&+8Kq;hS*c=}Ul6dbl4YuSRNuNI7yGkF;vUSDLDrqni{{B{ zUi!S+lQd7uusrq*NZ%?~Cyl(u=0KHW9X|k;sTku-N4U$;nP0z5Z(uz`zp|HRT0iwg LI==qKo4@-V7*ITs literal 0 HcmV?d00001 diff --git a/core/models.py b/core/models.py index 71a8362..11d75cf 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,13 @@ from django.db import models -# Create your models here. +class ChatMessage(models.Model): + SENDER_CHOICES = [ + ('user', 'User'), + ('bot', 'Bot'), + ] + sender = models.CharField(max_length=10, choices=SENDER_CHOICES) + message = models.TextField() + timestamp = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f'{self.get_sender_display()}: {self.message}' \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..5962a87 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -14,7 +14,10 @@ {% endif %} {% load static %} - + + + + {% block head %}{% endblock %} diff --git a/core/templates/core/index.html b/core/templates/core/index.html index faec813..da82f46 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,145 +1,41 @@ -{% extends "base.html" %} +{% extends 'base.html' %} +{% load static %} -{% block title %}{{ project_name }}{% endblock %} - -{% block head %} - - - - +{% block title %} +AI Chatbot {% endblock %} {% block content %} -
-
-

Analyzing your requirements and generating your app…

-
- Loading… +
+
+

AI Powered Customer Support

+

Our AI chatbot is here to help you 24/7 with your questions and complaints.

+ Start a Conversation
-

AppWizzy AI is collecting your requirements and applying the first changes.

-

This page will refresh automatically as the plan is implemented.

-

- Runtime: Django {{ django_version }} · Python {{ python_version }} - — UTC {{ current_time|date:"Y-m-d H:i:s" }} -

-
-
-
- Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC) -
-{% endblock %} \ No newline at end of file + + +
+
+ {% for msg in messages %} +
+
+ {{ msg.message }} +
+
+ {% endfor %} +
+
+
+ {% csrf_token %} +
+ + +
+
+
+
+{% endblock %} + +{% block extra_css %} + +{% endblock %} diff --git a/core/urls.py b/core/urls.py index 6299e3d..8e0d0ae 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,7 +1,7 @@ from django.urls import path -from .views import home +from .views import index urlpatterns = [ - path("", home, name="home"), + path("", index, name="index"), ] diff --git a/core/views.py b/core/views.py index c9aed12..e037eba 100644 --- a/core/views.py +++ b/core/views.py @@ -1,25 +1,14 @@ -import os -import platform +from django.shortcuts import render, redirect +from .models import ChatMessage -from django import get_version as django_version -from django.shortcuts import render -from django.utils import timezone +def index(request): + if request.method == 'POST': + message = request.POST.get('message') + if message: + ChatMessage.objects.create(sender='user', message=message) + # Canned response from the bot + ChatMessage.objects.create(sender='bot', message='Thank you for your message. An agent will be with you shortly.') + return redirect('index') - -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": "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) + messages = ChatMessage.objects.all().order_by('timestamp') + return render(request, 'core/index.html', {'messages': messages}) \ No newline at end of file diff --git a/static/css/custom.css b/static/css/custom.css index 925f6ed..1bd6a51 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,4 +1,73 @@ -/* Custom styles for the application */ -body { - font-family: system-ui, -apple-system, sans-serif; +:root { + --primary-color: #4F46E5; + --secondary-color: #10B981; + --accent-color: #F59E0B; + --neutral-background: #F3F4F6; + --text-color: #111827; } + +body { + font-family: 'Inter', sans-serif; + background-color: var(--neutral-background); + color: var(--text-color); +} + +h1, h2, h3, h4, h5, h6 { + font-family: 'Poppins', sans-serif; +} + +.hero { + background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); + color: white; + padding: 100px 0; + text-align: center; +} + +.chat-widget { + max-width: 800px; + margin: 50px auto; + border: 1px solid #ddd; + border-radius: 10px; + overflow: hidden; + background-color: white; +} + +.chat-history { + height: 400px; + overflow-y: auto; + padding: 20px; +} + +.chat-message { + margin-bottom: 20px; +} + +.user-message { + text-align: right; +} + +.bot-message { + text-align: left; +} + +.message-bubble { + display: inline-block; + padding: 10px 15px; + border-radius: 20px; + max-width: 70%; +} + +.user-message .message-bubble { + background-color: var(--primary-color); + color: white; +} + +.bot-message .message-bubble { + background-color: #E5E7EB; + color: var(--text-color); +} + +.chat-input { + border-top: 1px solid #ddd; + padding: 20px; +} \ No newline at end of file diff --git a/staticfiles/css/custom.css b/staticfiles/css/custom.css index 108056f..1bd6a51 100644 --- a/staticfiles/css/custom.css +++ b/staticfiles/css/custom.css @@ -1,21 +1,73 @@ - :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); + --primary-color: #4F46E5; + --secondary-color: #10B981; + --accent-color: #F59E0B; + --neutral-background: #F3F4F6; + --text-color: #111827; } + body { - margin: 0; font-family: 'Inter', sans-serif; - background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); + background-color: var(--neutral-background); color: var(--text-color); - display: flex; - justify-content: center; - align-items: center; - min-height: 100vh; - text-align: center; - overflow: hidden; - position: relative; } + +h1, h2, h3, h4, h5, h6 { + font-family: 'Poppins', sans-serif; +} + +.hero { + background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); + color: white; + padding: 100px 0; + text-align: center; +} + +.chat-widget { + max-width: 800px; + margin: 50px auto; + border: 1px solid #ddd; + border-radius: 10px; + overflow: hidden; + background-color: white; +} + +.chat-history { + height: 400px; + overflow-y: auto; + padding: 20px; +} + +.chat-message { + margin-bottom: 20px; +} + +.user-message { + text-align: right; +} + +.bot-message { + text-align: left; +} + +.message-bubble { + display: inline-block; + padding: 10px 15px; + border-radius: 20px; + max-width: 70%; +} + +.user-message .message-bubble { + background-color: var(--primary-color); + color: white; +} + +.bot-message .message-bubble { + background-color: #E5E7EB; + color: var(--text-color); +} + +.chat-input { + border-top: 1px solid #ddd; + padding: 20px; +} \ No newline at end of file