[021] ChatGPT Framework 2.2.0

XF 2.0 / 2.1 / 2.2 / 2.3 [021] ChatGPT Framework 2.2.0

Add-on xenforo 2

Ressources et modules complémentaires pour XenForo 2

Styles xenforo 2

Styles / Thèmes et apparence pour xenforo 2

Templates xenforo 2

Codes pour modifier les templates sur xenforo 2

Section Premium

Add-on et Styles pour membre Premium
[021] ChatGPT Framework 2.2.0

XF 2.0 / 2.1 / 2.2 / 2.3 [021] ChatGPT Framework 2.2.0

Catégorie Catégorie Add-Ons
Titre du sujet Titre du sujet [021] ChatGPT Framework 2.2.0
Auteur de la discussion Auteur de la discussion laurent68
Date de début Date de début
Réponses Réponses 16
Affichages Affichages 808
Réaction Réaction 1
Dernier message par Dernier message par susl16c

laurent68

Fondateur

Staff
fondateur
Réputation: 100%
Discussions
4 647
Messages
12 059
Solutions
81
J'aime
7 613
Points
198

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,
    ])
);

Options.png


Télécharger V1.0.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
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
Télécharger V1.1.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 1.2.0 :

\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.

Télécharger V1.2.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 1.3.0 :

- The group of settings has been renamed in accordance with the name of the add-on
- New method removeMessageDuplicates in message repo
- New method fetchMessagesFromConversation in message repo
- Now \BS\ChatGPTBots\Response::getReplyWithLogErrors accept $throwExceptions argument to throw exceptions on error instead of returning default reply
- Now the prepareContent method in message also converts mentions into hits

Télécharger V1.3.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 1.4.0 : Stream replies support (Will be updated in dev guide later)

Télécharger V1.4.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 1.5.0 : Message repo: Ability to fetch comments from profile post.

Télécharger V1.5.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 1.5.1 Fixed : When streaming the bot's response, characters such as "0" could be missed

Télécharger V1.5.1 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 1.6.0 :
- Support for function calling
ModeleFilmowe, Gucci, akok and 1 other person

Télécharger V1.6.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 2.0.0 Huge Refactoring!
  • Codebase update to improve the developer experience with the ChatGPT API
  • Vision support in the message repository
  • New DTOs to simplify API work with OOP
Big Note
This version is not compatible with add-ons running on ChatGPTFramework 1.0

Version 2.0.1 Fix : Sanitizing of usernames in messages.

Version 2.1.0 Changes :​

- JSON Schema generation has been moved to the 021/json-schema package with more extensive functionality

Télécharger V2.1.0 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 2.1.1 Fix : Backward compatibility

Télécharger V2.1.1 :
Vous devez répondre avant de pouvoir voir le contenu des données cachées.
Version 2.2.0 :
– Fix: Exception when creating alias for class \BS\ChatGPTFramework\Enums\JsonSchema\Type
– New methods in MessagesDTO: map, mapKeepContentStringForRoles, toModerationInput, transformDeprecatedRoles, transformRoles
– New MessageRole: DEVELOPER
– New method in ChatWrapper: moderate(array $input, string $model = 'omni-moderation-latest')

Télécharger V2.2.0 :
Pour voir ce contenu caché, votre nombre de messages doit être supérieur ou égal à 20.
 
Dernière édition:
Ajout de la version 1.1.0 :)
 
Ajout de la version 1.2.0 :)
 
Ajout de la version 1.3.0 :)
 
Ajout de la version 1.4.0 :)
 
Ajout de la version 1.5.0 :)
 
Ajout de la version 1.5.1 :)
 
Ajout de la version 1.6.0 :)
 
Ajout de la version 2.1.0 :)
 
Ajout de la version 2.1.1 :)
 
Ajout de la version 2.2.0 :)
 
Sujets similaires Les plus vues Voir plus
Retour
Haut Bas