[021] ChatGPT Framework

[021] ChatGPT Framework 2.2.0

Free Download via Daily Lucky Task
XF Compatibility
  1. 2.2.x
Summary
This add-on provides helper functions to work with ChatGPT, including setting an API key and managing messages for context.
Options.webp

Helper functions to work with ChatGPT, including setting an API key and managing messages for context

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
axtona
Views
644
Extension type
zip
File size
2 MB
First release
Last update
Latest file name
BS-ChatGPTFramework-2.2.0.zip
MD5
0cb3ddf43e65f1d0115baa77974b681d
VirusTotal
View report
Ratings 0.00 star(s) 0 ratings
Link was Broken? Send message to the Website Team and we will assist you quickly!
Support Developer If you are satisfied with the test or your project has earned you money, Click the More Information button to support the developer by purchasing.

Latest updates

  1. 2.2.0 - change log
    Fix: Exception when creating alias for class \BS\ChatGPTFramework\Enums\JsonSchema\Type New methods in MessagesDTO: map...
  2. 2.1.1 - changelog
    Fix: Backward compatibility
  3. 1.6.0 - changelog
    Support for function calling

More resources from axtona

Job & Cron Monitor A
The "CLI Job Runner" add-on for XenForo allows users to manually run and monitor their job queues and cron...
[DI] ForumBot A
ForumBot is an AI-powered managed service that integrates seamlessly into existing forums, providing...
Admin API: read-only operational endpoints A
This product provides read-only API endpoints for XenForo forums to expose system diagnostics such as...

Similar resources

[021] ChatGPT Reply Assistant A
This add-on automatically generates relevant and intelligent replies to forum posts using the advanced...
[021] Fools Day with ChatGPT A
This download allows users to create and publish humorous and satirical articles about April Fool's Day as...
[021] Account switcher A
The product is an account switcher tool provided by NullPro, allowing users to easily manage and switch...
Back
Top