WGOD!

The general member portfolio consists of software developers, company owners and investors. Our mission is to ensure that all shared content is clean and functional. For this reason, unfortunately, not every member is accepted. Please do not attempt to register for 1 software or 1 theme, membership is paid. You can join our telegram group below or send an e-mail to [email protected] to purchase the invite code for 10$.

Join Telegram
xNull

XF 2 [021] ChatGPT Framework 1.5.1

No permission to download
Support XF Version
2x
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
IRONSIDE
WarezM
this slowpoke moves Supporter
Downloads
0
Views
100
Last update
Rating
0.00 star(s) 0 ratings
Guest
Help Users
  • No one is chatting at the moment.
  • aLeech:
    Guest Hacker_Hayalet has joined the room.
  • (Guest) Hacker_Hayalet:
    Selamlar
    Quote
  • aLeech:
    Guest satoshiiii has joined the room.
  • (Guest) satoshiiii:
    hello
    Quote
  • (Guest) satoshiiii:
    I'm looking for carrier disable module for prestashop 1.7
    Quote
  • aLeech:
    Guest ipranesx has joined the room.
  • (Guest) ipranesx:
    Selam phptema scripti lazım atabilicek varsa Telegram ismim aynı ipranesx
    Quote
    (Guest) ipranesx: Selam phptema scripti lazım atabilicek varsa Telegram ismim aynı ipranesx
    Back
    Top