> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/long-term-memory/ltm-blueprint-reference.md).

# LTM Blueprint 参考

本参考文档列出了 Convai Unreal Engine 插件中的公共长期记忆接口。LTM 管理节点位于 `Convai|LTM` Blueprint 类别。

对于连接时身份，插件读取 `EndUserID` 是位于 `EndUserMetadata` 来自 `UConvaiChatbotComponent` 通过 `IConvaiConnectionInterface` 当 `StartSession` 会构建连接参数。在调用之前，请在聊天机器人组件上设置这些值 `StartSession`.

### LTM 节点

本页上的所有节点都是异步代理节点。每个节点都会公开 **成功时** 是位于 **失败时** 委托。

#### Convai 创建 Speaker ID

创建一条 Speaker ID 记录。

| 项         | 类型                                                                                          | 说明                           |
| --------- | ------------------------------------------------------------------------------------------- | ---------------------------- |
| **说话人名称** | `FString` input                                                                             | 可读的人类名称。空值会在请求发送前失败。         |
| **设备 ID** | `FString` input                                                                             | 可选的设备标识符。为空时会从请求中省略。         |
| **成功时**   | `FConvaiSpeakerInfo` 委托                                                                     | 返回创建的说话人记录。                  |
| **失败时**   | `FConvaiSpeakerInfo` 委托                                                                     | 返回一个空的 `FConvaiSpeakerInfo`. |
| C++ 工厂    | `UConvaiCreateSpeakerID::ConvaiCreateSpeakerIDProxy(FString SpeakerName, FString DeviceId)` | Blueprint 节点使用的静态工厂。         |

源验证日志 `说话人名称为空` 当 **说话人名称** 为空。

#### Convai 列出 Speaker IDs

列出与已配置 API 密钥关联的 Speaker ID 记录。

| 项       | 类型                                                 | 说明                   |
| ------- | -------------------------------------------------- | -------------------- |
| **成功时** | `TArray<FConvaiSpeakerInfo>` 委托                    | 返回说话人列表。             |
| **失败时** | `TArray<FConvaiSpeakerInfo>` 委托                    | 返回空数组。               |
| C++ 工厂  | `UConvaiListSpeakerID::ConvaiListSpeakerIDProxy()` | Blueprint 节点使用的静态工厂。 |

#### Convai 删除 Speaker ID

删除一条 Speaker ID 记录。

| 项          | 类型                                                                      | 说明                        |
| ---------- | ----------------------------------------------------------------------- | ------------------------- |
| **说话者 ID** | `FString` input                                                         | 要删除的说话人记录标识符。空值会在请求发送前失败。 |
| **成功时**    | `FString` 委托                                                            | 返回响应字符串。                  |
| **失败时**    | `FString` 委托                                                            | 返回 `HTTP 请求失败`.           |
| C++ 工厂     | `UConvaiDeleteSpeakerID::ConvaiDeleteSpeakerIDProxy(FString SpeakerID)` | Blueprint 节点使用的静态工厂。      |

#### Convai 获取 LTM 状态

返回某个角色的 LTM 启用状态。

| 项         | 类型                                                                  | 说明                                   |
| --------- | ------------------------------------------------------------------- | ------------------------------------ |
| **角色 ID** | `FString` input                                                     | 来自 Convai 控制台的角色 ID。空值会在请求发送前失败。     |
| **成功时**   | `bool` 名为的委托 **Status**                                             | 返回 `true` 当 LTM 启用时，以及 `false` 当禁用时。 |
| **失败时**   | `bool` 名为的委托 **Status**                                             | 返回 `false`.                          |
| C++ 工厂    | `UConvaiGetLTMStatus::ConvaiGetLTMStatusProxy(FString CharacterID)` | Blueprint 节点使用的静态工厂。                 |

#### Convai Set LTM Status

通过发送一个为角色启用或禁用 LTM `memorySettings.enabled` 更新。

| 项         | 类型                                                                                | 说明                               |
| --------- | --------------------------------------------------------------------------------- | -------------------------------- |
| **角色 ID** | `FString` input                                                                   | 来自 Convai 控制台的角色 ID。空值会在请求发送前失败。 |
| **B 启用**  | `bool` input                                                                      | `true` 启用 LTM； `false` 禁用它。      |
| **成功时**   | `FString` 委托                                                                      | 返回响应字符串。                         |
| **失败时**   | `FString` 委托                                                                      | 返回代理可用的响应字符串。                    |
| C++ 工厂    | `UConvaiSetLTMStatus::ConvaiSetLTMStatusProxy(FString CharacterID, bool bEnable)` | Blueprint 节点使用的静态工厂。             |

### 数据结构

#### FConvaiSpeakerInfo

| 字段          | 类型        | 类别      | 说明                          |
| ----------- | --------- | ------- | --------------------------- |
| `SpeakerID` | `FString` | `说话人信息` | 用于保存并复用的标识符，作为 `EndUserID`. |
| `名称`        | `FString` | `说话人信息` | Convai 返回的说话人名称。            |
| `DeviceID`  | `FString` | `说话人信息` | Convai 返回的设备标识符。            |

### UConvaiChatbotComponent

Blueprint 显示名称： **Convai 聊天机器人**.

| 成员                    | 类型        | 说明符                                              | 说明                                                                               |
| --------------------- | --------- | ------------------------------------------------ | -------------------------------------------------------------------------------- |
| `EndUserID`           | `FString` | `BlueprintReadWrite`, `EditAnywhere`，类别 `Convai` | 通过连接时通过 `GetEndUserID()`。请在此之前设置 `StartSession`.                                 |
| `EndUserMetadata`     | `FString` | `BlueprintReadWrite`, `EditAnywhere`，类别 `Convai` | 通过连接时通过发送的可选 JSON 字符串 `GetEndUserMetadata()`.                                    |
| `SessionID`           | `FString` | `BlueprintReadWrite`，类别 `Convai`, `已复制`          | 本地会话链接标记。默认值为 `"-1"`。由以下项清除： `ResetConversation()`。不会由 WebRTC 发送 `StartSession`. |
| `ResetConversation()` | `void`    | `BlueprintCallable`，类别 `Convai`                  | 设置 `SessionID` 到 `"-1"`.                                                         |
| `StartSession()`      | `void`    | `BlueprintCallable`，类别 \`Convai                  | 会话\`                                                                             |

`UConvaiChatbotComponent` 实现 `IConvaiConnectionInterface`。其 `GetEndUserID()` 是位于 `GetEndUserMetadata()` 重写项返回组件属性。

### UConvaiPlayerComponent

Blueprint 显示名称： **Convai 玩家**.

| 成员                           | 类型                                         | 说明符                                                                       | 说明                                                            |
| ---------------------------- | ------------------------------------------ | ------------------------------------------------------------------------- | ------------------------------------------------------------- |
| `EndUserID`                  | `FString`                                  | `EditAnywhere`，类别 `Convai`, `已复制`, `BlueprintSetter = SetEndUserID`       | 播放器组件上的玩家身份。请设置为与聊天机器人值一致，以保持项目一致性。                           |
| `SetEndUserID()`             | `void (FString NewEndUserID)`              | `BlueprintCallable`, `BlueprintInternalUseOnly`，类别 `Convai`               | 设置 `EndUserID`。调用 `SetEndUserIDServer()` 当组件已复制时。             |
| `SetEndUserIDServer()`       | `void (const FString& NewEndUserID)`       | `Server`, `Reliable`，类别 \`Convai                                          | 网络\`                                                          |
| `EndUserMetadata`            | `FString`                                  | `EditAnywhere`，类别 `Convai`, `已复制`, `BlueprintSetter = SetEndUserMetadata` | 可选的 JSON 元数据。请设置为与聊天机器人值一致。                                   |
| `SetEndUserMetadata()`       | `void (FString NewEndUserMetadata)`        | `BlueprintCallable`, `BlueprintInternalUseOnly`，类别 `Convai`               | 设置 `EndUserMetadata`。调用 `SetEndUserMetadataServer()` 当组件已复制时。 |
| `SetEndUserMetadataServer()` | `void (const FString& NewEndUserMetadata)` | `Server`, `Reliable`，类别 \`Convai                                          | 网络\`                                                          |

源说明： `UConvaiPlayerComponent` 声明 `EndUserID` 是位于 `EndUserMetadata` 带有复制元数据和服务器 RPC 设置器。在当前源中， `GetLifetimeReplicatedProps()` 注册 `PlayerName`；它不注册 `EndUserID` 或 `EndUserMetadata`.

### 设备回退工具

| 成员                                          | 类别       | 说明   |
| ------------------------------------------- | -------- | ---- |
| `UConvaiUtils::GetDeviceUniqueIdentifier()` | \`Convai | 工具\` |

### 源文件

* `Source/Convai/Public/RestAPI/ConvaiLTMProxy.h`
* `Source/Convai/Private/RestAPI/ConvaiLTMProxy.cpp`
* `Source/Convai/Public/ConvaiDefinitions.h`
* `Source/Convai/Private/ConvaiDefinitions.cpp`
* `Source/Convai/Public/ConvaiChatbotComponent.h`
* `Source/Convai/Private/ConvaiChatbotComponent.cpp`
* `Source/Convai/Public/ConvaiPlayerComponent.h`
* `Source/Convai/Private/ConvaiPlayerComponent.cpp`
* `Source/Convai/Public/ConvaiConnectionInterface.h`
* `Source/Convai/Public/ConvaiUtils.h`

### 相关页面

{% content-ref url="/pages/49e163546e7059153712733c44aa93aee597bbbe" %}
[最终用户身份](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/long-term-memory/end-user-identity.md)
{% endcontent-ref %}

{% content-ref url="/pages/490cd1c53fd291cb3dcb57f385b0eee013c3ae74" %}
[Speaker ID 管理](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/long-term-memory/speaker-id-management.md)
{% endcontent-ref %}

{% content-ref url="/pages/02906b279025410eed0c91dd64f1012b0304b626" %}
[为角色配置记忆](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/long-term-memory/configure-memory-for-a-character.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/long-term-memory/ltm-blueprint-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
