Spaces:
Running
Running
Update summarize.js
Browse files- summarize.js +7 -1
summarize.js
CHANGED
|
@@ -171,7 +171,13 @@ function setupSection(heading, contentEls) {
|
|
| 171 |
ring.setDetail("");
|
| 172 |
ring.setIndeterminate();
|
| 173 |
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
let textEl = null; // created on the first streamed chunk, once we drop the ring
|
| 177 |
const summary = await enqueueGenerate(() =>
|
|
|
|
| 171 |
ring.setDetail("");
|
| 172 |
ring.setIndeterminate();
|
| 173 |
|
| 174 |
+
function limitWords(text, maxWords) {
|
| 175 |
+
return text.split(/\s+/).slice(0, maxWords).join(" ");
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
const input = limitWords(sectionText(contentEls), 130);
|
| 179 |
+
|
| 180 |
+
const prompt = "Summarize this section directly:\n\n" + input;
|
| 181 |
|
| 182 |
let textEl = null; // created on the first streamed chunk, once we drop the ring
|
| 183 |
const summary = await enqueueGenerate(() =>
|