• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Resource icon

[021] ChatGPT Framework v1.50

No permission to download
Message repo: Ability to fetch comments from profile post
tks @ubaid
  • Love
  • Like
Reactions: dsvcam and Babak
Stream replies support (Will be updated in dev guide later)
  • Love
Reactions: Babak
\BS\ChatGPTBots\Response class features
getReplyWithLogErrors(OpenAi $api, array $params): string – Receives a response and parse it to reply from the OpenAI API, logging the failure and adding the necessary information to the log.

Usage example:

PHP:
$reply = Response::getReplyWithLogErrors($api, [
    'model'             => 'gpt-3.5-turbo',
    'messages'          => [],
    'temperature'       => 1.0,
    'frequency_penalty' => 0,
    'presence_penalty'  => 0,
]);
Fixed
\BS\ChatGPTBots\Repository\Message::fetchMessagesFromThread – the startPosition and stopPosition arguments were ignored if they were 0

Other changes
The add-on has been renamed to [021] ChatGPT Framework.
  • Love
Reactions: Babak and Caly
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
  • Love
Reactions: Babak and Caly
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock