Updated documentation.

This commit is contained in:
privet.fun 2023-10-01 16:16:42 -07:00
parent 177d396c6d
commit 8a9a15a8ac
6 changed files with 76 additions and 12 deletions

View file

@ -1,16 +1,31 @@
# AI Labs v 1.0.5
##### [Changelog](#changelog_link)
Incorporate AI into your phpBB board and get ready for an exciting experience.
Currently supported ChatGPT, DALL-E (OpenAI) and Stable Diffusion (Stability AI).
Midjourney support coming soon.
Currently supported Midjourney, ChatGPT, DALL-E (OpenAI) and Stable Diffusion (Stability AI).
Examples:
# Table of Contents
1. [Examples](#examples)
2. [Requirements](#requirements)
3. [Important notes](#important-notes)
4. [Installation](#installation)
5. [Midjourney setup](#midjourney-setup)
6. [ChatGPT setup ](#chatgpt-setup)
7. [ChatGPT advanced setup](#chatgpt-advanced-setup)
8. [DALL-E setup](#dall-e-setup)
9. [DALL-E advanced features](#dall-e-advanced-features)
10. [Stable Diffusion setup](#stable-diffusion-setup)
11. [Troubleshooting](#troubleshooting)
12. [Support and suggestions](#support-and-suggestions)
13. [Changelog](#changelog)
14. [License](#license)
## Examples
- [Midjourney](https://privet-fun.translate.goog/viewtopic.php?t=3404&_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp)
- [ChatGPT](https://privet.fun/viewtopic.php?t=2802)
- [ChatGPT, custom prompt](https://privet.fun/viewtopic.php?t=2799)
- [DALL-E](https://privet.fun/viewtopic.php?t=2800)
- [Stable Diffusion by Stability AI](https://privet.fun/viewtopic.php?t=2801)
- [Midjourney, coming soon 🚀](https://privet.fun/viewtopic.php?t=2718)
- [Stable Diffusion by Leonardo AI, coming soon 🚀](https://privet.fun/viewtopic.php?t=2605)
Also available as Telegram bot https://t.me/stable_diffusion_superbot
@ -31,16 +46,47 @@ Examples:
Go to `ACP` > `Posting` > `Manage attachment extensions`, look for `webp`, add it if missing:
![Attachment settings](../privet/ailabs/docs/attachment_webp.png)
Above does not apply to Midjourney, as all generated images are actually stored on your Discord account and served via the Discord CDN.
* If you have extensions installed that require users to log in, such as [Login Required](https://www.phpbb.com/customise/db/extension/login_required) you will need to whitelist `/ailabs/*` and `/app.php/ailabs/*` since AI Labs extension uses callbacks.
* Adjust [PHP configuration](https://www.php.net/manual/en/info.configuration.php) to allow longer script execution. ChatGPT API responses may take up to 90 seconds to respond in certain cases. If you have the default settings, your SQL connection will be closed after 30 seconds, preventing the extension from functioning properly.
Suggested values for `php.ini`:
> max_execution_time = 180
> max_input_time = 90
## Installation
Download https://github.com/privet-fun/phpbb_ailabs and copy `/privet/ailabs` to `phppp/ext` folder:
![Attachment settings](../privet/ailabs/docs/ext_location.png)
If you have a previous version of this extension installed, you will need to disable it and then enable it again after the new version has been copied over.
Go to `ACP` > `Customise` > `Manage extensions` and enable the `AI Labs` extension.
Finally go to `ACP` > `Extensions` > `AI Labs` > `Settings` and add desired AI configurations:
![Attachment settings](../privet/ailabs/docs/ailabs_settings.png)
## Midjourney setup
* You'll need Midjourney Discord and useapi.net accounts with active subscriptions.
Follow instructions at https://www.useapi.net/docs/start-here to setup and verify both.
* Create new board user who will act as AI bot, for our example we will use user `Midjourney`.
Make sure this user account is activated and fully functional.
* Got to `ACP` > `Extensions` > `AI Labs` > `Settings` and add new configuration, select `midjourney` from AI dropdown:
![Attachment settings](../privet/ailabs/docs/midjourney_setup.png)
- Use `Load default configuration/template` to get defaults.
Replace Configuration JSON `api-key`, `discord`, `server` and `channel` with your values.
- Select forums where you want `Midjourney` AI user to reply to new posts and/or to quoted and [@mention](https://www.phpbb.com/customise/db/extension/simple_mentions) (if you are using Simple mentions extension) posts.
* Save changes, navigate to forum configured above and create new post (if you configured `Reply on a post`) or quote/[@mention]() `Midjourney` user:
![Attachment settings](../privet/ailabs/docs/midjourney_example.png)
* Images generated by Midjourney Discord bot via useapi.net stored and served from Discord CDN.
## ChatGPT setup
* You will need OpenAI account, sign up at https://platform.openai.com/.
@ -69,6 +115,7 @@ Finally go to `ACP` > `Extensions` > `AI Labs` > `Settings` and add desired AI c
- `max_tokens`, default 1024, define size reserved for AI reply when quoted
- `prefix`, default empty, can be used to prompt model
- `prefix_tokens`, default 0, copy above `prefix` to https://platform.openai.com/tokenizer to get size of your `prefix` in tokens and update `prefix_tokens` with number returned by tokenizer
- `max_quote_length`, if provided, the quoted response text will be truncated to the number of words defined by the max_quote_length value. Set it to 0 to remove all quoted text entirely.
## ChatGPT advanced setup
@ -111,14 +158,18 @@ AI Labs extension maintains internal logs, you should have admin or moderator ri
You can see entire AI communication history in the log:
![Attachment settings](../privet/ailabs/docs/debugging_log.png)
If Log entry is empty it ususally means that `/ailabs/*` routes blocked by one of phpBB extensions (eg <a href="https://www.phpbb.com/customise/db/extension/login_required">Login Required</a>) and you will need to add `/ailabs/*` to extension whitelist.
If Log entry is empty it ususally means that `/ailabs/*` or `/app.php/ailabs/*` routes blocked by one of phpBB extensions (eg <a href="https://www.phpbb.com/customise/db/extension/login_required">Login Required</a>) and you will need to add `/ailabs/*` or `/app.php/ailabs/*` to extension whitelist.
You can examine Log `response` (JSON) to see details for AI response.
Please feel free to post your quesions or concerns at https://github.com/privet-fun/phpbb_ailabs/issues.
## Support and suggestions
This extension is currently being actively developed. For communication, please use https://github.com/privet-fun/phpbb_ailabs/issues.
## <a name="changelog_link"></a>Changelog
## Changelog
* 1.0.5 October 1, 2023
- Midjourney suppert added
- `max_quote_length` option added for ChatGPT
* 1.0.4 June 4, 2023
- Troubleshooting section added

View file

@ -43,9 +43,20 @@
<script type="text/javascript">
const defaultConfigs = {
"midjourney": {
"url_imagine": "https://api.useapi.net/v1/jobs/imagine",
"url_button": "https://api.useapi.net/v1/jobs/button",
"api_key": "your-useapi.net-key-goes-here",
"discord": "your-discord-token",
"server": "your-discord-server-id",
"channel": "your-discord-channel-id",
"maxJobs": 3,
"retryCount": 80,
"timeoutBeforeRetrySec": 15
},
"chatgpt": {
"api_key": "your-openai-api-key-goes-here",
"url_chat": "https://api.openai.com/v1/chat/completions",
"api_key": "your-openai-api-key-goes-here",
"model": "gpt-3.5-turbo",
"temperature": 0.9,
"max_tokens": 4096,
@ -54,19 +65,20 @@
"frequency_penalty": 0,
"presence_penalty": 0.6,
"prefix": "",
"prefix_tokens": 0
"prefix_tokens": 0,
"max_quote_length": 10
},
"dalle": {
"api_key": "your-openai-api-key-goes-here",
"url_generations": "https://api.openai.com/v1/images/generations",
"url_variations": "https://api.openai.com/v1/images/variations",
"api_key": "your-openai-api-key-goes-here",
"n": 3,
"size": "512x512",
"response_format": "b64_json"
},
"stablediffusion": {
"api_key": "your-stablityai-api-key-goes-here",
"url_texttoimage": "https://api.stability.ai/v1/generation/stable-diffusion-xl-beta-v2-2-2/text-to-image",
"api_key": "your-stablityai-api-key-goes-here",
"cfg_scale": 7.5,
"clip_guidance_preset": "FAST_BLUE",
"height": 512,
@ -83,6 +95,7 @@
}
const defaultTemplate = {
"midjourney": "[quote=\{poster_name\} post_id=\{post_id\} user_id=\{poster_id\}]\{request\}[/quote]\n\{response\}\n\{images\}\n\{info\}",
"chatgpt": "\{info\}[quote=\{poster_name\} post_id=\{post_id\} user_id=\{poster_id\}]\{request\}[/quote]\{response\}",
"dalle": "[quote=\{poster_name\} post_id=\{post_id\} user_id=\{poster_id\}]\{request\}[/quote]\{response\}\{attachments\}",
"stablediffusion": "[quote=\{poster_name\} post_id=\{post_id\} user_id=\{poster_id\}]\{request\}[/quote]\{response\}\{attachments\}",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB