diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 5be02db..85f1e3c 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..a13c067 100644 --- a/config/settings.py +++ b/config/settings.py @@ -155,6 +155,8 @@ STATICFILES_DIRS = [ BASE_DIR / 'node_modules', ] +LOGIN_URL = '/login/' + # Email EMAIL_BACKEND = os.getenv( "EMAIL_BACKEND", diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..1edc092 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..0fd4b7b Binary files /dev/null and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..d31fe84 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 7e24764..958a5c6 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 96db8e1..c9efc91 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..8782b11 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,10 @@ from django.contrib import admin +from .models import Agent # Register your models here. + +@admin.register(Agent) +class AgentAdmin(admin.ModelAdmin): + list_display = ('name', 'user', 'published', 'created_at') + list_filter = ('published', 'user') + search_fields = ('name', 'description') \ No newline at end of file diff --git a/core/forms.py b/core/forms.py new file mode 100644 index 0000000..0fbbac6 --- /dev/null +++ b/core/forms.py @@ -0,0 +1,10 @@ +from django import forms +from django.contrib.auth.forms import UserCreationForm +from django.contrib.auth.models import User + +class SignUpForm(UserCreationForm): + email = forms.EmailField(max_length=254, help_text='Required. Inform a valid email address.') + + class Meta: + model = User + fields = ('username', 'email', 'password', 'password2') diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..24a30ce --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 5.2.7 on 2025-12-17 04:36 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Agent', + 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)), + ('published', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] 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..9677e96 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..b20d6a1 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,15 @@ from django.db import models +from django.contrib.auth.models import User # Create your models here. + +class Agent(models.Model): + user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True) # Allow null user for now + name = models.CharField(max_length=255) + description = models.TextField(blank=True) + published = models.BooleanField(default=False) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.name \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 76bc253..729fed3 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -3,7 +3,7 @@ - {% block title %}Knowledge Base{% endblock %} + {% block title %}AI Agent Studio{% endblock %} {% if project_description %} @@ -17,13 +17,38 @@ + {% block head %}{% endblock %} + + {% block content %}{% endblock %} + + {% block extra_js %}{% endblock %} - + \ No newline at end of file diff --git a/core/templates/core/article_detail.html b/core/templates/core/article_detail.html index 8820990..8e09191 100644 --- a/core/templates/core/article_detail.html +++ b/core/templates/core/article_detail.html @@ -1,14 +1,19 @@ {% extends 'base.html' %} -{% block title %}{{ article.title }}{% endblock %} +{% block title %}{{ agent.name }} - AI Agent{% endblock %} {% block content %}
-

{{ article.title }}

-

Published on {{ article.created_at|date:"F d, Y" }}

-
-
- {{ article.content|safe }} +
+
+
+

{{ agent.name }}

+
+
+

{{ agent.description }}

+ +
+
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/create_agent.html b/core/templates/core/create_agent.html index 7fee59a..69ff6f9 100644 --- a/core/templates/core/create_agent.html +++ b/core/templates/core/create_agent.html @@ -1,79 +1,21 @@ {% extends 'base.html' %} -{% load static %} - -{% block title %}Create New AI Agent{% endblock %} {% block content %} -
-
-
-
-
-
-

Hello! I'm here to help you create a new AI agent. What is the agent's purpose?

-
-
-
- {% csrf_token %} -
- - -
-
-
-
-
+
+

Create a New Agent

+

Define the name and description of your new AI agent.

+ +
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
{% endblock %} - -{% block extra_js %} - -{% endblock %} \ No newline at end of file diff --git a/core/templates/core/edit_agent.html b/core/templates/core/edit_agent.html new file mode 100644 index 0000000..283d8d9 --- /dev/null +++ b/core/templates/core/edit_agent.html @@ -0,0 +1,21 @@ +{% extends 'base.html' %} + +{% block content %} +
+

Edit Agent

+

Edit the details of your AI agent.

+ +
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
+
+{% endblock %} diff --git a/core/templates/core/index.html b/core/templates/core/index.html index c54a2ee..c38377a 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -18,37 +18,35 @@
-
+
+
-

Explore What You Can Build

-

These examples are just the beginning. Your imagination is the only limit.

+ +

Explore Published Agents

+ +

These are the agents that have been published by our users.

+
+ +
- -
-
-

Customer Support Bot

-

An intelligent bot that handles common customer queries, freeing up your team for complex issues.

+ {% for agent in agents %} + +
+
+

{{ agent.name }}

+

{{ agent.description }}

+
+
+
+ {% empty %} +
+

No agents have been published yet. Be the first!

- - -
-
-

Data Analyst Agent

-

Connect your data sources and let this agent find trends, generate reports, and provide insights.

-
- - -
-
-

Code Generation Assistant

-

Describe a function or component, and this agent will generate the boilerplate code for you in any language.

-
-
- -
- Create a New Agent + {% endfor %}
+ + {% endblock %} diff --git a/core/templates/core/login.html b/core/templates/core/login.html new file mode 100644 index 0000000..d7a4b58 --- /dev/null +++ b/core/templates/core/login.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} + +{% block content %} +

Login to Your Account

+
+ {% csrf_token %} + {{ form.as_p }} + +
+

Don't have an account? Sign up

+{% endblock %} diff --git a/core/templates/core/my_agents.html b/core/templates/core/my_agents.html new file mode 100644 index 0000000..c523a4c --- /dev/null +++ b/core/templates/core/my_agents.html @@ -0,0 +1,48 @@ +{% extends "base.html" %} + +{% block content %} +
+
+

My Agents

+ Create New Agent +
+

Here is a list of all the AI agents you have created.

+ + {% if agents %} +
+ {% for agent in agents %} +
+
+

{{ agent.name }}

+

{{ agent.description }}

+
+ Status: + {% if agent.published %} + Published + {% else %} + Draft + {% endif %} +
+ +
+
+ {% endfor %} +
+ {% else %} +
+

No Agents Yet

+

You haven't created any agents. Why not create your first one?

+ Create an Agent +
+ {% endif %} +
+{% endblock %} diff --git a/core/templates/core/signup.html b/core/templates/core/signup.html new file mode 100644 index 0000000..5605f41 --- /dev/null +++ b/core/templates/core/signup.html @@ -0,0 +1,10 @@ +{% extends 'base.html' %} + +{% block content %} +

Create a New Account

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/core/urls.py b/core/urls.py index c2c34b7..0fce2f1 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,8 +1,15 @@ from django.urls import path -from .views import home, create_agent +from .views import home, create_agent, my_agents, publish_agent, delete_agent, edit_agent, agent_detail, signup, CustomLoginView urlpatterns = [ path("", home, name="home"), + path("signup/", signup, name="signup"), + path("login/", CustomLoginView.as_view(), name="login"), path("create-agent/", create_agent, name="create_agent"), + path("my-agents/", my_agents, name="my_agents"), + path("agents//publish/", publish_agent, name="publish_agent"), + path("agents//delete/", delete_agent, name="delete_agent"), + path("agents//edit/", edit_agent, name="edit_agent"), + path("agent//", agent_detail, name="agent_detail"), ] diff --git a/core/views.py b/core/views.py index a2af674..f5bb7ac 100644 --- a/core/views.py +++ b/core/views.py @@ -2,15 +2,25 @@ import os import platform from django import get_version as django_version -from django.shortcuts import render +from django.contrib.auth.decorators import login_required +from django.shortcuts import render, redirect, get_object_or_404 +from django.views.decorators.http import require_POST from django.http import JsonResponse from django.utils import timezone +from .models import Agent +from .forms import SignUpForm +from django.contrib.auth import login +from django.contrib.auth import views as auth_views + +class CustomLoginView(auth_views.LoginView): + template_name = 'core/login.html' 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() + published_agents = Agent.objects.filter(published=True) context = { "project_name": "New Style", @@ -21,14 +31,59 @@ def home(request): "host_name": host_name, "project_description": os.getenv("PROJECT_DESCRIPTION", ""), "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), + "agents": published_agents, } return render(request, "core/index.html", context) +@login_required def create_agent(request): - # This is the agent creation view if request.method == 'POST': - message = request.POST.get('message', '') - # Simple echo response for now - response_message = f"This is a simulated response to: '{message}'" - return JsonResponse({'message': response_message}) + name = request.POST.get('name') + description = request.POST.get('description') + agent = Agent.objects.create(name=name, description=description, owner=request.user) + return redirect('my_agents') return render(request, "core/create_agent.html") + +@login_required +def my_agents(request): + agents = Agent.objects.filter(owner=request.user) + return render(request, "core/my_agents.html", {"agents": agents}) + +@login_required +def publish_agent(request, agent_id): + agent = get_object_or_404(Agent, id=agent_id, owner=request.user) + agent.published = not agent.published + agent.save() + return redirect('my_agents') + +@login_required +@require_POST +def delete_agent(request, agent_id): + agent = get_object_or_404(Agent, id=agent_id, owner=request.user) + agent.delete() + return redirect('my_agents') + +@login_required +def edit_agent(request, agent_id): + agent = get_object_or_404(Agent, id=agent_id, owner=request.user) + if request.method == 'POST': + agent.name = request.POST.get('name') + agent.description = request.POST.get('description') + agent.save() + return redirect('my_agents') + return render(request, 'core/edit_agent.html', {'agent': agent}) + +def agent_detail(request, agent_id): + agent = get_object_or_404(Agent, id=agent_id) + return render(request, 'core/article_detail.html', {'agent': agent}) + +def signup(request): + if request.method == 'POST': + form = SignUpForm(request.POST) + if form.is_valid(): + user = form.save() + login(request, user) + return redirect('home') + else: + form = SignUpForm() + return render(request, 'core/signup.html', {'form': form}) diff --git a/static/css/custom.css b/static/css/custom.css index 47db51d..ff154ca 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -122,6 +122,10 @@ a:hover { } +.agent-card-link { + text-decoration: none; + color: inherit; +} /* Chat Interface */