| 1 | <html> |
| 2 | <head> |
| 3 | <title>Document Query</title> |
| 4 | </head> |
| 5 | |
| 6 | <body> |
| 7 | <div x-data="{ |
| 8 | defaults: { |
| 9 | fetch_timeout: 30, |
| 10 | fetch_retries: 3, |
| 11 | fetch_retry_backoff: 1.0, |
| 12 | per_document_timeout: 60, |
| 13 | gather_timeout: 120, |
| 14 | parser_concurrency: 1, |
| 15 | context_intro_chunks: 2, |
| 16 | chunk_size: 1000, |
| 17 | chunk_overlap: 100, |
| 18 | max_index_chunks: 1200, |
| 19 | search_threshold: 0.5, |
| 20 | search_limit: 100, |
| 21 | max_remote_bytes: 52428800, |
| 22 | liteparse_enabled: true, |
| 23 | liteparse_ocr_enabled: true, |
| 24 | liteparse_ocr_language: 'eng', |
| 25 | liteparse_ocr_server_url: '', |
| 26 | liteparse_tessdata_path: '', |
| 27 | liteparse_max_pages: 1000, |
| 28 | liteparse_target_pages: '', |
| 29 | liteparse_dpi: 150, |
| 30 | liteparse_preserve_very_small_text: false, |
| 31 | liteparse_output_format: 'text', |
| 32 | liteparse_num_workers: 2, |
| 33 | pdf_ocr_fallback: true, |
| 34 | thread_offload: true, |
| 35 | }, |
| 36 | initDefaults() { |
| 37 | for (const [key, value] of Object.entries(this.defaults)) { |
| 38 | if (config[key] === undefined || config[key] === null) config[key] = value; |
| 39 | } |
| 40 | this.ensureInt('parser_concurrency', 1, 1); |
| 41 | this.ensureInt('context_intro_chunks', 2, 0); |
| 42 | this.ensureInt('chunk_size', 1000, 100); |
| 43 | this.ensureInt('chunk_overlap', 100, 0); |
| 44 | this.ensureInt('max_index_chunks', 1200, 0); |
| 45 | this.ensureInt('search_limit', 100, 1); |
| 46 | this.ensureInt('max_remote_bytes', 52428800, 1); |
| 47 | this.ensureNumber('search_threshold', 0.5, 0, 1); |
| 48 | this.ensureNumber('fetch_timeout', 30, 1); |
| 49 | this.ensureInt('fetch_retries', 3, 1); |
| 50 | this.ensureNumber('fetch_retry_backoff', 1.0, 0); |
| 51 | this.ensureNumber('per_document_timeout', 60, 1); |
| 52 | this.ensureNumber('gather_timeout', 120, 1); |
| 53 | this.ensureInt('liteparse_max_pages', 1000, 1); |
| 54 | this.ensureNumber('liteparse_dpi', 150, 72); |
| 55 | this.ensureInt('liteparse_num_workers', 2, 1); |
| 56 | this.syncChunkOverlap(); |
| 57 | }, |
| 58 | ensureInt(key, fallback, min = null, max = null) { |
| 59 | let value = parseInt(config[key], 10); |
| 60 | if (!Number.isFinite(value)) value = fallback; |
| 61 | if (min !== null) value = Math.max(min, value); |
| 62 | if (max !== null) value = Math.min(max, value); |
| 63 | config[key] = value; |
| 64 | }, |
| 65 | ensureNumber(key, fallback, min = null, max = null) { |
| 66 | let value = parseFloat(config[key]); |
| 67 | if (!Number.isFinite(value)) value = fallback; |
| 68 | if (min !== null) value = Math.max(min, value); |
| 69 | if (max !== null) value = Math.min(max, value); |
| 70 | config[key] = value; |
| 71 | }, |
| 72 | syncChunkOverlap() { |
| 73 | this.ensureInt('chunk_size', 1000, 100); |
| 74 | this.ensureInt('chunk_overlap', 100, 0); |
| 75 | if (config.chunk_overlap >= config.chunk_size) { |
| 76 | config.chunk_overlap = Math.max(0, config.chunk_size - 1); |
| 77 | } |
| 78 | }, |
| 79 | }"> |
| 80 | <template x-if="config"> |
| 81 | <div x-init="initDefaults()"> |
| 82 | <div class="section-title">Document Query</div> |
| 83 | <div class="section-description"> |
| 84 | Settings for document parsing and retrieval. |
| 85 | </div> |
| 86 | |
| 87 | <div class="field"> |
| 88 | <div class="field-label"> |
| 89 | <div class="field-title">Max parser concurrency</div> |
| 90 | <div class="field-description"> |
| 91 | Maximum document parser jobs allowed to run at the same time in this Agent Zero process. |
| 92 | </div> |
| 93 | </div> |
| 94 | <div class="field-control"> |
| 95 | <input type="number" min="1" step="1" |
| 96 | @change="ensureInt('parser_concurrency', 1, 1)" |
| 97 | x-model.number="config.parser_concurrency" /> |
| 98 | </div> |
| 99 | </div> |
| 100 | |
| 101 | <div class="field"> |
| 102 | <div class="field-label"> |
| 103 | <div class="field-title">Per-document timeout</div> |
| 104 | <div class="field-description"> |
| 105 | Seconds allowed for a single document parse before trying the next parser or returning an error. |
| 106 | </div> |
| 107 | </div> |
| 108 | <div class="field-control"> |
| 109 | <input type="number" min="1" step="1" |
| 110 | @change="ensureNumber('per_document_timeout', 60, 1)" |
| 111 | x-model.number="config.per_document_timeout" /> |
| 112 | </div> |
| 113 | </div> |
| 114 | |
| 115 | <div class="field"> |
| 116 | <div class="field-label"> |
| 117 | <div class="field-title">Batch timeout</div> |
| 118 | <div class="field-description"> |
| 119 | Seconds allowed for a document-query call that processes multiple files. |
| 120 | </div> |
| 121 | </div> |
| 122 | <div class="field-control"> |
| 123 | <input type="number" min="1" step="1" |
| 124 | @change="ensureNumber('gather_timeout', 120, 1)" |
| 125 | x-model.number="config.gather_timeout" /> |
| 126 | </div> |
| 127 | </div> |
| 128 | |
| 129 | <div class="section-title">Retrieval</div> |
| 130 | <div class="section-description"> |
| 131 | Controls how parsed text is split, indexed, and selected for Q&A. |
| 132 | </div> |
| 133 | |
| 134 | <div class="field"> |
| 135 | <div class="field-label"> |
| 136 | <div class="field-title">Chunk size</div> |
| 137 | <div class="field-description"> |
| 138 | Target character count for indexed chunks. |
| 139 | </div> |
| 140 | </div> |
| 141 | <div class="field-control"> |
| 142 | <input type="number" min="100" step="50" |
| 143 | @change="syncChunkOverlap()" |
| 144 | x-model.number="config.chunk_size" /> |
| 145 | </div> |
| 146 | </div> |
| 147 | |
| 148 | <div class="field"> |
| 149 | <div class="field-label"> |
| 150 | <div class="field-title">Chunk overlap</div> |
| 151 | <div class="field-description"> |
| 152 | Characters repeated between neighboring chunks. |
| 153 | </div> |
| 154 | </div> |
| 155 | <div class="field-control"> |
| 156 | <input type="number" min="0" step="25" |
| 157 | :max="Math.max(0, config.chunk_size - 1)" |
| 158 | @change="syncChunkOverlap()" |
| 159 | x-model.number="config.chunk_overlap" /> |
| 160 | </div> |
| 161 | </div> |
| 162 | |
| 163 | <div class="field"> |
| 164 | <div class="field-label"> |
| 165 | <div class="field-title">Search threshold</div> |
| 166 | <div class="field-description"> |
| 167 | Minimum vector similarity score for retrieved chunks. |
| 168 | </div> |
| 169 | </div> |
| 170 | <div class="field-control"> |
| 171 | <input type="number" min="0" max="1" step="0.05" |
| 172 | @change="ensureNumber('search_threshold', 0.5, 0, 1)" |
| 173 | x-model.number="config.search_threshold" /> |
| 174 | </div> |
| 175 | </div> |
| 176 | |
| 177 | <div class="field"> |
| 178 | <div class="field-label"> |
| 179 | <div class="field-title">Max index chunks</div> |
| 180 | <div class="field-description"> |
| 181 | Adapt chunk size when a parsed document would exceed this many indexed chunks. Use 0 for no cap. |
| 182 | </div> |
| 183 | </div> |
| 184 | <div class="field-control"> |
| 185 | <input type="number" min="0" step="50" |
| 186 | @change="ensureInt('max_index_chunks', 1200, 0)" |
| 187 | x-model.number="config.max_index_chunks" /> |
| 188 | </div> |
| 189 | </div> |
| 190 | |
| 191 | <div class="field"> |
| 192 | <div class="field-label"> |
| 193 | <div class="field-title">Search limit</div> |
| 194 | <div class="field-description"> |
| 195 | Maximum matching chunks considered during document Q&A. |
| 196 | </div> |
| 197 | </div> |
| 198 | <div class="field-control"> |
| 199 | <input type="number" min="1" step="1" |
| 200 | @change="ensureInt('search_limit', 100, 1)" |
| 201 | x-model.number="config.search_limit" /> |
| 202 | </div> |
| 203 | </div> |
| 204 | |
| 205 | <div class="field"> |
| 206 | <div class="field-label"> |
| 207 | <div class="field-title">Intro chunks</div> |
| 208 | <div class="field-description"> |
| 209 | Leading chunks always included per document to preserve titles, abstracts, and setup context. |
| 210 | </div> |
| 211 | </div> |
| 212 | <div class="field-control"> |
| 213 | <input type="number" min="0" step="1" |
| 214 | @change="ensureInt('context_intro_chunks', 2, 0)" |
| 215 | x-model.number="config.context_intro_chunks" /> |
| 216 | </div> |
| 217 | </div> |
| 218 | |
| 219 | <div class="section-title">Remote Files</div> |
| 220 | <div class="section-description"> |
| 221 | Limits for documents loaded from HTTP or HTTPS URLs. |
| 222 | </div> |
| 223 | |
| 224 | <div class="field"> |
| 225 | <div class="field-label"> |
| 226 | <div class="field-title">Fetch timeout</div> |
| 227 | <div class="field-description"> |
| 228 | Seconds allowed for each remote fetch attempt. |
| 229 | </div> |
| 230 | </div> |
| 231 | <div class="field-control"> |
| 232 | <input type="number" min="1" step="1" |
| 233 | @change="ensureNumber('fetch_timeout', 30, 1)" |
| 234 | x-model.number="config.fetch_timeout" /> |
| 235 | </div> |
| 236 | </div> |
| 237 | |
| 238 | <div class="field"> |
| 239 | <div class="field-label"> |
| 240 | <div class="field-title">Fetch retries</div> |
| 241 | <div class="field-description"> |
| 242 | Attempts made before giving up on a remote document. |
| 243 | </div> |
| 244 | </div> |
| 245 | <div class="field-control"> |
| 246 | <input type="number" min="1" step="1" |
| 247 | @change="ensureInt('fetch_retries', 3, 1)" |
| 248 | x-model.number="config.fetch_retries" /> |
| 249 | </div> |
| 250 | </div> |
| 251 | |
| 252 | <div class="field"> |
| 253 | <div class="field-label"> |
| 254 | <div class="field-title">Retry backoff</div> |
| 255 | <div class="field-description"> |
| 256 | Delay in seconds between remote fetch retries. |
| 257 | </div> |
| 258 | </div> |
| 259 | <div class="field-control"> |
| 260 | <input type="number" min="0" step="0.1" |
| 261 | @change="ensureNumber('fetch_retry_backoff', 1.0, 0)" |
| 262 | x-model.number="config.fetch_retry_backoff" /> |
| 263 | </div> |
| 264 | </div> |
| 265 | |
| 266 | <div class="field"> |
| 267 | <div class="field-label"> |
| 268 | <div class="field-title">Max remote bytes</div> |
| 269 | <div class="field-description"> |
| 270 | Maximum size accepted for a remote document. |
| 271 | </div> |
| 272 | </div> |
| 273 | <div class="field-control"> |
| 274 | <input type="number" min="1" step="1048576" |
| 275 | @change="ensureInt('max_remote_bytes', 52428800, 1)" |
| 276 | x-model.number="config.max_remote_bytes" /> |
| 277 | </div> |
| 278 | </div> |
| 279 | |
| 280 | <div class="section-title">LiteParse and OCR</div> |
| 281 | <div class="section-description"> |
| 282 | Parser preference and OCR controls for PDFs, document images, and mixed-format inputs. |
| 283 | </div> |
| 284 | |
| 285 | <div class="field"> |
| 286 | <div class="field-label"> |
| 287 | <div class="field-title">Use LiteParse first</div> |
| 288 | <div class="field-description"> |
| 289 | Prefer LiteParse before legacy parser fallbacks. |
| 290 | </div> |
| 291 | </div> |
| 292 | <div class="field-control"> |
| 293 | <label class="toggle"> |
| 294 | <input type="checkbox" x-model="config.liteparse_enabled" /> |
| 295 | <span class="toggler"></span> |
| 296 | </label> |
| 297 | </div> |
| 298 | </div> |
| 299 | |
| 300 | <template x-if="config.liteparse_enabled !== false"> |
| 301 | <div> |
| 302 | <div class="field"> |
| 303 | <div class="field-label"> |
| 304 | <div class="field-title">LiteParse workers</div> |
| 305 | <div class="field-description"> |
| 306 | Worker count passed to LiteParse for a single parser job. |
| 307 | </div> |
| 308 | </div> |
| 309 | <div class="field-control"> |
| 310 | <input type="number" min="1" step="1" |
| 311 | @change="ensureInt('liteparse_num_workers', 2, 1)" |
| 312 | x-model.number="config.liteparse_num_workers" /> |
| 313 | </div> |
| 314 | </div> |
| 315 | |
| 316 | <div class="field"> |
| 317 | <div class="field-label"> |
| 318 | <div class="field-title">Max pages</div> |
| 319 | <div class="field-description"> |
| 320 | Maximum pages LiteParse should parse from one document. |
| 321 | </div> |
| 322 | </div> |
| 323 | <div class="field-control"> |
| 324 | <input type="number" min="1" step="1" |
| 325 | @change="ensureInt('liteparse_max_pages', 1000, 1)" |
| 326 | x-model.number="config.liteparse_max_pages" /> |
| 327 | </div> |
| 328 | </div> |
| 329 | |
| 330 | <div class="field"> |
| 331 | <div class="field-label"> |
| 332 | <div class="field-title">Target pages</div> |
| 333 | <div class="field-description"> |
| 334 | Optional page range expression passed to LiteParse. |
| 335 | </div> |
| 336 | </div> |
| 337 | <div class="field-control"> |
| 338 | <input type="text" |
| 339 | placeholder="all pages" |
| 340 | x-model="config.liteparse_target_pages" /> |
| 341 | </div> |
| 342 | </div> |
| 343 | |
| 344 | <div class="field"> |
| 345 | <div class="field-label"> |
| 346 | <div class="field-title">Enable OCR</div> |
| 347 | <div class="field-description"> |
| 348 | Allow OCR for scanned PDFs and document images. |
| 349 | </div> |
| 350 | </div> |
| 351 | <div class="field-control"> |
| 352 | <label class="toggle"> |
| 353 | <input type="checkbox" x-model="config.liteparse_ocr_enabled" /> |
| 354 | <span class="toggler"></span> |
| 355 | </label> |
| 356 | </div> |
| 357 | </div> |
| 358 | |
| 359 | <template x-if="config.liteparse_ocr_enabled !== false"> |
| 360 | <div> |
| 361 | <div class="field"> |
| 362 | <div class="field-label"> |
| 363 | <div class="field-title">OCR language</div> |
| 364 | <div class="field-description"> |
| 365 | Tesseract language code used by LiteParse OCR. |
| 366 | </div> |
| 367 | </div> |
| 368 | <div class="field-control"> |
| 369 | <input type="text" |
| 370 | placeholder="eng" |
| 371 | x-model="config.liteparse_ocr_language" /> |
| 372 | </div> |
| 373 | </div> |
| 374 | |
| 375 | <div class="field"> |
| 376 | <div class="field-label"> |
| 377 | <div class="field-title">OCR DPI</div> |
| 378 | <div class="field-description"> |
| 379 | Render density used before OCR. |
| 380 | </div> |
| 381 | </div> |
| 382 | <div class="field-control"> |
| 383 | <input type="number" min="72" step="1" |
| 384 | @change="ensureNumber('liteparse_dpi', 150, 72)" |
| 385 | x-model.number="config.liteparse_dpi" /> |
| 386 | </div> |
| 387 | </div> |
| 388 | |
| 389 | <div class="field"> |
| 390 | <div class="field-label"> |
| 391 | <div class="field-title">OCR server URL</div> |
| 392 | <div class="field-description"> |
| 393 | Optional external OCR service URL. |
| 394 | </div> |
| 395 | </div> |
| 396 | <div class="field-control"> |
| 397 | <input type="text" |
| 398 | placeholder="none" |
| 399 | x-model="config.liteparse_ocr_server_url" /> |
| 400 | </div> |
| 401 | </div> |
| 402 | |
| 403 | <div class="field"> |
| 404 | <div class="field-label"> |
| 405 | <div class="field-title">Tessdata path</div> |
| 406 | <div class="field-description"> |
| 407 | Optional path to Tesseract language data. |
| 408 | </div> |
| 409 | </div> |
| 410 | <div class="field-control"> |
| 411 | <input type="text" |
| 412 | placeholder="auto-detect" |
| 413 | x-model="config.liteparse_tessdata_path" /> |
| 414 | </div> |
| 415 | </div> |
| 416 | </div> |
| 417 | </template> |
| 418 | |
| 419 | <div class="field"> |
| 420 | <div class="field-label"> |
| 421 | <div class="field-title">Output format</div> |
| 422 | <div class="field-description"> |
| 423 | LiteParse output format passed to the parser runtime. |
| 424 | </div> |
| 425 | </div> |
| 426 | <div class="field-control"> |
| 427 | <input type="text" |
| 428 | placeholder="text" |
| 429 | x-model="config.liteparse_output_format" /> |
| 430 | </div> |
| 431 | </div> |
| 432 | |
| 433 | <div class="field"> |
| 434 | <div class="field-label"> |
| 435 | <div class="field-title">Preserve very small text</div> |
| 436 | <div class="field-description"> |
| 437 | Keep tiny text regions that OCR or PDF extraction might otherwise discard. |
| 438 | </div> |
| 439 | </div> |
| 440 | <div class="field-control"> |
| 441 | <label class="toggle"> |
| 442 | <input type="checkbox" x-model="config.liteparse_preserve_very_small_text" /> |
| 443 | <span class="toggler"></span> |
| 444 | </label> |
| 445 | </div> |
| 446 | </div> |
| 447 | |
| 448 | </div> |
| 449 | </template> |
| 450 | |
| 451 | <div class="section-title">Fallbacks</div> |
| 452 | <div class="section-description"> |
| 453 | Legacy parser behavior used when the preferred parser cannot produce text. |
| 454 | </div> |
| 455 | |
| 456 | <div class="field"> |
| 457 | <div class="field-label"> |
| 458 | <div class="field-title">PDF OCR fallback</div> |
| 459 | <div class="field-description"> |
| 460 | Try legacy Tesseract OCR when direct PDF text extraction is empty. |
| 461 | </div> |
| 462 | </div> |
| 463 | <div class="field-control"> |
| 464 | <label class="toggle"> |
| 465 | <input type="checkbox" x-model="config.pdf_ocr_fallback" /> |
| 466 | <span class="toggler"></span> |
| 467 | </label> |
| 468 | </div> |
| 469 | </div> |
| 470 | |
| 471 | <div class="field"> |
| 472 | <div class="field-label"> |
| 473 | <div class="field-title">Thread offload</div> |
| 474 | <div class="field-description"> |
| 475 | Run synchronous parser fallbacks in a worker thread. |
| 476 | </div> |
| 477 | </div> |
| 478 | <div class="field-control"> |
| 479 | <label class="toggle"> |
| 480 | <input type="checkbox" x-model="config.thread_offload" /> |
| 481 | <span class="toggler"></span> |
| 482 | </label> |
| 483 | </div> |
| 484 | </div> |
| 485 | </div> |
| 486 | </template> |
| 487 | </div> |
| 488 | </body> |
| 489 | |
| 490 | </html> |