[021] ChatGPT Framework

[021] ChatGPT Framework 1.5.1

No permission to download
Author jessy
Creation date
XF Compatibility
  1. 2.1.x
  2. 2.2.x
Headline
This add-on provides helper functions for working with ChatGPT.
Short Description
FREE Download Premium and Nulled [021] ChatGPT Framework 1.5.1 version from NullPro Community. It is zip Extention type and 123.8 KB File size. From [021] ChatGPT Framework have 1 Description Attachments, 4 discussion, 4 Updates, 216 Views.
Options.png

This add-on provides helper functions for working with ChatGPT.

It allows you to set an API key for add-ons that work with ChatGPT and avoid loading duplicate dependencies.

Developer usage guide

Get the OpenAI API key
PHP:
$apiKey = \XF::options()->bsChatGptApiKey;
Get OpenAI API
PHP:
/** \Orhanerday\OpenAi\OpenAi $api */
$api = \XF::app()->container('chatGPT');
Get reply from ChatGPT
PHP:
use BS\ChatGPTBots\Response;

/** \Orhanerday\OpenAi\OpenAi $api */
$api = \XF::app()->container('chatGPT');

$messages = [
['role' => 'user', 'content' => 'Hello!']
];
$reply = Response::getReply(
$api->chat([
'model'             => 'gpt-3.5-turbo',
'messages'          => $messages,
'temperature'       => 1.0,
'max_tokens'        => 420,
'frequency_penalty' => 0,
'presence_penalty'  => 0,
 ])
);
Message repository

fetchMessagesFromThread – Loads the context for the bot from the topic. Bot quotes are transformed into his messages for the correct context.
PHP:
public function fetchMessagesFromThread(
Thread $thread,
int $stopPosition = null, // Thread post position to which to load the context
?User $assistant = null, // Bot user to mark his messages in context
bool $transformAssistantQuotesToMessages = true, // If false, bot message quote messages will not be transformed into his messages
int $startPosition = null, // Thread post position from which to load the context
bool $removeQuotesFromAssistantMessages = true // Removes user post quotes from bot posts
)
wrapMessage – Generates a message array, preparing content for the bot (removes unnecessary BB codes).
PHP:
public function wrapMessage(string $content, string $role = 'user'): array
  
/*
returns [
    'content' => $preparedContent,
    'role' => $role
]
*/
prepareContent – Prepare message content for the bot (removes unnecessary BB codes).
getQuotes – Parses quotes from the text, bringing it to a convenient form.
PHP:
public function getQuotes(
string $text,
int $userId = null, // filter quotes by user id
int $postId = null, // filter quotes by post id
string $postType = 'post' // post type in quotes
): array
/*
returns [
    [
        'post_id' => int|null,
        'user_id' => int|null,
        'content' => string|null, (quote content)
        'message' => string|null, (reply on quote, text which located below quote)
        'match'   => string (full quote match)
    ]
]
*/
removeQuotes – Remove quotes from the text. Can be remove quotes for specific posts or users.
PHP:
public function removeQuotes(
string $text,
int $userId = null,
int $postId = null,
string $postType = 'post'
): string
Author
jessy
Views
216
Extention type
zip
File size
123.8 KB
First release
Last update
Rating
0.00 star(s) 0 ratings
Link was Broken? Please  Send Message to NP Team with Ticket, You will get it very quickly!
Support Developer If you are satisfied with your test or project have earn money successfully, Maybe you can click more information button to support with buying.
More resources from jessy

Latest updates

1.5.1 - changelog
When streaming the bot's response, characters such as "0" could be missed.
1.5.0 - changelog
Message repo: Ability to fetch comments from profile post
1.4.0 - changelog
Stream replies support (Will be updated in dev guide later)
1.3.0 - changelog
The group of settings has been renamed in accordance with the name of the add-on New method...

Similar resources

[021] ChatGPT Bots J
This add-on provides helper functions for working with ChatGPT.
0.00 star(s) 0 ratings
Views
116
Updated
[021] ChatGPT Reply Assistant J
this add-on uses ChatGPT to generate replies to posts automatically
0.00 star(s) 0 ratings
Views
152
Updated
[021] Fools Day with ChatGPT J
This is an example of an article posted by a bot on the topic "Science" in a humorous style.
0.00 star(s) 0 ratings
Views
159
Updated
Back
Top