getThreadById リファレンス
getThreadById
関数は、ストレージから指定したIDのスレッドを取得します。
使用例
import { Memory } from "@mastra/core/memory";
const memory = new Memory(config);
const thread = await memory.getThreadById({ threadId: "thread-123" });
パラメーター
threadId:
string
取得するスレッドのID。
戻り値
StorageThreadType | null:
Promise
指定されたIDに関連付けられたスレッドが見つかった場合はそのスレッド、見つからなかった場合はnullを返すPromise。
関連情報
- Memory クラスリファレンス
- Memory のはじめ方(スレッドの概念について解説)
- createThread
- getThreadsByResourceId