📢 重要通知 🚀

网站重新整理了一下,清除了沉余数据,目前开放免费任何资源下载 🙂. 网站等待xenforo 2.4 大更新版本后再花精力设计网站.

[021] ChatGPT Framework

[021] ChatGPT Framework 2.1.1

没有下载权限
  • 修复:向后兼容性
  • 支持函数调用
  • 流式传输机器人的响应时,可能会错过"0"等字符。
  • 消息存储库:能够从个人资料帖子中获取评论
  • 流回复支持(稍后将在开发指南中更新)
getReplyWithLogErrors(OpenAi $api,数组 $params): 字符串 – 接收响应并将其解析为从 OpenAI API 回复,记录故障并将必要的信息添加到日志中。

PHP:
$reply = Response::getReplyWithLogErrors($api, [
    'model'             => 'gpt-3.5-turbo',
    'messages'          => [],
    'temperature'       => 1.0,
    '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
]
*/
prepareContent

– 为机器人准备消息内容(删除不必要的 BB 代码)。
– 解析文本中的引文,使其采用方便的形式。
getQuotes
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
后退