> Discover all available pages from the documentation index: https://mastra.zisheng.pro/zh-HK/llms.txt # Memory.getThreadById() `.getThreadById()` 方法按 ID 擷取指定 thread。 ## 使用範例 ```typescript await memory?.getThreadById({ threadId: 'thread-123' }) ``` ## 參數 **threadId** (`string`): 要擷取的 thread ID。 ## 傳回值 **thread** (`Promise`): Promise 會解析為與指定 ID 關聯的 thread;如找不到,則為 null。 ### 相關內容 - [Memory class 參考](https://mastra.zisheng.pro/zh-HK/reference/memory/memory-class) - [Memory 入門](https://mastra.zisheng.pro/zh-HK/docs/memory/overview)(涵蓋 thread 概念) - [createThread](https://mastra.zisheng.pro/zh-HK/reference/memory/createThread) - [listThreads](https://mastra.zisheng.pro/zh-HK/reference/memory/listThreads)