Skip to content

redhatpanda/BetterPrompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BetterPrompt Extension

This project is an extension using Azure Functions and JavaScript. It consists of a backend service that processes speech and text using various Azure AI services and a frontend web application.

Project Overview

πŸ“Œ Overview

BetterPrompt is a smart Chrome extension built to enhance digital communication by making user input clearer, more concise, and contextually accurateβ€”whether you're typing, speaking, or on the move. Designed for ease of use and accessibility, BetterPrompt empowers users from all backgrounds, including non-native speakers and individuals with writing disabilities, to communicate more effectively across any website.

Built with React and Material-UI (MUI) for a sleek, responsive interface, and powered by Azure Cognitive Services, the extension provides real-time grammar correction, translation, speech-to-text input, and prompt optimization. BetterPrompt integrates directly into text input fields on any webpage and improves both the quality of search queries and AI interactionsβ€”helping users get better results, faster.


🧠 Key Capabilities

  • Grammar & Clarity Enhancements: Real-time grammar correction and sentence restructuring.

  • Prompt Optimization: Refines prompts for search engines and AI tools like ChatGPT.

  • Speech-to-Text Input: Enables hands-free communication through Azure Speech.

  • Language Translation: Accurately translates input to and from multiple languages.

  • Content Moderation: Flags harmful, biased, or sensitive content and suggests ethical alternatives.

  • Accessible UI: Clean, responsive React + MUI interface that overlays any text field on a webpage.


🎯 Goals

  • Help users communicate clearly, quickly, and effectivelyβ€”regardless of language fluency or ability.

  • Make digital spaces more accessible to users with writing or speech-related disabilities.

  • Support global, multilingual communication with accurate translation and optimization.

  • Improve the quality of user inputs for AI interactions and search results.

  • Promote safe, ethical, and inclusive online communication through intelligent moderation.


πŸ”­ Vision

BetterPrompt aims to evolve into a universal communication assistant that:

  • Integrates with virtual assistants, messaging tools, and productivity platforms.

  • Offers tone adjustment, prompt intent detection, and smart writing suggestions.

  • Becomes a default accessibility and clarity enhancer for the web and mobile environments.


Presentation and Demo Link

BetterPrompt Presentation Link

BetterPrompt Demo Link


πŸ›  Tech Stack

  • Frontend: React, Material-UI (MUI)

  • Browser Platform: Chrome Extension API

  • Speech & Text Processing: Azure Cognitive Services (Text Analytics, Translator, Speech-to-Text)

  • Backend (Planned): Azure Functions or Node.js for processing user input

Project Structure

πŸ“¦ project-root
β”œβ”€β”€ πŸ“‚ backend_service
β”‚   β”œβ”€β”€ πŸ“‚ AnalyzePrompt
β”‚   β”œβ”€β”€ πŸ“‚ SpeechToText
β”‚   β”œβ”€β”€ πŸ“„ host.json
β”‚   β”œβ”€β”€ πŸ“„ local.settings.json
β”‚   └── πŸ“„ package.json
β”œβ”€β”€ πŸ“‚ web
β”‚   β”œβ”€β”€ πŸ“‚ src
β”‚   β”œβ”€β”€ πŸ“‚ public
β”‚   β”œβ”€β”€ πŸ“„ index.html
β”‚   β”œβ”€β”€ πŸ“„ package.json
β”‚   └── πŸ“„ README.md
└── πŸ“„ README.md

Project Architecture

Click To Expand
+---------------------------------+
|       User Input (Text/Voice)   |
|---------------------------------|
| - Chrome Extension detects input|
| - Voice Input processed via     |
|   Azure Speech-to-Text          |
+---------------------------------+
                |
                v
+---------------------------------+
|       Azure Functions           | 
| - Serverless backend processing |
| - Triggers various Azure APIs   |
+---------------------------------+
                |
                v
+---------------------------------+
|       Azure OpenAI (GPT)        |
| - Refines input for clarity,   |
|   conciseness, and grammar     |
| - Optimizes AI queries         |
+---------------------------------+
                |
                v
+---------------------------------+     +---------------------------------+
|      Azure Content Safety      |<--->|     Azure Translator           |
| - Detects harmful content,     |     | - Translates text input into   |
|   bias, or offensive language  |     |   desired language            |
| - Suggests ethical alternatives|     +---------------------------------+
+---------------------------------+
                |
                v
+---------------------------------+
|       Azure Speech (optional)  |
| - Converts optimized text to   |
|   speech (Text-to-Speech)      |
+---------------------------------+
                |
                v
+---------------------------------+
|     Chrome Extension UI        |
| - Displays optimized input     |
| - Provides feedback to the user|
| - Suggests improvements or     |
|   alternative phrasing         |
+---------------------------------+

Technologies Used

  • Azure Functions
    • AnalyzePrompt
    • SpeechToText
  • Azure AI Services
    • Azure OpenAI
    • Azure Content Safety
    • Azure Translator
    • Azure Speech
  • Frontend
    • JavaScript (React/Vanilla JS)
    • Azure integration

Backend Service

1. AnalyzePrompt

  • Processes input text using Azure OpenAI.
  • Ensures safe content using Azure Content Safety.
  • Supports translation via Azure Translator.

2. SpeechToText

  • Converts audio to text using Azure Speech Service.
  • Outputs transcribed text for further analysis.

Setup Instructions

Prerequisites

  • Node.js (Latest LTS)
  • Azure Functions Core Tools
  • Azure CLI
  • A configured Azure Subscription with required services
Installation 1. Clone the repository: ```sh git clone https://github.com/your-repo.git cd project-root ```
  1. Install dependencies for the backend:

    cd backend_service
    npm install
  2. Install dependencies for the frontend:

    cd ../web
    npm install
Running Locally

Backend:

  1. Navigate to the backend_service folder:

    cd backend_service
  2. Start the Azure Functions locally:

    func start

Frontend:

  1. Navigate to the web folder:

    cd web
  2. Start the development server:

    npm run dev
Deployment

Backend:

  1. Login to Azure:

    az login
  2. Deploy Azure Functions:

    func azure functionapp publish <YourFunctionAppName>

Frontend:

  1. Deploy frontend (if using Azure Static Web Apps):
    az staticwebapp create --name <YourWebAppName> --resource-group <YourResourceGroup> --source ./web --branch main --location <YourRegion>

Environment Variables

Go to local.settings.json file in backend_service and put the values of these environment variables:

    "OPENAI_ENDPOINT": "",
    "OPENAI_API_KEY":"",
    "CONTENT_SAFETY_ENDPOINT": "",
    "CONTENT_SAFETY_API_KEY"="",
    "AZURE_TEXT_ANALYTICS_ENDPOINT": "",
    "AZURE_TEXT_ANALYTICS_API_KEY":"",
    "AZURE_TRANSLATOR_ENDPOINT": "",
    "AZURE_TRANSLATOR_API_KEY":""
  

Contributing

Feel free to submit issues or contribute to the project.

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •