with Demo Admin Login and Example entries
This commit is contained in:
parent
7af198c681
commit
c5b112bb09
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -180,3 +180,6 @@ if EMAIL_USE_SSL:
|
||||
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
LOGIN_REDIRECT_URL = 'dashboard'
|
||||
LOGOUT_REDIRECT_URL = 'index'
|
||||
@ -1,19 +1,3 @@
|
||||
"""
|
||||
URL configuration for config project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from django.conf import settings
|
||||
@ -21,9 +5,10 @@ from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
path("accounts/", include("django.contrib.auth.urls")),
|
||||
path("", include("core.urls")),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets")
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,18 @@
|
||||
from django.contrib import admin
|
||||
from .models import Company, Profile, AIChatHistory
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(Company)
|
||||
class CompanyAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'tenant_id', 'created_at')
|
||||
search_fields = ('name', 'tenant_id')
|
||||
|
||||
@admin.register(Profile)
|
||||
class ProfileAdmin(admin.ModelAdmin):
|
||||
list_display = ('user', 'company', 'role')
|
||||
list_filter = ('company', 'role')
|
||||
|
||||
@admin.register(AIChatHistory)
|
||||
class AIChatHistoryAdmin(admin.ModelAdmin):
|
||||
list_display = ('chat_title', 'ai_chat_engine', 'company', 'chat_last_date')
|
||||
list_filter = ('ai_chat_engine', 'company')
|
||||
search_fields = ('chat_title', 'chat_content')
|
||||
52
core/migrations/0001_initial.py
Normal file
52
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,52 @@
|
||||
# Generated by Django 5.2.7 on 2026-02-08 15:44
|
||||
|
||||
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='Company',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('tenant_id', models.SlugField(unique=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Profile',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('role', models.CharField(choices=[('admin', 'Admin'), ('user', 'End-User')], default='user', max_length=50)),
|
||||
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='members', to='core.company')),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AIChatHistory',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ai_chat_engine', models.CharField(max_length=100)),
|
||||
('ai_chat_id', models.CharField(max_length=255)),
|
||||
('chat_title', models.CharField(max_length=512)),
|
||||
('chat_content', models.TextField()),
|
||||
('chat_last_date', models.DateTimeField()),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chat_histories', to='core.company')),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'AI Chat Histories',
|
||||
'indexes': [models.Index(fields=['chat_title'], name='core_aichat_chat_ti_6da4cc_idx')],
|
||||
},
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -1,3 +1,37 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
# Create your models here.
|
||||
class Company(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
tenant_id = models.SlugField(unique=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Profile(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
company = models.ForeignKey(Company, on_delete=models.CASCADE, related_name='members')
|
||||
role = models.CharField(max_length=50, choices=[('admin', 'Admin'), ('user', 'End-User')], default='user')
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.user.username} ({self.company.name})"
|
||||
|
||||
class AIChatHistory(models.Model):
|
||||
company = models.ForeignKey(Company, on_delete=models.CASCADE, related_name='chat_histories')
|
||||
ai_chat_engine = models.CharField(max_length=100) # ChatGPT, Bing, etc.
|
||||
ai_chat_id = models.CharField(max_length=255)
|
||||
chat_title = models.CharField(max_length=512)
|
||||
chat_content = models.TextField()
|
||||
chat_last_date = models.DateTimeField()
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "AI Chat Histories"
|
||||
indexes = [
|
||||
models.Index(fields=['chat_title']),
|
||||
# We'll use database-level full-text search or icontains for now
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return f"[{self.ai_chat_engine}] {self.chat_title}"
|
||||
@ -1,25 +1,147 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
||||
{% if project_description %}
|
||||
<meta name="description" content="{{ project_description }}">
|
||||
<meta property="og:description" content="{{ project_description }}">
|
||||
<meta property="twitter:description" content="{{ project_description }}">
|
||||
{% endif %}
|
||||
{% if project_image_url %}
|
||||
<meta property="og:image" content="{{ project_image_url }}">
|
||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||
{% endif %}
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||
{% block head %}{% endblock %}
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}AI Chat Archive{% endblock %}</title>
|
||||
|
||||
<!-- Google Fonts -->
|
||||
<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;600;700&family=Source+Code+Pro&display=swap" rel="stylesheet">
|
||||
|
||||
<!-- Bootstrap 5 CDN -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Lucide Icons -->
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--primary-bg: #0f172a;
|
||||
--accent-cyan: #22d3ee;
|
||||
--text-main: #f1f5f9;
|
||||
--glass-bg: rgba(255, 255, 255, 0.05);
|
||||
--glass-border: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--primary-bg);
|
||||
color: var(--text-main);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
background: var(--glass-bg);
|
||||
backdrop-filter: blur(10px);
|
||||
border: 1px solid var(--glass-border);
|
||||
border-radius: 1rem;
|
||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||
}
|
||||
|
||||
.glass-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
|
||||
border-color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.navbar {
|
||||
background: rgba(15, 23, 42, 0.8) !important;
|
||||
backdrop-filter: blur(10px);
|
||||
border-bottom: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.btn-cyan {
|
||||
background-color: var(--accent-cyan);
|
||||
color: var(--primary-bg);
|
||||
font-weight: 600;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.btn-cyan:hover {
|
||||
background-color: #06b6d4;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.chat-content {
|
||||
font-family: 'Source Code Pro', monospace;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
background-color: rgba(34, 211, 238, 0.2);
|
||||
color: var(--accent-cyan);
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark sticky-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center" href="{% url 'index' %}">
|
||||
<i data-lucide="archive" class="me-2 text-info"></i>
|
||||
<span class="fw-bold">AI Chat Archive</span>
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto align-items-center">
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'dashboard' %}">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/">Admin</a>
|
||||
</li>
|
||||
<li class="nav-item ms-lg-3">
|
||||
<form action="{% url 'logout' %}" method="post" class="d-inline">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-outline-light btn-sm">Logout</button>
|
||||
</form>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="btn btn-cyan px-4" href="{% url 'login' %}">Login</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="py-5 flex-grow-1">
|
||||
<div class="container">
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ message.tags }} glass-card border-{{ message.tags }} mb-4">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="py-4 border-top border-secondary mt-auto">
|
||||
<div class="container text-center text-secondary small">
|
||||
© 2026 AI Chat Archive. Powered by Flatlogic.
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap Bundle with Popper -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
lucide.createIcons();
|
||||
</script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
55
core/templates/core/chat_detail.html
Normal file
55
core/templates/core/chat_detail.html
Normal file
@ -0,0 +1,55 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ chat.chat_title }} - AI Chat Archive{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" class="mb-4">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'dashboard' %}" class="text-info">Dashboard</a></li>
|
||||
<li class="breadcrumb-item active text-secondary" aria-current="page">View Chat</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="glass-card p-5">
|
||||
<div class="d-flex justify-content-between align-items-start mb-5 pb-4 border-bottom border-secondary">
|
||||
<div>
|
||||
<span class="badge bg-secondary mb-2">{{ chat.ai_chat_engine }}</span>
|
||||
<h1 class="display-5 fw-bold">{{ chat.chat_title }}</h1>
|
||||
<p class="text-secondary m-0">Last updated: {{ chat.chat_last_date|date:"F j, Y, g:i a" }}</p>
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<button class="btn btn-outline-info" onclick="copyToClipboard()">
|
||||
<i data-lucide="copy" size="18" class="me-2"></i>Copy Text
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chat-viewport bg-black bg-opacity-20 p-4 rounded-3 border border-secondary shadow-inner">
|
||||
<div id="chat-body" class="chat-content text-light" style="white-space: pre-wrap; line-height: 1.6;">
|
||||
{{ chat.chat_content }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 d-flex gap-3">
|
||||
<button class="btn btn-cyan px-4">
|
||||
<i data-lucide="languages" size="18" class="me-2"></i>Translate
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary px-4">
|
||||
<i data-lucide="link" size="18" class="me-2"></i>Open in {{ chat.ai_chat_engine }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
function copyToClipboard() {
|
||||
const text = document.getElementById('chat-body').innerText;
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
alert('Chat content copied to clipboard!');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
85
core/templates/core/dashboard.html
Normal file
85
core/templates/core/dashboard.html
Normal file
@ -0,0 +1,85 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Dashboard - AI Chat Archive{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-between align-items-end mb-5">
|
||||
<div>
|
||||
<span class="badge bg-info bg-opacity-10 text-info mb-2">{{ company.name }}</span>
|
||||
<h2 class="fw-bold m-0">Chat Archive</h2>
|
||||
</div>
|
||||
<div class="text-secondary small">
|
||||
Logged in as <span class="text-light fw-bold">{{ user.username }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search Section -->
|
||||
<div class="glass-card p-4 mb-5">
|
||||
<form method="GET" action="{% url 'dashboard' %}" class="row g-3">
|
||||
<div class="col-md-10">
|
||||
<div class="input-group input-group-lg">
|
||||
<span class="input-group-text bg-transparent border-secondary text-secondary">
|
||||
<i data-lucide="search"></i>
|
||||
</span>
|
||||
<input type="text" name="q" class="form-control bg-transparent border-secondary text-light"
|
||||
placeholder="Search across all chats..." value="{{ query }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<button type="submit" class="btn btn-cyan btn-lg w-100">Search</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Results Section -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
{% if query %}
|
||||
<h5 class="mb-4 text-secondary">Search results for "{{ query }}"</h5>
|
||||
{% else %}
|
||||
<h5 class="mb-4 text-secondary">Recent Conversations</h5>
|
||||
{% endif %}
|
||||
|
||||
{% if chats %}
|
||||
<div class="row g-4">
|
||||
{% for chat in chats %}
|
||||
<div class="col-12">
|
||||
<div class="glass-card p-4">
|
||||
<div class="d-flex justify-content-between align-items-start mb-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="bg-secondary bg-opacity-20 p-2 rounded-3 me-3">
|
||||
{% if chat.ai_chat_engine == 'ChatGPT' %}
|
||||
<i data-lucide="message-square" class="text-success"></i>
|
||||
{% elif chat.ai_chat_engine == 'Bing' %}
|
||||
<i data-lucide="globe" class="text-info"></i>
|
||||
{% else %}
|
||||
<i data-lucide="bot" class="text-warning"></i>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<h5 class="m-0 fw-bold">{{ chat.chat_title }}</h5>
|
||||
<span class="small text-secondary">{{ chat.ai_chat_engine }} • {{ chat.chat_last_date|date:"M d, Y" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{% url 'chat_detail' chat.pk %}" class="btn btn-outline-secondary btn-sm">
|
||||
<i data-lucide="external-link" size="16"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="chat-content text-secondary">
|
||||
{{ chat.chat_content|truncatewords:50|linebreaks }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="text-center py-5">
|
||||
<i data-lucide="inbox" class="text-secondary mb-3" size="48"></i>
|
||||
<p class="text-secondary">No chats found. Try a different search term or connect an engine.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -1,145 +1,110 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% 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 title %}Welcome to AI Chat Archive{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<main>
|
||||
<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 class="container">
|
||||
<!-- Hero Section -->
|
||||
<div class="row min-vh-75 align-items-center">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="display-3 fw-bold mb-4">
|
||||
Unlock Your <span class="text-info">Collective Intelligence</span>
|
||||
</h1>
|
||||
<p class="lead text-secondary mb-5">
|
||||
Retrieve, archive, and search through your entire AI chat history from ChatGPT, Bing, and more.
|
||||
One unified search for all your past conversations.
|
||||
</p>
|
||||
<div class="d-flex gap-3">
|
||||
<a href="{% url 'login' %}" class="btn btn-cyan btn-lg px-5 py-3">Get Started</a>
|
||||
<a href="#how-it-works" class="btn btn-outline-light btn-lg px-5 py-3">How it Works</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 mt-5 mt-lg-0">
|
||||
<div class="glass-card p-4 position-relative overflow-hidden">
|
||||
<div class="bg-info position-absolute top-0 end-0 p-5 rounded-circle" style="filter: blur(80px); opacity: 0.1;"></div>
|
||||
<div class="d-flex align-items-center mb-4">
|
||||
<div class="bg-info bg-opacity-10 p-2 rounded-3 me-3">
|
||||
<i data-lucide="search" class="text-info"></i>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<div class="bg-secondary bg-opacity-20 p-2 rounded w-75 mb-2"></div>
|
||||
<div class="bg-secondary bg-opacity-10 p-2 rounded w-50"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-top border-secondary pt-4">
|
||||
<div class="chat-content text-secondary opacity-50">
|
||||
> Retrieving histories...<br>
|
||||
> Found 142 chats from ChatGPT<br>
|
||||
> Found 89 chats from Perplexity<br>
|
||||
> Indexing for rapid search...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
||||
</footer>
|
||||
|
||||
<!-- How It Works Section -->
|
||||
<div id="how-it-works" class="py-5 mt-5">
|
||||
<div class="text-center mb-5">
|
||||
<h2 class="fw-bold h1">Three Steps to <span class="text-info">Knowledge Mastery</span></h2>
|
||||
<p class="text-secondary">Our platform bridges the gap between AI silos and your team's memory.</p>
|
||||
</div>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100 border-top border-info border-3">
|
||||
<div class="mb-3 d-flex align-items-center">
|
||||
<span class="badge bg-info text-dark rounded-circle me-2 p-2" style="width:32px; height:32px; display:flex; align-items:center; justify-content:center;">1</span>
|
||||
<h5 class="mb-0">Connect Engines</h5>
|
||||
</div>
|
||||
<p class="text-secondary mb-0">Use the <strong>"Connect AI"</strong> button in your dashboard to link your API keys securely. We support OpenAI, Anthropic, and Perplexity.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100 border-top border-info border-3">
|
||||
<div class="mb-3 d-flex align-items-center">
|
||||
<span class="badge bg-info text-dark rounded-circle me-2 p-2" style="width:32px; height:32px; display:flex; align-items:center; justify-content:center;">2</span>
|
||||
<h5 class="mb-0">Sync History</h5>
|
||||
</div>
|
||||
<p class="text-secondary mb-0">Click <strong>"Fetch Latest"</strong> to automatically download and index your recent conversations into your private company vault.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100 border-top border-info border-3">
|
||||
<div class="mb-3 d-flex align-items-center">
|
||||
<span class="badge bg-info text-dark rounded-circle me-2 p-2" style="width:32px; height:32px; display:flex; align-items:center; justify-content:center;">3</span>
|
||||
<h5 class="mb-0">Search & Find</h5>
|
||||
</div>
|
||||
<p class="text-secondary mb-0">Use the <strong>Search Bar</strong> to instantly find any past prompt or answer across all connected AI tools, including file attachments.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Features Grid -->
|
||||
<div id="features" class="py-5 mt-5">
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100">
|
||||
<i data-lucide="database" class="text-info mb-3" size="32"></i>
|
||||
<h4>Unified Storage</h4>
|
||||
<p class="text-secondary">Centralize all your AI interactions in one secure, company-owned vault.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100">
|
||||
<i data-lucide="zap" class="text-info mb-3" size="32"></i>
|
||||
<h4>Instant Search</h4>
|
||||
<p class="text-secondary">Powerful keyword and similarity search powered by optimized database indexes.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100">
|
||||
<i data-lucide="shield" class="text-info mb-3" size="32"></i>
|
||||
<h4>Multi-tenant</h4>
|
||||
<p class="text-secondary">Enterprise-grade isolation ensuring your company's data stays private.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
44
core/templates/registration/login.html
Normal file
44
core/templates/registration/login.html
Normal file
@ -0,0 +1,44 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Login - AI Chat Archive{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container d-flex align-items-center justify-content-center min-vh-75">
|
||||
<div class="glass-card p-5 w-100" style="max-width: 450px;">
|
||||
<div class="text-center mb-4">
|
||||
<h2 class="fw-bold">Welcome Back</h2>
|
||||
<p class="text-secondary">Sign in to access your AI vault</p>
|
||||
</div>
|
||||
|
||||
<form method="post" action="{% url 'login' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.errors %}
|
||||
<div class="alert alert-danger bg-danger bg-opacity-10 border-danger text-danger mb-4">
|
||||
Your username and password didn't match. Please try again.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="id_username" class="form-label text-secondary small text-uppercase fw-bold">Username</label>
|
||||
<input type="text" name="username" autofocus maxlength="150" required id="id_username"
|
||||
class="form-control bg-dark bg-opacity-50 border-secondary text-white py-3">
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="id_password" class="form-label text-secondary small text-uppercase fw-bold">Password</label>
|
||||
<input type="password" name="password" required id="id_password"
|
||||
class="form-control bg-dark bg-opacity-50 border-secondary text-white py-3">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-cyan w-100 py-3 fw-bold">Sign In</button>
|
||||
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
|
||||
<div class="text-center mt-4 pt-4 border-top border-secondary border-opacity-25">
|
||||
<p class="text-secondary small">Demo credentials: <strong>admin</strong> / <strong>admin123</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -1,7 +1,8 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
]
|
||||
path('', views.index, name='index'),
|
||||
path('dashboard/', views.dashboard, name='dashboard'),
|
||||
path('chat/<int:pk>/', views.chat_detail, name='chat_detail'),
|
||||
]
|
||||
@ -1,25 +1,34 @@
|
||||
import os
|
||||
import platform
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from .models import AIChatHistory, Profile
|
||||
from django.db.models import Q
|
||||
|
||||
from django import get_version as django_version
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
def index(request):
|
||||
if request.user.is_authenticated:
|
||||
return redirect('dashboard')
|
||||
return render(request, 'core/index.html')
|
||||
|
||||
@login_required
|
||||
def dashboard(request):
|
||||
query = request.GET.get('q', '')
|
||||
profile = Profile.objects.get(user=request.user)
|
||||
chats = AIChatHistory.objects.filter(company=profile.company)
|
||||
|
||||
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()
|
||||
if query:
|
||||
chats = chats.filter(
|
||||
Q(chat_title__icontains=query) | Q(chat_content__icontains=query)
|
||||
).order_by('-chat_last_date')
|
||||
else:
|
||||
chats = chats.order_by('-chat_last_date')[:10]
|
||||
|
||||
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", ""),
|
||||
'chats': chats,
|
||||
'query': query,
|
||||
'company': profile.company
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
return render(request, 'core/dashboard.html', context)
|
||||
|
||||
def chat_detail(request, pk):
|
||||
profile = Profile.objects.get(user=request.user)
|
||||
chat = AIChatHistory.objects.get(pk=pk, company=profile.company)
|
||||
return render(request, 'core/chat_detail.html', {'chat': chat})
|
||||
Loading…
x
Reference in New Issue
Block a user