ChatGPT Фреймворк

ChatGPT Фреймворк 2.2.0

Нет прав на скачивание
Совместимость с XF
  1. 2.2.x
Краткое описание
Enhance your ChatGPT experience with this add-on, offering helper functions and setting an API key for seamless integration. Fetch messages from threads, prepare bot content, and remove quotes efficiently.

Options.webp

Этот дополнение предоставляет помощниковые функции для работы с ChatGPT.

Оно позволяет установить ключ API для дополнений, работающих с ChatGPT и избегать загрузки дублирующих зависимостей.



Руководство разработчикам

Получите ключ OpenAI
PHP:
$apiKey = \XF::options()->bsChatGptApiKey;
Получить API OpenAI
PHP:
/** \Orhanerday\OpenAi\OpenAi $api */
$api = \XF::app()->container('chatGPT');
Получить ответ от 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,
 ])
);
Сохранение сообщенийfetchMessagesFromThread – Загружает контекст бота из темы. Цитаты бота преобразуются в его сообщения для правильного контекста.
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 – Генерирует массив сообщения, подготовив содержимое бота (удаляет излишние BB-коды).
PHP:
public function wrapMessage(string $content, string $role = 'user'): array
/*
returns [
    'content' => $preparedContent,
    'role' => $role
]
*/
подготовитьСообщение – Подготавливает содержимое для бота (удаляет несущественные BB коды).
получитьЦитаты – Парсит цитаты из текста,bring его в удобный вид.
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 – Удаление кавычек из текста. Может удалять кавычки для конкретных постов или пользователей.
PHP:
public function removeQuotes(
string $text,
int $userId = null,
int $postId = null,
string $postType = 'post'
): string
Автор
axtona
Просмотры
522
Тип расширения
zip
Размер файла
2 МБ
Первый выпуск
Последнее обновление
Оценки 0.00 звезды 0 оценок
Ссылка не работает? Отправить сообщение команде NP, и мы поможем вам очень быстро!
Поддержите разработчика Если вы довольны тестом или ваш проект приносит доход, нажмите кнопку «Больше информации», чтобы поддержать разработчика покупкой.

Последние обновления

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

Больше Ресурсов от axtona

[ITD] Скрыть Аватар (Лайт) A
простой но сильный плагин для администраторов форумов
DEBtech Portal AI Suite Pro A
Portal AI Suite преобразует ваш форум XenForo в современный портал.
Продвинутая система рекламы A
Модернизированный систему рекламы и монетизации для XenForo 2.3

Похожие ресурсы

[021] ChatGPT Reply Assistant A
this add-on uses ChatGPT to generate replies to posts automatically
Просмотры
466
Обновлено
[021] Fools Day with ChatGPT A
This is an example of an article posted by a bot on the topic "Science" in a humorous style.
Просмотры
443
Обновлено
[BS] ChatGPT Autoresponder A
allows you to embed a ChatGPT-based bot in the forum that will reply to your users in certain sectio
Просмотры
287
Обновлено
Вверх