get-response

1.10.1 • Public • Published

Get Response - A terminal-based AI chat-bot

Get-Response is a node.js based command-line interface (CLI) created by Swapnoneel Saha tool that interacts with the Google's Gemini API to generate content based on the user input. This tool allows you to ask questions directly or provide context from files, images or directories, and get the response in a simple and easy to understand interface. Also, you can automate some terminal commands by prompting for the task. And additionally, we also have support for responses from Stack Exchange sites like Stack Overflow

Installation

To install this package, you need to have node.js and npm installed in your machine. If you don't have them installed, you can refer to this article. Once that's done, you can install the package globally by using this command in your terminal:

npm i get-response -g

Usage

Simple Usage

To ask a question directly from the command line (context is not stored for further questions):

npx get-response "<Ask your question>"

Using a File as the Context

To provide additional context about your question, you can use the -f or --file flag followed by the file path:

npx get-response "<Ask your question>" -f ./path/to/your/file.js

Using a PDF as the Context

To provide additional context about your question, you can use the -p or --pdf flag followed by the file path:

npx get-response "<Ask your question>" -p ./path/to/your/pdf.pdf

Using a Directory as the Context

To provide additional context about your question, you can use the -d or --directory flag followed by the name of the directory:

npx get-response "<Ask your question>" -d ./path/to/your/directory

Using an Image as the Context

To provide additional context about your question, you can use the -i or --image flag followed by the name of the image file:

npx get-response "<Ask your question>" -i ./path/to/your/image.png

Note: The image must contain texts, for valid responses!

Chat Mode

In the context-based chat mode, you can ask multiple questions in a session:

npx get-response -c

Alternatively, you can also use:

npx get-response --chat-mode

In the chat mode, the prompt Type your message: will appear, indicating that the tool is ready for you to type your question or command.

To exit the chat mode, type exit and press Enter, also you can access the Stack Exchange mode anytime you want by typing stack and hitting enter.

Also, you can use the chat mode in association with the file, directory and PDF file as the context, using the -f, -d and -p flags respectively.

Terminal Mode

In the terminal mode, you can ask the AI to perform some specific actions and it will automatically execute the commands in your terminal based on your permission:

npx get-response "<Mention your task>" -t

Alternatively, you can also use:

npx get-response "<Mention your task>" --terminal

Get Response from Stack Exchange

You can also ask a question to Stack Exchange and get the response based on the most relevant conversations based on that topic, also you can limit the number of links that you want to see from the response.

npx get-response "Mention your question/problem" -s "maximum number of links"

Alternatively, you can also use:

npx get-response "Mention your question/problem" --search-stack "maximum number of links"

Other than this, we also have a Stack Exchange interface in the live chat mode, and you can switch to it whenever you want by typing stack as a response, while you are on the chat mode. And you will be able to have a conversation with the StackAI. To switch back to the AI chat mode, you can simply type chat as a response, and you'll be back on the interactive chat mode with the context of the previous interactions of the current session!

Generate Workflow of the codebase

Using the mermaid code generator, you can generate the entire workflow of the codebase in a single image file. For that, you can use:

npx get-response -m -f index.js

Alternatively, you can also give directory as a context,

npx get-response -m -d ./src

Example

Asking a Simple Question

npx get-response "What is the currency of South Africa?"

Asking a Question with File Context

npx get-response "Tell me, what is the function of the variable named toggleMode" -f ./index.js

Alternatively, you can also use:

npx get-response "Tell me, what is the function of the variable named toggleMode" --file ./index.js

Asking a Question with PDF Context

npx get-response "What is the summary of the story" -p ./sample.pdf

Alternatively, you can also use:

npx get-response "What is the summary of the story" --pdf ./sample.pdf

Asking a Question with Directory Context

npx get-response "Write unit test cases for each of the functions" -d ./sample-app

Alternatively, you can also use:

npx get-response "Write unit test cases for each of the functions" --directory ./sample-app

Entering the Chat Mode with a File, Directory or PDF Context

npx get-response -c -f ./index.js

Or,

npx get-response -c -d ./sample-app

Or,

npx get-response -c -p ./sample.pdf

Asking to Create a React Application

npx get-response "Create a React application named get-response" -t

Or,

npx get-response "Create a directory named 'hello' and a text file named 'hi' inside it" --terminal

Asking for the solution to a problem from Stack Exchange

npx get-response "How to shutdown a PC from the terminal?" -s 3

Or,

npx get-response "How to copy a file from one directory to another?" --search-stack 10

Contributing

If you want to contribute to this project, please go ahead!! Open an issue or submit a pull request for any improvements, bug fixes or feature implementations.

Bug Reporting

For any questions, suggestions or issues, please open an issue in the GitHub repository.

Package Sidebar

Install

npm i get-response

Weekly Downloads

25

Version

1.10.1

License

CC-BY-NC-SA-3.0

Unpacked Size

37.4 kB

Total Files

3

Last publish

Collaborators

  • swapnoneel