Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sainkee/nosy-chrome-extension

Repository files navigation

LinkedIn AI Assistant

# Description

This code provides a browser extension or user script that leverages Google's Generative AI model (Gemini) to enhance your LinkedIn experience. Here's what it offers:

  • Voice Commands: Speak commands related to LinkedIn actions, and the script will interpret them and potentially generate relevant information.
  • AI-powered Comment Generation: When clicking on a "Reply" button or a comment text input area, an "AI Search" button appears. Clicking this button lets you enter a prompt, and the Gemini AI model will generate a comment suggestion ready to paste.

# Requirements

  • A browser that supports the SpeechRecognition API (window.SpeechRecognition or window.webkitSpeechRecognition).
  • A Google Cloud project with the Google Generative AI API enabled (https://cloud.google.com/products/ai)
  • An API key obtained from the Google Cloud project (replace YOUR_API_KEY in the code)

# Installation

1. Browser Extension (Optional):

  1. Choose a browser extension framework (e.g., Manifest V3).
  2. Include the code from this file in the extension's content script or background script.
  3. Package and install the extension in your browser following the framework's documentation.

2. User Script:

  1. Copy the code from this file.
  2. Create a new userscript file (e.g., linkedin_ai_assistant.user.js) and paste the code into it.
  3. Install a userscript manager extension in your browser (e.g., Tampermonkey, Greasemonkey).
  4. Create a new userscript within the manager and paste the script content.
  5. Save the userscript and enable it for LinkedIn.

# Usage

Voice Commands:

  1. Use the default keyboard shortcut (Ctrl + Space) to activate speech recognition.
  2. Speak a command related to LinkedIn actions (e.g., "Search for profiles with X skills").

AI-powered Comment Generation:

  1. Click on a "Reply" button or a text input area for comments on LinkedIn.
  2. The "AI Search" button should appear next to the input field.
  3. Click the "AI Search" button.
  4. A popup window will appear. Enter a prompt describing the comment you want to generate (e.g., "Ask about their experience in X").
  5. Click the "Geminai " button.
  6. The script will generate a comment suggestion based on your prompt and the context of the post.
  7. Copy and paste the suggested comment into the LinkedIn input field.

# Customization

  • You can modify the keyboard shortcut for voice recognition by changing the handleKeyDown function in the code.
  • The code uses the Gemini-pro model for AI generation. You can experiment with different models provided by the Google Generative AI API (update the model: "gemini-pro" part in the code).

# Ethical Considerations

  • Use the script responsibly and avoid any activities that violate LinkedIn's terms of service.
  • Be aware of potential biases in the AI model's output and review the suggestions carefully before posting.
  • Users should disclose the use of AI-generated content whenever appropriate.

# Disclaimer

This code is provided for educational purposes only. The author is not responsible for any misuse or unintended consequences of its use.

# Explanation of Key Code Sections

  1. Imports:
    • import { GoogleGenerativeAI } from "@google/generative-ai";: Imports the Google Generative AI library for interacting with the Gemini model.
  2. API Key:
    • const API_KEY = "YOUR_API_KEY";: Replace this with your actual Google Cloud API key.
  3. Speech Recognition:
    • The code checks for SpeechRecognition API support and creates an object to capture voice commands. It processes the recognized text and triggers comment generation.
  4. AI Integration:
    • generateResponse and generateLink functions handle interaction with the Gemini model. The script sends the prompt to the model and receives a response.
  5. Comment Generation:
    • When the "AI Search" button is clicked, a popup appears with an input field for the comment prompt. Clicking the "Geminai " button sends the prompt to the Gemini model for comment generation.
    • The generated comment is displayed in the popup and can be copied and pasted into LinkedIn.
  6. Toast Notifications:
    • The createToast function displays informative messages to the user (e.g., success, error).

# Further Enhancements (Optional):

  • Sentiment Analysis: Analyze the original post or comment to determine its mood and

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published