> 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-unity-sdk/features/long-term-memory.md).

# 长期记忆

长期记忆（LTM）让 Convai 角色能够在不同的对话会话之间保留关于单个用户的事实。本节涵盖系统的工作原理、如何启用它、如何管理用户身份和记录，以及完整的脚本 API。

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>长期记忆的工作原理</strong><br>了解会话生命周期、记忆作用域、去重，以及事实如何被提取和注入。</td><td><a href="/pages/cb4d859b279841fc234bec92056ed917a73b519b">/pages/cb4d859b279841fc234bec92056ed917a73b519b</a></td></tr><tr><td><strong>长期记忆快速入门</strong><br>在三步之内为角色启用 LTM，并在 Unity 编辑器中验证跨会话回忆。</td><td><a href="/pages/d051c20fa3bb87461147abd07ac16642c7956362">/pages/d051c20fa3bb87461147abd07ac16642c7956362</a></td></tr><tr><td><strong>为角色配置记忆</strong><br>通过 Convai 控制面板或 CharacterService 脚本 API，按角色切换 LTM 的开启或关闭。</td><td><a href="/pages/b54beab8714c42a31356b3abe240c02692f3d79b">/pages/b54beab8714c42a31356b3abe240c02692f3d79b</a></td></tr><tr><td><strong>最终用户身份</strong><br>了解 SDK 如何识别用户，以及如何提供你自己的、基于身份验证的 ID。</td><td><a href="/pages/c12fc9539ece3543a049cf5c334655c9bb0a6a3c">/pages/c12fc9539ece3543a049cf5c334655c9bb0a6a3c</a></td></tr><tr><td><strong>管理终端用户记录</strong><br>从编辑器中或通过 EndUsersService 脚本 API 浏览和删除终端用户记录。</td><td><a href="/pages/49cef55d22f33c0ffdf4893701cd5a6686bd7590">/pages/49cef55d22f33c0ffdf4893701cd5a6686bd7590</a></td></tr><tr><td><strong>记忆管理 API</strong><br>以编程方式列出、添加、检索和删除某个用户-角色对的记忆记录。</td><td><a href="/pages/0b7e1084a14c3bcf13fec179ad83b458f07ecff4">/pages/0b7e1084a14c3bcf13fec179ad83b458f07ecff4</a></td></tr><tr><td><strong>长期记忆脚本参考</strong><br>所有 LTM API 的完整方法签名、参数、返回类型和数据模型。</td><td><a href="/pages/9c55a31cd790424665e521972bff5affc2dbe7f9">/pages/9c55a31cd790424665e521972bff5affc2dbe7f9</a></td></tr><tr><td><strong>长期记忆使用示例</strong><br>四个完整模式：零配置持久化、已认证身份、记忆预置和重置。</td><td><a href="/pages/d41fbdd4f21a090aa6d7e39be7a7eb215d0435c2">/pages/d41fbdd4f21a090aa6d7e39be7a7eb215d0435c2</a></td></tr><tr><td><strong>排查长期记忆问题</strong><br>诊断记忆为何未持久化，并解决 Memory Management API 的 HTTP 错误。</td><td><a href="/pages/7a63a06da6d31beb01ce563b8e8b3398f3436122">/pages/7a63a06da6d31beb01ce563b8e8b3398f3436122</a></td></tr></tbody></table>

### 下一步

先从 [长期记忆的工作原理](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/long-term-memory/how-long-term-memory-works.md) 用于概念概述，然后接着 [长期记忆快速入门](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/long-term-memory/quick-start.md) 以便在你的场景中让记忆运行起来。


---

# 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-unity-sdk/features/long-term-memory.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.
