diff --git a/ai/__pycache__/__init__.cpython-311.pyc b/ai/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..b4c4676 Binary files /dev/null and b/ai/__pycache__/__init__.cpython-311.pyc differ diff --git a/ai/__pycache__/local_ai_api.cpython-311.pyc b/ai/__pycache__/local_ai_api.cpython-311.pyc new file mode 100644 index 0000000..2d4482f Binary files /dev/null and b/ai/__pycache__/local_ai_api.cpython-311.pyc differ diff --git a/config/__pycache__/__init__.cpython-311.pyc b/config/__pycache__/__init__.cpython-311.pyc index 3d6501c..be12f94 100644 Binary files a/config/__pycache__/__init__.cpython-311.pyc and b/config/__pycache__/__init__.cpython-311.pyc differ diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 5be02db..038d895 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 28817aa..3340965 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/__pycache__/wsgi.cpython-311.pyc b/config/__pycache__/wsgi.cpython-311.pyc index 79ce690..b98adbd 100644 Binary files a/config/__pycache__/wsgi.cpython-311.pyc and b/config/__pycache__/wsgi.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..d66eaa1 100644 --- a/config/settings.py +++ b/config/settings.py @@ -56,6 +56,7 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', 'core', + 'story_writer', ] MIDDLEWARE = [ diff --git a/config/urls.py b/config/urls.py index bcfc074..cf88a04 100644 --- a/config/urls.py +++ b/config/urls.py @@ -21,6 +21,7 @@ from django.conf.urls.static import static urlpatterns = [ path("admin/", admin.site.urls), + path("stories/", include("story_writer.urls")), path("", include("core.urls")), ] diff --git a/core/__pycache__/__init__.cpython-311.pyc b/core/__pycache__/__init__.cpython-311.pyc index 3b7774e..0c6cca4 100644 Binary files a/core/__pycache__/__init__.cpython-311.pyc and b/core/__pycache__/__init__.cpython-311.pyc differ diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..ee52459 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/apps.cpython-311.pyc b/core/__pycache__/apps.cpython-311.pyc index 6435d92..d88343a 100644 Binary files a/core/__pycache__/apps.cpython-311.pyc and b/core/__pycache__/apps.cpython-311.pyc differ diff --git a/core/__pycache__/context_processors.cpython-311.pyc b/core/__pycache__/context_processors.cpython-311.pyc index e85aca4..be1bbaa 100644 Binary files a/core/__pycache__/context_processors.cpython-311.pyc and b/core/__pycache__/context_processors.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..deb30fc 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 1f807fa..dd76db5 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 6867ddf..4706d28 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/__init__.cpython-311.pyc b/core/migrations/__pycache__/__init__.cpython-311.pyc index 58b1c14..67e17d4 100644 Binary files a/core/migrations/__pycache__/__init__.cpython-311.pyc and b/core/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..66caa6f 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -15,6 +15,9 @@ {% endif %} {% load static %} + + + {% block head %}{% endblock %} diff --git a/core/templates/core/index.html b/core/templates/core/index.html index faec813..6332ce3 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,145 +1,17 @@ {% extends "base.html" %} +{% load static %} -{% block title %}{{ project_name }}{% endblock %} - -{% block head %} - - - - -{% endblock %} +{% block title %}Creative Story Writer - Unleash Your Imagination{% endblock %} {% block content %} -
-
-

Analyzing your requirements and generating your app…

-
- Loading… +
+
+
+
+
+

Creative Story Writer

+

Harness the power of AI to bring your stories to life. Overcome writer's block, generate new ideas, and craft compelling narratives with ease.

+ Get Started
-

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 diff --git a/core/urls.py b/core/urls.py index 6299e3d..622ef9d 100644 --- a/core/urls.py +++ b/core/urls.py @@ -2,6 +2,8 @@ from django.urls import path from .views import home +app_name = "core" + urlpatterns = [ path("", home, name="home"), ] diff --git a/static/css/custom.css b/static/css/custom.css index 925f6ed..49b8737 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,4 +1,145 @@ /* Custom styles for the application */ +@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;600;700&display=swap'); + body { - font-family: system-ui, -apple-system, sans-serif; + font-family: 'Inter', sans-serif; + background-color: #f8f9fa; + color: #343a40; + overflow-x: hidden; +} + +.hero-shapes { + position: relative; + background: linear-gradient(135deg, #f8f9fa, #e0e7ff); + overflow: hidden; + padding: 100px 0; + animation: gradient-animation 10s ease infinite; +} + +@keyframes gradient-animation { + 0% { background: linear-gradient(135deg, #f8f9fa, #e0e7ff); } + 50% { background: linear-gradient(135deg, #e0e7ff, #f8f9fa); } + 100% { background: linear-gradient(135deg, #f8f9fa, #e0e7ff); } +} + +.shape { + position: absolute; + border-radius: 50%; + background-color: rgba(0, 123, 255, 0.1); + animation: shape-animation 20s infinite linear; +} + +.shape-1 { + width: 200px; + height: 200px; + top: 10%; + left: 10%; +} + +.shape-2 { + width: 100px; + height: 100px; + top: 60%; + right: 20%; + animation-delay: 5s; +} + +.shape-3 { + width: 150px; + height: 150px; + bottom: 10%; + left: 30%; + animation-delay: 10s; +} + +@keyframes shape-animation { + 0% { transform: translateY(0) rotate(0deg); } + 100% { transform: translateY(-100px) rotate(360deg); } +} + +.container { + max-width: 1200px; + position: relative; + z-index: 1; + animation: fade-in 1.5s ease; +} + +@keyframes fade-in { + from { opacity: 0; transform: translateY(20px); } + to { opacity: 1; transform: translateY(0); } +} + +h1.display-4.fw-bold { + font-family: 'Playfair Display', serif; + font-weight: 700; + color: #212529; +} + +.lead { + color: #6c757d; +} + +.btn-primary { + background-color: #007bff; + border-color: #007bff; + border-radius: 50px; + font-weight: 600; + padding: 15px 30px; + font-size: 1.2rem; + transition: background-color 0.2s, transform 0.2s; +} + +.btn-primary:hover { + background-color: #0056b3; + transform: translateY(-2px); +} + +/* Story writer specific styles */ + +.card { + border: none; + border-radius: 15px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + transition: transform 0.2s; +} + +.card:hover { + transform: translateY(-5px); +} + +.card-body { + padding: 2rem; +} + +.card-title { + font-weight: 600; + margin-bottom: 1.5rem; +} + +#editor, #suggestion { + border-radius: 10px; + border: 1px solid #dee2e6; + padding: 15px; + font-size: 1rem; + line-height: 1.6; + background-color: #fff; +} + +#editor:focus, #suggestion:focus { + outline: none; + border-color: #80bdff; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.spinner-border { + width: 3rem; + height: 3rem; + color: #007bff; +} + +.center-spinner { + display: flex; + justify-content: center; + align-items: center; + height: 100%; } diff --git a/staticfiles/css/custom.css b/staticfiles/css/custom.css index 108056f..49b8737 100644 --- a/staticfiles/css/custom.css +++ b/staticfiles/css/custom.css @@ -1,21 +1,145 @@ +/* Custom styles for the application */ +@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;600;700&display=swap'); -: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); -} body { - margin: 0; font-family: 'Inter', sans-serif; - background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); - color: var(--text-color); + background-color: #f8f9fa; + color: #343a40; + overflow-x: hidden; +} + +.hero-shapes { + position: relative; + background: linear-gradient(135deg, #f8f9fa, #e0e7ff); + overflow: hidden; + padding: 100px 0; + animation: gradient-animation 10s ease infinite; +} + +@keyframes gradient-animation { + 0% { background: linear-gradient(135deg, #f8f9fa, #e0e7ff); } + 50% { background: linear-gradient(135deg, #e0e7ff, #f8f9fa); } + 100% { background: linear-gradient(135deg, #f8f9fa, #e0e7ff); } +} + +.shape { + position: absolute; + border-radius: 50%; + background-color: rgba(0, 123, 255, 0.1); + animation: shape-animation 20s infinite linear; +} + +.shape-1 { + width: 200px; + height: 200px; + top: 10%; + left: 10%; +} + +.shape-2 { + width: 100px; + height: 100px; + top: 60%; + right: 20%; + animation-delay: 5s; +} + +.shape-3 { + width: 150px; + height: 150px; + bottom: 10%; + left: 30%; + animation-delay: 10s; +} + +@keyframes shape-animation { + 0% { transform: translateY(0) rotate(0deg); } + 100% { transform: translateY(-100px) rotate(360deg); } +} + +.container { + max-width: 1200px; + position: relative; + z-index: 1; + animation: fade-in 1.5s ease; +} + +@keyframes fade-in { + from { opacity: 0; transform: translateY(20px); } + to { opacity: 1; transform: translateY(0); } +} + +h1.display-4.fw-bold { + font-family: 'Playfair Display', serif; + font-weight: 700; + color: #212529; +} + +.lead { + color: #6c757d; +} + +.btn-primary { + background-color: #007bff; + border-color: #007bff; + border-radius: 50px; + font-weight: 600; + padding: 15px 30px; + font-size: 1.2rem; + transition: background-color 0.2s, transform 0.2s; +} + +.btn-primary:hover { + background-color: #0056b3; + transform: translateY(-2px); +} + +/* Story writer specific styles */ + +.card { + border: none; + border-radius: 15px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); + transition: transform 0.2s; +} + +.card:hover { + transform: translateY(-5px); +} + +.card-body { + padding: 2rem; +} + +.card-title { + font-weight: 600; + margin-bottom: 1.5rem; +} + +#editor, #suggestion { + border-radius: 10px; + border: 1px solid #dee2e6; + padding: 15px; + font-size: 1rem; + line-height: 1.6; + background-color: #fff; +} + +#editor:focus, #suggestion:focus { + outline: none; + border-color: #80bdff; + box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); +} + +.spinner-border { + width: 3rem; + height: 3rem; + color: #007bff; +} + +.center-spinner { display: flex; justify-content: center; align-items: center; - min-height: 100vh; - text-align: center; - overflow: hidden; - position: relative; + height: 100%; } diff --git a/story_writer/__init__.py b/story_writer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/story_writer/__pycache__/__init__.cpython-311.pyc b/story_writer/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..a073f04 Binary files /dev/null and b/story_writer/__pycache__/__init__.cpython-311.pyc differ diff --git a/story_writer/__pycache__/admin.cpython-311.pyc b/story_writer/__pycache__/admin.cpython-311.pyc new file mode 100644 index 0000000..f970a16 Binary files /dev/null and b/story_writer/__pycache__/admin.cpython-311.pyc differ diff --git a/story_writer/__pycache__/apps.cpython-311.pyc b/story_writer/__pycache__/apps.cpython-311.pyc new file mode 100644 index 0000000..d240c82 Binary files /dev/null and b/story_writer/__pycache__/apps.cpython-311.pyc differ diff --git a/story_writer/__pycache__/models.cpython-311.pyc b/story_writer/__pycache__/models.cpython-311.pyc new file mode 100644 index 0000000..c8efd7a Binary files /dev/null and b/story_writer/__pycache__/models.cpython-311.pyc differ diff --git a/story_writer/__pycache__/urls.cpython-311.pyc b/story_writer/__pycache__/urls.cpython-311.pyc new file mode 100644 index 0000000..87a6eb9 Binary files /dev/null and b/story_writer/__pycache__/urls.cpython-311.pyc differ diff --git a/story_writer/__pycache__/views.cpython-311.pyc b/story_writer/__pycache__/views.cpython-311.pyc new file mode 100644 index 0000000..e7d82eb Binary files /dev/null and b/story_writer/__pycache__/views.cpython-311.pyc differ diff --git a/story_writer/admin.py b/story_writer/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/story_writer/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/story_writer/apps.py b/story_writer/apps.py new file mode 100644 index 0000000..b24e15f --- /dev/null +++ b/story_writer/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class StoryWriterConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'story_writer' diff --git a/story_writer/migrations/__init__.py b/story_writer/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/story_writer/migrations/__pycache__/__init__.cpython-311.pyc b/story_writer/migrations/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..e401749 Binary files /dev/null and b/story_writer/migrations/__pycache__/__init__.cpython-311.pyc differ diff --git a/story_writer/models.py b/story_writer/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/story_writer/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/story_writer/templates/story_writer/index.html b/story_writer/templates/story_writer/index.html new file mode 100644 index 0000000..cde521e --- /dev/null +++ b/story_writer/templates/story_writer/index.html @@ -0,0 +1,93 @@ +{% extends "base.html" %} +{% block content %} +
+

Creative Story Writer

+
+
+
+
+
Your Story
+
+
+
+
+
+
+
+
+
+
AI Assistant
+

Let the AI help you write your story.

+
+ + + +
+
+
AI Suggestion
+
+ +
+
+
+
+
+
+ + +{% endblock %} \ No newline at end of file diff --git a/story_writer/tests.py b/story_writer/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/story_writer/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/story_writer/urls.py b/story_writer/urls.py new file mode 100644 index 0000000..17c759f --- /dev/null +++ b/story_writer/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from . import views + +app_name = 'story_writer' + +urlpatterns = [ + path('', views.story_writer, name='index'), + path('ai-assistant/', views.ai_assistant, name='ai_assistant'), +] diff --git a/story_writer/views.py b/story_writer/views.py new file mode 100644 index 0000000..9fa74a2 --- /dev/null +++ b/story_writer/views.py @@ -0,0 +1,30 @@ +from django.shortcuts import render +from django.http import JsonResponse +from ai.local_ai_api import LocalAIApi +import json + +def story_writer(request): + return render(request, 'story_writer/index.html') + +def ai_assistant(request): + if request.method == 'POST': + data = json.loads(request.body) + story = data.get('story', '') + prompt = data.get('prompt', '') + + response = LocalAIApi.create_response( + { + "input": [ + {"role": "system", "content": "You are a creative writing assistant."}, + {"role": "user", "content": f'Here is the story so far:\n\n{story}\n\nNow, please continue the story with a {prompt}.'} + ], + }, + ) + + if response.get("success"): + text = LocalAIApi.extract_text(response) + return JsonResponse({'suggestion': text}) + else: + return JsonResponse({'error': 'Failed to get a response from the AI.'}, status=500) + + return JsonResponse({'error': 'Invalid request method.'}, status=405) \ No newline at end of file