Repository navigation
Commit ef07e91
committed
fix(shared): cap content length before tokenizing prompts
The prompt builder tokenized the whole article with the pure-JS
tiktoken before truncating it to the context length, blocking the
event loop on long articles. Cut the content to contextLength * 8
characters before encoding.1 parent 123893e commit ef07e91
1 file changed
Lines changed: 3 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
0 commit comments