diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index a5ed392..8640881 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index e061640..c139c5a 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 5a69659..c55b7ad 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 2a36fd6..03a6b38 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..16fbc63 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,8 @@ from django.contrib import admin +from .models import InventoryItem -# Register your models here. +@admin.register(InventoryItem) +class InventoryItemAdmin(admin.ModelAdmin): + list_display = ('name', 'store_name', 'cost', 'store_location', 'lead_time') + search_fields = ('name', 'store_name', 'features', 'description') + list_filter = ('store_name', 'store_location') \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..4d4f079 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 5.2.7 on 2026-02-12 13:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='InventoryItem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('description', models.TextField(blank=True)), + ('cost', models.DecimalField(decimal_places=2, max_digits=10)), + ('installments_options', models.CharField(help_text='e.g., 12 months interest free', max_length=255)), + ('features', models.TextField(help_text='Comma separated features')), + ('store_location', models.CharField(max_length=255)), + ('store_name', models.CharField(max_length=255)), + ('lead_time', models.CharField(help_text='e.g., 3-5 days', max_length=100)), + ('image_url', models.URLField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..b11edc2 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..92696ae 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,18 @@ from django.db import models -# Create your models here. +class InventoryItem(models.Model): + name = models.CharField(max_length=255) + description = models.TextField(blank=True) + cost = models.DecimalField(max_digits=10, decimal_places=2) + installments_options = models.CharField(max_length=255, help_text="e.g., 12 months interest free") + features = models.TextField(help_text="Comma separated features") + store_location = models.CharField(max_length=255) + store_name = models.CharField(max_length=255) + lead_time = models.CharField(max_length=100, help_text="e.g., 3-5 days") + image_url = models.URLField(blank=True, null=True) + + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return f"{self.name} - {self.store_name}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..01dfd50 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,92 @@ - +{% load static %} - {% block title %}Knowledge Base{% endblock %} + + {% block title %}AI Inventory Assistant{% endblock %} {% if project_description %} - - {% endif %} - {% if project_image_url %} - - - {% endif %} - {% load static %} + + + + + + + + + + + {% block head %}{% endblock %} - {% block content %}{% endblock %} + + +
+ {% block content %}{% endblock %} +
+ + + + + {% block scripts %}{% endblock %} - + \ No newline at end of file diff --git a/core/templates/core/index.html b/core/templates/core/index.html index faec813..06cc0c7 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,145 +1,152 @@ {% extends "base.html" %} +{% load static %} -{% block title %}{{ project_name }}{% endblock %} +{% block content %} +
+
+
+

Find your perfect Inventory match.

+

Ask our AI assistant about costs, installment plans, features, and locations to find exactly what you need in seconds.

+ +
+
+
+
+
📦
+

Smart Filtering

+

No more endless scrolling. Just talk to the agent.

+
+
+
+
+ +
+
+
+
+
+
+ 🤖 +
+
+
Inventory Concierge
+ AI Assistant • Online +
+
+
+ +
+
+
+ Hello! I can help you find items from our inventory. What are you looking for today? +
Try: "Show me items under $500 with installment options" +
+
+
+ +
+
+ {% csrf_token %} + + +
+
+
+
+
+
-{% block head %} - - - {% endblock %} -{% block content %} -
-
-

Analyzing your requirements and generating your app…

-
- Loading… -
-

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" }} -

-
-
- -{% endblock %} \ No newline at end of file +{% block scripts %} + +{% endblock %} diff --git a/core/urls.py b/core/urls.py index 6299e3d..7e9ee5d 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,7 +1,7 @@ from django.urls import path - -from .views import home +from . import views urlpatterns = [ - path("", home, name="home"), -] + path('', views.home, name='index'), + path('api/chat/', views.chat_api, name='chat_api'), +] \ No newline at end of file diff --git a/core/views.py b/core/views.py index c9aed12..7d4e2e2 100644 --- a/core/views.py +++ b/core/views.py @@ -1,25 +1,59 @@ import os import platform - -from django import get_version as django_version +import json +from django.http import JsonResponse from django.shortcuts import render from django.utils import timezone - +from django.db.models import Q +from .models import InventoryItem 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() - + """Render the landing screen with the conversational AI shell.""" + featured_items = InventoryItem.objects.all()[:3] + 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", ""), + "project_name": "AI Inventory Assistant", + "featured_items": featured_items, } return render(request, "core/index.html", context) + +def chat_api(request): + """Simple keyword-based search to simulate AI conversational agent.""" + if request.method == "POST": + try: + data = json.loads(request.body) + query = data.get("message", "").lower() + + if not query: + return JsonResponse({"reply": "I'm listening! What are you looking for?"}) + + # Simulate "AI" logic by filtering models + # In a real scenario, this would call an LLM with the context of the inventory + results = InventoryItem.objects.filter( + Q(name__icontains=query) | + Q(description__icontains=query) | + Q(features__icontains=query) | + Q(store_name__icontains=query) | + Q(store_location__icontains=query) + ).distinct() + + if results.exists(): + count = results.count() + reply = f"I found {count} options that match your request. Here are the best ones:" + items = [] + for item in results[:5]: + items.append({ + "name": item.name, + "cost": str(item.cost), + "store": item.store_name, + "location": item.store_location, + "installments": item.installments_options, + "lead_time": item.lead_time + }) + return JsonResponse({"reply": reply, "items": items}) + else: + return JsonResponse({"reply": "I couldn't find any items matching those exact details. Try asking about cost, location, or specific features!"}) + except Exception as e: + return JsonResponse({"error": str(e)}, status=400) + + return JsonResponse({"error": "Invalid request"}, status=405) \ No newline at end of file