To prevent expensive re-evaluations of markdown parsing, inline parsing, and syntax highlighting during streaming assistant text updates, ThreadConversation.vue implements a multi-layered caching strategy.
Key caching mechanisms include:
- Message Blocks: Cached by
message id, text, and cwd. - Inline Segments: Cached by
source text. - Rendered Markdown HTML: Cached by
cwd, text, and highlighter version. - Highlighted Code HTML: Cached by
highlighter version, language, and code.
Additionally, normal message text flow utilizes Vue v-memo keyed by message id, message text, cwd, highlighter version, and markdown-image failure version to minimize re-renders.