Prompt Generator Template

Barandev
 
from flask import Flask, request, render_template, jsonify
import os
from abilities import llm_prompt

app = Flask(__name__)

@app.route("/")
def root_route():
    app.logger.info("Serving the root route.")
    return render_template('prompt_form.html')

@app.route("/generate", methods=["POST"])
def generate_prompt():
    app.logger.info("Received request to generate prompt.")
    data = request.json
    prompt_type = data['promptType']
    prompt_details = data['promptDetails']
    app.logger.info(f"Prompt type: {prompt_type}, Details: {prompt_details}")
    # Example prompt to LLM
    prompt = f"Generate a {prompt_type} app prompt tailored specifically to the user-provided idea: {prompt_details}. The generated prompt must be structured to provide clear instructions for developing the app, covering various aspects such as architecture, features, technologies, and user experience requirements in detail. Specify all desired functionality, including any necessary API integrations or external dependencies that the app may require. Emphasize the critical importance of avoiding the use of #TODO comments within the codebase, ensuring that all features are fully implemented before submission. Additionally, instruct the system to securely configure environment variables to handle any sensitive data or API keys essential for the app's functionality. Detailed documentation on the setup and usage of these environment variables must be included to facilitate seamless development. The prompt should serve as a comprehensive guide, leaving no ambiguity or room for incomplete tasks during the app development process. Ensure that the format of the prompt follows a clear and concise structure, facilitating easy comprehension and implementation by the AI generating the code. Don't add any unuseful words that imply like appreciation, condolences etc. Try to write the text as plain as you can write."
    generated_prompt = llm_prompt(prompt)
    app.logger.info(f"Generated prompt: {generated_prompt}")
    if generated_prompt:

About this template

This application employs Flask for the backend and JavaScript for the frontend. It enables users to generate custom prompts by providing details and selecting a prompt type. The backend receives the user input, constructs a prompt, and sends it to a language model (LLM) for further processing. The generated prompt is then returned to the frontend and displayed for the user. The interface allows users to copy the generated prompt for their use. Additionally, error handling ensures smooth operation even in case of failures during prompt generation. Made by BaranDev[https://github.com/BaranDev]

Introduction to the Prompt Generator Template

Welcome to the Prompt Generator Template! This template is designed to help you create a web application that dynamically generates prompts based on user input. With a neon-colored user interface, users can select a prompt type, provide details, and receive custom prompts tailored to their needs. This step-by-step guide will walk you through using the template on the Lazy platform, ensuring a smooth experience from start to finish.

Getting Started

To begin using the Prompt Generator Template, simply click on "Start with this Template" on the Lazy platform. This will pre-populate the code in the Lazy Builder interface, so you won't need to copy, paste, or delete any code manually.

Test: Deploying the App

Once you have the template loaded, press the "Test" button to start the deployment process. The Lazy CLI will handle the deployment, and you won't need to worry about installing libraries or setting up your environment. If the code requires any user input, the Lazy CLI will prompt you for it after you press the "Test" button.

Entering Input

If the template code requires user input, you will be prompted to provide this information through the Lazy CLI interface. Follow the prompts and enter the necessary details to proceed with the app's functionality.

Using the App

After deployment, if the app includes a frontend or user interface, you will be able to interact with it directly. The interface will render according to the code, allowing you to use the features of the Prompt Generator as intended.

Integrating the App

If your app requires integration with external tools or services, you may need to use the server link provided by the Lazy builder CLI. For example, if your app uses an API, you will be given a link to interact with the API. In the case of FastAPI, you will also receive a documentation link to help you understand how to use the API endpoints.

If there are any additional steps required for integrating the app into an external service or frontend, make sure to follow those instructions carefully. This may include adding the app's server link to an external tool or configuring API endpoints as needed.

Remember, the Lazy platform handles all the heavy lifting, so you can focus on building and integrating your software applications with ease.

Happy building with the Prompt Generator Template on Lazy!

Category
Technology
Last published
June 15, 2024

More templates like this

FALLBACK | Flask, HTML, JS and Tailwind Based Website

This is a good starting point for styled website. It has a header, footer. Has Tailwind and Flowbite loaded so you can build nice looking pages from here.

Flask
HTML

FALLBACK LATEST 1 THEME | Flask, HTML, JS and Tailwind Based Website

This is a good starting point for styled website. It has a header, footer. Has Tailwind and Flowbite loaded so you can build nice looking pages from here.

Flask
HTML

Job Search Website

A customisable one-page job search website with a search bar and a search button that displays UI cards of matching jobs. You need to have a (free) account on https://rapidapi.com/ to get the API key required for this to work.

React JS
Python
Flask
HTML
CSS
Home
/
Prompt Generator Template