Skip to content

rosswintle/wpai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

=== WP AI Code Companion ===
Contributors: magicroundabout
Tags: ai, openai, generator
Requires at least: 4.5
Tested up to: 6.1.1
Requires PHP: 8.0
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

This plugin gives you a WPAI helper class that generates functions for you using OpenAI.

== DISCLAIMER ==

DO NOT USE THIS PLUGIN!!!

But...

It's not done anything bad for me yet. But then, I've not asked it to to anything bad yet.

If you are brave, curious, and know what you are doing:

You run this code ENTIRELY AT YOUR OWN RISK!!!

You accept ALL responsibility for anything that might happen as a result of using this plugin or running this code, including:

 - your website being broken beyond repair;
 - your laptop or server being wiped of all files;
 - your data being deleted from a database;
 - your passwords being posted to the internet;
 - your cup of tea being too cold;
 - your children being born with three heads;
 - all future Thursdays being cancelled;
 - or ANYTHING that might happen as a result of you using this code.

This code tells an AI of dubious trustworthiness to generate more code and then runs the more code on your computer.

You should not do this.

And if you DO do it, do it on a temporary VPS, or a walled-off temporary site, or an instawp.com site or something. And you do that - and I can't say this strongly enough - entirely at your own risk.

== Description ==

This plugin gives you a WPAI helper class that generates functions for you using OpenAI.

This is a toy/experiment and should not be used on a real website.

You will need an OpenAI account and API key. See the installation instructions below for how to get started.

One set up, you can use the WPAI helper class to generate functions for you. For example:

`WPAI::add_is_awesome_to_all_these_strings( strings: ['WordPress', 'Ross', 'AI'] );`

Notes on using this:

* You do not need to write this function. It is generated for you by the AI.
* The generated function MAY NOT BE CORRECT! It is generated by an AI, after all.
* The function name should be as descriptive as possible. Though the AI is pretty good at working out what you need.
* The function name should be snake_case_with_words_separated_by_underscores.
* You can pass as many arguments as you like. The AI will try to work out what to do with them.
* [Named arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments) (PHP 8.0+) are recommended as they will make the generated code more readable.

When you do this:

* The plugin will create a description of what you want using the function name that you provide and the arguments that you pass.
* The plugin will send this description to the OpenAI API.
* OpenAI will generate a function for you.
* The plugin will save this function to a file in `mu-plugins/` for future use. Calling the same function will not require further API calls!
* The plugin will run the function with the arguments you have passed and return the result.

You can also generate queries using `WPAIU::query()`. For example:

`WPAI::query('3 latest posts from the pages post type that have the metadata test=true and that do not have a meta key called "ignore"');`

This currently only generates the query as text. It does not save or execute it.

== Installation ==

Remember: This plugin will execute arbitrary code provided by a potentially untrustworthy AI. Do not use this plugin on a real website, your own computer, or any computer that you care about. You accept all risk!

1. Upload the plugin AS A MU-PLUGIN to the `/wp-content/mu-plugins/` directory
2. Generate an OpenAI API key. I'm not providing instructions for this because you should only be using this if you know what you are doing.
3. Add `define('WPAI_API_KEY', 'YOUR_API_KEY');` to your `wp-config.php` file.
4. Start writing code!

== ANOTHER DISCLAIMER ==

DO NOT USE THIS PLUGIN!!!

YOU ACCEPT ALL RISK FOR USING THIS PLUGIN!!!

== Changelog ==

= 0.1.0 =

* I wrote a stupid plugin that you should not use.

== Upgrade Notice ==

== REALLY, SERIOUSLY, DON'T USE THIS ==

It's stupid and dangerous.

About

An AI-powered automatic function generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages