From ac6e16f3bd93e84b5169a77662db6b5db2a55ed8 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 17 Dec 2025 05:03:15 +0000 Subject: [PATCH] ai agent --- config/__pycache__/settings.cpython-311.pyc | Bin 5552 -> 5583 bytes config/settings.py | 2 + core/__pycache__/admin.cpython-311.pyc | Bin 212 -> 741 bytes core/__pycache__/forms.cpython-311.pyc | Bin 0 -> 1052 bytes core/__pycache__/models.cpython-311.pyc | Bin 209 -> 1264 bytes core/__pycache__/urls.cpython-311.pyc | Bin 442 -> 1258 bytes core/__pycache__/views.cpython-311.pyc | Bin 1920 -> 5742 bytes core/admin.py | 7 ++ core/forms.py | 10 ++ core/migrations/0001_initial.py | 29 ++++++ .../__pycache__/0001_initial.cpython-311.pyc | Bin 0 -> 1753 bytes core/models.py | 12 +++ core/templates/base.html | 29 +++++- core/templates/core/article_detail.html | 19 ++-- core/templates/core/create_agent.html | 90 ++++-------------- core/templates/core/edit_agent.html | 21 ++++ core/templates/core/index.html | 50 +++++----- core/templates/core/login.html | 11 +++ core/templates/core/my_agents.html | 48 ++++++++++ core/templates/core/signup.html | 10 ++ core/urls.py | 9 +- core/views.py | 67 +++++++++++-- static/css/custom.css | 4 + 23 files changed, 302 insertions(+), 116 deletions(-) create mode 100644 core/__pycache__/forms.cpython-311.pyc create mode 100644 core/forms.py create mode 100644 core/migrations/0001_initial.py create mode 100644 core/migrations/__pycache__/0001_initial.cpython-311.pyc create mode 100644 core/templates/core/edit_agent.html create mode 100644 core/templates/core/login.html create mode 100644 core/templates/core/my_agents.html create mode 100644 core/templates/core/signup.html diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 5be02db206d695487566bb415cb6b1e287631fb4..85f1e3cd93eb8feb95157e8e1062e1aa2346e31d 100644 GIT binary patch delta 405 zcmdm>eO{Y)IWI340}!mVaLSCH$ScWsW25>2dbaEmDxa%7gbr5CYnLk6TjI` z&Sw!|wn?#__`^D08%^FW#U9NBofL-_1~gTUsXC~t7U;s9f=s74O+LpWFRYiUUBr~) z9Ho`w5~ZKQ9L%8Ux`}lz2WJ(#eolURW}g1$xxD3!jB6%~@;5RXY@W`4h>`mir;oq8 qr(b+%kk8~u!E~;4pt&IL7C+s5N^lDk2M+_USOez=w$1e-hKvBtz)52O delta 371 zcmX@Fy+NCIIWI340}#CB)yQ<2$ScWsWuy8>rg|oZROT$O1V}Q)IK^Zc69dC)AclY_ zWi%D0DO_kORDdc}(NvkGn4_v%#t1YOh@qycLDdUF1yU?hcp(}lcQM;ee#vYjtchl% zb&Ad8SIpj)wkdX~Mn`F<*tamCsdh-!Mpd;yXYxWmVN-?_M^vY{Ff0SQVKvkp3=C1a zsai!$DNa$EDb7)PDa^qPnl77JSm$zVUd3C^$hc~<5`QD3{^lk8hZrXp3Z`?V0d<1> UReW#rBf%|9jC`Bti5M~h0EFW~b^rhX 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 cd6f855b12f4883b1ba9de01c54245c53aacd714..1edc092b7c7e8a7e14442036df51194d1de04ccb 100644 GIT binary patch literal 741 zcmZWmy>1jS5FUGfZnMcDAh{rrKu|@iK(?SokwQZONkg}dwYPTeHtb)#yMpVs$OELy z8yrG;nINS&xk92!chOO$V!W4)6lH9Go*9q7v1fkv`!1jyzyBC-5rDti=)}HN76mG2 zz=4wlQW6jXoN^kyX)MG%8)L#S1jfKtMn^1eBA&;50C~5m?+rMoYQv zknaa$uZc1*I{ydvWCk6LzhHqm z;O3n_&Qsyn!#b;KU;GeJUFFjMp384#5k|s~aw+__FgwLW_V7*%x@F}{gywGiS>J8G z%${yFpJyA}&AuLTql-WAdg>8B3bRqZ6XjVYR#x^loN!xK?s?_>x=ty2G1|<&$$EiaWgo1b!z=4o0nvB dP7U&Q4iDjUaQWoTwLbW#;o1QD>|uQSwEtiVxd{LO delta 168 zcmaFLdWA7%IWI340}y=Q^((_3NIwQ~V1NnA_$&luOlL@8NMX!j$YqRTWMoKT3TDt` zehE^b$#{!3F(o%M&rg%-7GFwMVqSW_UUGh3Nl|7}5i?N1AmS6u0lIX>^4a5VWX5VL}n&PGSHC1PIh3B@)Zb4VQ`uT0%irBepPdv^&XD1Eknejm2q&(HocGgBuZpC3F80!qj)G)7_$ zmHsj)2ZR$&LlRMsQq;9ji*!#fbv-m9(=#d2$aBJtPlTI7Khz2N4xWwMls;WwIBMS z26lQ}u}L_@Rh5v$mRUi?HKoVkaA;4rMK+e-)-P>O%JnPCb)rP!@e~@r;D?N@T2Q zs9FwHh*>0*S>{!>4olMyiR5Z}q}^R{Ickc1Ng-u?Apj-f0X->&GG%g`rM!>J3>PuMBW#l6-pcfZQtW>oZ zPnT08z)PfW0RBm6FYYfL*^6KG;{MyhWp^P~)&p0l7Vz#skO1B(Cv literal 0 HcmV?d00001 diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b9d5171b2bb0d207f045e07f9fbbb95a64..d31fe84b7fee30d70b9b4013fe36961e2a5af056 100644 GIT binary patch literal 1264 zcmZuwy>HV%6u(R2B#sk^142MMAj*fLN{&=2)Bz#&6YrANZ?5SRnRPz_U5OC%6W{ym;4AdQib7{$HBAq4+4 zNuZXAJhJ1XX|k6(#DIV=UNtpBL}>BbMBx0KGe^E-6J^K)?cN5s#=#!HgO35|$k z+>b!IlV_k!zquW1)9*Hpp7x%7x%QO?TD7lLL#^6f8E8||IQ8BQwAsEk8)~zlEM48d z5tgnVoexSzzhs0Zqx*1BoY_x@#hIhkpg7kr&V|Lf?)`y&eg8tJU;jKG=nH*)A=DST z55~$PFVN@v`h2L*cOMK>Sh+Mrr%8MZnfH1*EmXQ?+MA9+>v6>|kK~49d%RUQV6vJ< z-0Zjm%47M5#|4;?RhSgzSN2Za%e(w0800j$1jsOnF&?1l;NN$EW`lpLrWmp2~#~=<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 7e247648c7e54f0eaa777e97bb82ae2b950518fe..958a5c6a424d6b888495ce656c88e469a821adc6 100644 GIT binary patch literal 1258 zcmc(dy>HV%7{<@ZYbUmo78+WDD1-@-DAYp-5Di5@lqsSEh`|Gun>(d0{)o;tC1Idr z$8L1&LJ2BE$Nm|%7c+^-xV%%EsgGIbWHvxp%FK}o;8G?j6CTfHl6fNF zYnkLaDd2@nQXxfrBa+XysshgO%nr=jbqxUUu5Y4~z9M?9x zc3-#N>SQ-Ul%JZgG?R=9sZOEsQjY{9)+rI6d`IQf)Wc+Eg$l7mGKcBdQD`9!+)b#X zv~s7J7sPI(vLwL7+`}kK1VT3)R5z0WME=QWlUj7Wlmw8_(3#` zJ(VSeV-4FfW(J1UKnwxtOi`>UoWTs5TrWWanvAzt3KB~)UNV9>Ot)Av@^e#f@gx_e zCYGeeC#I+7mE2+|Vuh;AOUzB3tjHw7?5D{#`2v&jWO-)aGJc>WNOy4xkodsN$jEqu zLFNJ~dcdH10UP?j#=y$i;L;(~5i*1A0*m}b7WpeI@;6vGfMW79bXLS&V6nN#VsnMX S<^wA;KT`uY2o~`IEdl`F&P96w diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 96db8e16686a547b2d4563ff4d3818d6734717b3..c9efc914bf0990ea1662762b233693b9e6f58e82 100644 GIT binary patch literal 5742 zc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xmG4QJdmwg^aO52qPQ9?;`hM$6#`ghqf&DS4Zz) VLrp4&8|V+~HIzdQ^e+n{{07sF510S| 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 0000000000000000000000000000000000000000..9677e96fb3c4b4c5d74f0a682fdf381b70041fba GIT binary patch literal 1753 zcmZuxJ#gbh6kf@;EX#Ic=bSTUz&10-5NC!sAryoO5Ic#F}v<*x&t1l$HLqnw|(QV4BxI+0y8-*Z^DP7x;8zxa~f@!p4s%^zQmiNgqjabA~6-|9c zXzYNPb;BaEuCxgaGWzOo*a-?pYAZ*wM)an=N28cn4O8u~(g9Pbt||IHjdZ$oO||w2 z23;7FU8SqpR2uFnD>kToH+17rRxqYgw}Y8KzD@L81RD)@!KFgbWB~#%x|&8KhAu;a z5}Q!oHVVAS5=Dhwm1x*{0>>9+&uLkvk}N|pcQpchOqRdzDjGWoNMTi1Z8)mQYK*3= zL#5ME>Hx%~Lv&2^#<9s-hfbHC?tCdf-QN6G-uilDvr1!Qgi0(LUH9U+#ahN>T|i@H zwON7)SC~IEvc9L7Lw1K8**+U98-_*{-IwAUaPl3sO?*+R7$#Ah`eR6lfLn^*G$@bj zRP+uFai-z*()N03W0OiohYZ{HcXR{0qt{;)_l!0vcI#c;?iR@rX@DI*?E#$86cFuR4j(u9ELK*`?E6H@kHC zzLQ<+XV={9nv*D9CEs;&%clo!ZuyUtldJS|6*pIL5)bbfE_a+ - {% 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 */