Michael Ikehi 12e0830ba6 feat(feedback): Add content improvement feedback system
Frontend (frontend/app.js):

- Add textarea for improvement feedback

- Add submit button with loading state

- Handle API response and display improved content

Backend (backend/copywriter.py):

- Add improve_copy() method using Cohere API

- Integrate retry mechanism for API calls

Backend (backend/main.py):

- Add /improve-content POST endpoint

- Implement error handling and return improved content with metadata

Testing:

- Verified feedback submission flow

- Confirmed improved content generation

- Tested error scenarios and loading states
2025-04-18 17:57:35 +01:00

Marketing Assistant AI

A comprehensive AI-powered tool designed to streamline the process of ideation, copywriting, and marketing campaign creation for Adriana James. This system generates high-quality marketing content that maintains brand consistency while significantly reducing content creation time.

🌟 Features

  • AI-Powered Content Generation: Create marketing content for various channels with customizable parameters
  • Brand Voice Consistency: Ensure all content adheres to Adriana James' unique brand tone and style
  • Vector Search: Find similar past content for reference and inspiration
  • Content Improvement: Refine generated content based on specific feedback
  • Brand Style Management: Configure and update brand guidelines through a user-friendly interface
  • Training Data Management: Add successful marketing content to improve the AI over time
  • Content Performance Analysis: Get insights into the potential effectiveness of your content

📋 Project Overview

The Marketing Assistant AI combines a powerful backend built with FastAPI and a clean, intuitive frontend interface. It leverages advanced AI models through the Cohere API for text generation, embeddings, and reranking.

Tech Stack

  • Backend: Python with FastAPI
  • Frontend: Vanilla HTML, CSS, and JavaScript
  • AI Models: Cohere's generation and embedding models
  • Vector Database: FAISS for efficient content similarity search
  • Storage: Local JSON files for historical marketing data

🚀 Getting Started

Prerequisites

  • Python 3.9+
  • Node.js and npm (optional, for development tools)
  • Cohere API key

Installation

  1. Clone the repository
git clone http://23.29.118.76:3000/michael/marketing-assistant-ai.git
cd marketing-assistant-ai
  1. Set up the backend
cd backend
pip install -r requirements.txt
  1. Configure environment variables

Create a .env file in the project root with the following variables:

# API Keys
COHERE_API_KEY=your-api-key-here

# LLM Configuration
LLM_MODEL=llm-model-name # e.g., command
LLM_API_KEY=your-api-key-here # if using a custom model

# Server Configuration
API_HOST=localhost
API_PORT=8000

# Database Configuration
VECTOR_DB_PATH=./data/vector_store
HISTORY_DB_PATH=./data/history.db

# Brand Configuration
BRAND_NAME=Adriana James
  1. Start the backend server
cd backend
python main.py

The API will be available at http://localhost:8000

  1. Serve the frontend

You can use any static file server. For development, Python's built-in HTTP server works well:

cd frontend
python -m http.server 3000

The frontend will be available at http://localhost:3000

🔧 Usage

Generating Content

  1. Navigate to the "Generate" tab in the web interface
  2. Enter your content prompt (e.g., "Write a social media post about our new coaching program")
  3. Select optional parameters (content type, tone, length)
  4. Click "Generate" and wait for the AI to create your content
  5. Review, improve, and save the generated content

Managing Brand Style

  1. Go to the "Brand Style" tab
  2. Configure tone options and voice characteristics
  3. Add or remove taboo words
  4. Define preferred terminology
  5. Save the updated brand style

Adding Training Data

  1. Visit the "Training" tab
  2. Select the content type
  3. Enter your high-performing marketing content
  4. Add performance metrics if available
  5. Submit the training data to improve the AI over time

📁 Project Structure

Marketing_Assistant_AI/
│-- backend/
│   │-- main.py                # FastAPI application
│   │-- copywriter.py          # AI content generation
│   │-- vector_store.py        # FAISS vector database
│   │-- embeddings.py          # Cohere embeddings
│   │-- brand_style.py         # Brand style management
│   │-- config.py              # Configuration settings
│   │-- requirements.txt       # Python dependencies
│
│-- data/
│   │-- past_campaigns/        # Stored marketing campaigns
│   │-- user_queries/          # Query history
│   │-- style_guidelines/      # Brand style config
│   │   │-- brand_style.json   # Default style guidelines
│
│-- frontend/
│   │-- index.html             # Main HTML page
│   │-- styles.css             # CSS styles
│   │-- app.js                 # Frontend functionality
│
│-- docs/
│   │-- README.md              # Developer documentation
│   │-- API_Documentation.md   # API reference
│
│-- .env                       # Environment variables
│-- .gitignore                 # Git ignore rules
│-- LICENSE                    # License information
│-- README.md                  # This file

🔄 API Endpoints

The backend provides several RESTful API endpoints:

Endpoint Method Description
/generate-copy POST Generate marketing content
/brand-style GET Retrieve brand style guidelines
/brand-style PUT Update brand style guidelines
/training-data POST Add new training data
/training-data GET List available training data
/training-data/{id} GET Get specific training document
/training-data/{id} DELETE Delete training document
/improve-content POST Improve content based on feedback
/analyze-content POST Analyze content performance

For detailed API documentation, see API Documentation.

💡 How It Works

  1. Content Generation Process

    • User submits a content request
    • System formats the prompt with brand style guidelines
    • Similar past content is retrieved from the vector database
    • The AI generates content using the formatted prompt and references
    • The system checks alignment with brand guidelines
    • Final content is returned with alignment score and suggestions
  2. Brand Style Management

    • Brand style guidelines are stored in JSON format
    • The system uses these guidelines to format prompts for the AI
    • Content is checked against taboo words and preferred terminology
    • An alignment score is calculated based on adherence to guidelines
  3. Vector Search

    • Marketing content is converted to vector embeddings using Cohere
    • FAISS enables efficient similarity search across thousands of documents
    • Similar content is reranked based on relevance to the query

🛠️ Development

Backend Development

The backend is built with FastAPI and follows a modular architecture:

  • main.py: API endpoints and request handling
  • copywriter.py: Core AI content generation
  • vector_store.py: Vector database operations
  • embeddings.py: Embedding generation and reranking
  • brand_style.py: Brand style management
  • config.py: Configuration settings

Frontend Development

The frontend is built with vanilla HTML, CSS, and JavaScript:

  • index.html: Main application structure and UI components
  • styles.css: Styling and responsive design rules
  • app.js: User interactions and API integration

🔍 Future Enhancements

  • User authentication and role-based access
  • Content performance analytics dashboard
  • A/B testing capabilities
  • Integration with marketing platforms
  • Custom model fine-tuning for even better results
  • Mobile application

👥 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

👏 Acknowledgements


Made with ❤️ for Adriana James

S
Description
No description provided
Readme 545 KiB
Languages
Python 44.4%
JavaScript 28%
HTML 15.8%
CSS 11.8%