> For AI agents: the complete documentation index is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/llms.txt, the full documentation bundle is available at https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/llms-full.txt.

# 介紹

`ts-fsrs` 是用於建立 FSRS 間隔重複系統的 TypeScript 工具包。宣告式 API 會將模型、時間系統與選用 middleware 組合成可重複使用的排程器定義。

## 組成部分

**模型**是 FSRS 演算法及其參數。`FSRS7Model` 是目前版本；FSRS-3 至 FSRS-6 仍然保留，用於建立在這些版本上的既有複習歷史。

**時間系統**決定如何表示時間。`dateChrono` 使用 `Date`，`numericChrono` 使用以天為單位的數字，`temporalInstantChrono` 使用 `Temporal.Instant`。

**Middleware** 負責排程策略，例如 `schedulerLearningStepsMiddleware`、`schedulerFuzzingMiddleware`、`schedulerMaximumIntervalMiddleware`、`schedulerLeechMiddleware`。建立排程器前，透過 `.use(...)` 組合它們。

`defineScheduler` 將這些項目組合成 definition。`.create()` 會驗證設定並回傳獨立的排程器，因此同一個 definition 可以建立多個排程器。


For your Agent

在 TypeScript 應用程式中整合 ts-fsrs

複製提示詞

在我的 TypeScript 應用程式中整合 ts-fsrs。

1. 閱讀文件索引 https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/llms.txt 與快速開始 https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/guide/quick-start.md。先檢查專案是否已使用 ts-fsrs：若涉及 v5 → v6 或 FSRS-6 → FSRS-7 升級，必須閱讀遷移指南 https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/guide/migration.md，依其步驟與驗收要求完成遷移，保留既有卡片與紀錄，遷移時不重新安排卡片的下次複習時間；以下安裝與新卡範例僅用於首次整合。
2. 安裝 `ts-fsrs` package。
3. 使用 `defineScheduler`、`FSRS7Model` 與 `dateChrono` 建立 FSRS-7 排程器。
4. 建立一張新卡片，並使用 `Rating.Good` 完成一次複習。
5. 保持實作最小化，並使用目前 ts-fsrs 公開 API。

接下來前往[快速開始](https://open-spaced-repetition.github.io/ts-fsrs/zh-TW/guide/quick-start.md)，安裝 package 並在瀏覽器中執行排程器。
