# 工具方法

为了方便接入和调试,我们提供了一些工具类 API,你可以根据情况自行选择。

# EnableLogging()

是否打开日志

FAIHelpForUEModule::Get().GetAIHelp()->EnableLogging(true);

# GetSDKVersion()

获取当前 AIHelp 版本信息

FString sdkVersion = FAIHelpForUEModule::Get().GetAIHelp()->GetSDKVersion();

# IsAIHelpShowing()

当前展示的是否为 AIHelp 页面

bool isShowing = FAIHelpForUEModule::Get().GetAIHelp()->IsAIHelpShowing();

# SetOnSpecificUrlClickedCallback()

利用此 API 来接管某个超链接的点击事件,具体配置方法如下:

1、为超链接配置 js-bridge=enable 参数,如:https://www.google.com?js-bridge=enable

2、设置回调来接管配置了 js-bridge=enable 的超链接的点击事件:

void onSpecificUrlClickedCallback(const char* url) {
    // You can get the callback when user closed the AIHelp page
}
FAIHelpForUEModule::Get().GetAIHelp()->SetOnSpecificUrlClickedCallback(onSpecificUrlClickedCallback);

# SetOnAIHelpSessionOpenCallback()

注册 AIHelp 页面打开的回调通知:

void onAIHelpSessionOpened() {
    // You can get the callback when user closed the AIHelp page
}
FAIHelpForUEModule::Get().GetAIHelp()->SetOnAIHelpSessionOpenCallback(onAIHelpSessionOpened);

# SetOnAIHelpSessionCloseCallback()

注册 AIHelp 页面关闭的回调通知:

void onAIHelpSessionClosed() {
    // You can get the callback when user closed the AIHelp page
}
FAIHelpForUEModule::Get().GetAIHelp()->SetOnAIHelpSessionCloseCallback(onAIHelpSessionClosed);

# SetOnOperationUnreadChangedCallback()

注册运营文章更新时的回调通知:

void onOperationUnreadChanged(hasUnreadArticles) {
    // You can get the callback when user closed the AIHelp page
}
FAIHelpForUEModule::Get().GetAIHelp()->SetOnOperationUnreadChangedCallback(onOperationUnreadChanged);

# AdditionalSupportFor()

为以下国家或地区提供额外的域名支持:

  • 印度地区
  • 中国大陆地区

需要注意的是,此方法必须在 init 开始之前调用,如下所示:

if (USER_FROM_MAINLAND_CHINA) {
  FAIHelpForUEModule::Get().GetAIHelp()->AdditionalSupportFor(EAIHelpPublishCountryOrRegion::China);
}
FAIHelpForUEModule::Get().GetAIHelp()->Init(
    "THIS IS YOUR APP KEY",
    "THIS IS YOUR APP DOMAIN",
    "THIS IS YOUR APP ID",
    "THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)"
);
上次更新: 11/9/2023, 2:59:49 AM