You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Ignore OCR fallback errors, continue with tree only
205
+
}
206
+
}
156
207
157
208
constsystemPrompt=`You are a helpful document assistant.
158
209
You have been given a structured index tree extracted from a PDF document.
@@ -168,7 +219,7 @@ Rules:
168
219
{role: 'system',content: systemPrompt},
169
220
{
170
221
role: 'user',
171
-
content: `Here is the indexed structure of the document:\n\n${flattenedTree}\n\nI will now ask questions about this document.`
222
+
content: `Here is the indexed structure of the document:\n\n${flattenedTree}\n\n${ocrContext ? `Additional OCR content (page-based):\n${ocrContext}\n\n` : ''}I will now ask questions about this document.`
172
223
},
173
224
{role: 'assistant',content: "Got it! I've read the full index. Ask me anything."},
174
225
...history,
@@ -220,6 +271,21 @@ Rules:
220
271
returnresult;
221
272
}
222
273
274
+
/**
275
+
* Count total text characters in the tree (summary/text).
0 commit comments