> 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 参考

Unreal 长期记忆 Blueprint 节点、说话者 ID 数据、组件属性以及启动期间使用的会话字段的参考。

本参考列出了 Convai Unreal Engine 插件中的公开长期记忆表面。LTM 管理节点位于 `Convai|LTM` 蓝图分类。

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

### LTM 节点

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

#### Convai 创建 Speaker ID

创建一个 Speaker ID 记录。

| 项目             | 类型                                                                                          | 说明                                |
| -------------- | ------------------------------------------------------------------------------------------- | --------------------------------- |
| **Speaker 名称** | `FString` 输入                                                                                | 可读的人类可理解的 Speaker 名称。空值会在请求发送前失败。 |
| **设备 ID**      | `FString` 输入                                                                                | 可选的设备标识符。为空时不会包含在请求中。             |
| **成功时**        | `FConvaiSpeakerInfo` 委托                                                                     | 返回已创建的 Speaker 记录。                |
| **失败时**        | `FConvaiSpeakerInfo` 委托                                                                     | 返回一个空的 `FConvaiSpeakerInfo`.      |
| C++ 工厂         | `UConvaiCreateSpeakerID::ConvaiCreateSpeakerIDProxy(FString SpeakerName, FString DeviceId)` | 蓝图节点使用的静态工厂。                      |

源代码验证日志 `Speaker 名称为空` 当 **Speaker 名称** 为空。

#### Convai 列出 Speaker ID

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

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

#### Convai 删除 Speaker ID

删除一个 Speaker ID 记录。

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

#### Convai 获取 LTM 状态

返回角色的 LTM 启用状态。

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

#### Convai 设置 LTM 状态

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

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

### 数据结构

#### FConvaiSpeakerInfo

| 字段          | 类型        | 类别           | 说明                       |
| ----------- | --------- | ------------ | ------------------------ |
| `SpeakerID` | `FString` | `Speaker 信息` | 要保存并作为 `EndUserID`.      |
| `名称`        | `FString` | `Speaker 信息` | 由 Convai 返回的 Speaker 名称。 |
| `DeviceID`  | `FString` | `Speaker 信息` | 由 Convai 返回的设备标识符。       |

### UConvaiChatbotComponent

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

| 成员                    | 类型        | 说明符                                                | 说明                                                                           |
| --------------------- | --------- | -------------------------------------------------- | ---------------------------------------------------------------------------- |
| `EndUserID`           | `FString` | `BlueprintReadWrite`, `EditAnywhere`，类别 `Convai`   | 通过 `GetEndUserID()`在连接时发送的玩家身份。在 `StartSession`.                             |
| `EndUserMetadata`     | `FString` | `BlueprintReadWrite`, `EditAnywhere`，类别 `Convai`   | 通过 `GetEndUserMetadata()`.                                                   |
| `SessionID`           | `FString` | `BlueprintReadWrite`，类别 `Convai`, `发送的可选 JSON 字符串` | 本地会话链接标记。默认值为 `"-1"`。由 `ResetConversation()`清除。不会由 WebRTC 发送 `StartSession`. |
| `ResetConversation()` | `void`    | `BlueprintCallable`，类别 `Convai`                    | 设置 `SessionID` 为 `"-1"`.                                                     |
| `StartSession()`      | `void`    | `BlueprintCallable`，类别 \`Convai                    | Session\`                                                                    |

`UConvaiChatbotComponent` 实现了 `IConvaiConnectionInterface`。其 `GetEndUserID()` 和 `GetEndUserMetadata()` 重写会返回组件属性。

### UConvaiPlayerComponent

蓝图显示名称： **Convai Player**.

| 成员                           | 类型                                         | 说明符                                                                                  | 说明                                                            |
| ---------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
| `EndUserID`                  | `FString`                                  | `EditAnywhere`，类别 `Convai`, `发送的可选 JSON 字符串`, `BlueprintSetter = SetEndUserID`       | 玩家组件上的玩家身份。设置为与聊天机器人值一致，以保持项目一致性。                             |
| `SetEndUserID()`             | `void (FString NewEndUserID)`              | `BlueprintCallable`, `BlueprintInternalUseOnly`，类别 `Convai`                          | 设置 `EndUserID`。调用 `SetEndUserIDServer()` 当组件已复制时。             |
| `SetEndUserIDServer()`       | `void (const FString& NewEndUserID)`       | `服务器`, `可靠`，类别 \`Convai                                                              | 网络\`                                                          |
| `EndUserMetadata`            | `FString`                                  | `EditAnywhere`，类别 `Convai`, `发送的可选 JSON 字符串`, `BlueprintSetter = SetEndUserMetadata` | 可选的 JSON 元数据。设置为与聊天机器人值一致。                                    |
| `SetEndUserMetadata()`       | `void (FString NewEndUserMetadata)`        | `BlueprintCallable`, `BlueprintInternalUseOnly`，类别 `Convai`                          | 设置 `EndUserMetadata`。调用 `SetEndUserMetadataServer()` 当组件已复制时。 |
| `SetEndUserMetadataServer()` | `void (const FString& NewEndUserMetadata)` | `服务器`, `可靠`，类别 \`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" %}
[说话者 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
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>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
