Skip to content

Add document-image OCR workflow and clue-driven search query generation - #5

Merged
potemkin666 merged 13 commits into
mainfrom
copilot/remove-image-and-workflow
May 5, 2026
Merged

Add document-image OCR workflow and clue-driven search query generation#5
potemkin666 merged 13 commits into
mainfrom
copilot/remove-image-and-workflow

Conversation

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor

BlueLens handled OCR as raw text extraction, but it did not treat document-style images as first-class evidence surfaces or turn extracted clues into ready-to-run searches. This change adds a document-image workflow for structured OCR review and a query generator that composes higher-signal searches from text, brands, locations, usernames, filenames, dimensions, and language hints.

  • Document-image workflow

    • Adds a document_image mission and direct Text-tab action for document-heavy images: letters, forms, IDs, posters, flyers, menus, receipts, certificates, and similar material.
    • Structures OCR output into:
      • document-kind inference
      • layout summary (headings, key-value rows, tabular rows)
      • logo/brand lookup candidates
      • entity summary across orgs, people, locations, dates, domains, handles, phones
  • Search query generator

    • Adds a query_generator mission and direct Text-tab action.
    • Generates focused follow-up searches from available clues, including:
      • brand + city
      • OCR text + logo
      • object + language
      • file name + dimensions
      • visible username + platform
      • logo + domain
      • quoted OCR line
  • UI surface

    • Extends the workflow selector with:
      • Document Image
      • Search Query Generator
    • Adds dedicated output panels in the Text tab so document analysis and generated searches stay visible independent of generic mission output.
  • Export/report integration

    • Includes document-mode and query-generator outputs in report JSON/markdown exports so OCR interpretation is preserved with the rest of the investigation record.
  • Shared logic

    • Moves pure document/query heuristics into bluelens-helpers.js so the browser and test suite use the same logic for:
      • layout summarization
      • document-kind inference
      • logo candidate extraction
      • search query composition
const output = buildSearchQueryGeneratorOutput({
  ent,
  handles,
  domains,
});

// Example generated searches:
// - "Acme Festival" "Berlin"
// - "JOIN US THIS FRIDAY" "Acme Festival"
// - "@acmefest" instagram.com

Copilot AI and others added 13 commits May 5, 2026 17:26
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/6cd3f2cb-45d7-4938-9b7f-bcaaafbfe12f

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/6cd3f2cb-45d7-4938-9b7f-bcaaafbfe12f

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
…Advanced

Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/6cd3f2cb-45d7-4938-9b7f-bcaaafbfe12f

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/63cdc1b1-d6ec-45bc-9cb6-304f7c230e30

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/63cdc1b1-d6ec-45bc-9cb6-304f7c230e30

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/63cdc1b1-d6ec-45bc-9cb6-304f7c230e30

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/63cdc1b1-d6ec-45bc-9cb6-304f7c230e30

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/419821fd-96da-4593-99b0-98b32ee0cc59

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/419821fd-96da-4593-99b0-98b32ee0cc59

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/9f2fb05c-7bc4-41b5-9e84-d5dfb49bffb6

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/9f2fb05c-7bc4-41b5-9e84-d5dfb49bffb6

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/e1b7b5f9-72f5-432a-a7be-edccc449d31d

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
Agent-Logs-Url: https://github.com/potemkin666/bluelens/sessions/e1b7b5f9-72f5-432a-a7be-edccc449d31d

Co-authored-by: potemkin666 <183807833+potemkin666@users.noreply.github.com>
@potemkin666
potemkin666 marked this pull request as ready for review May 5, 2026 18:37
Copilot AI review requested due to automatic review settings May 5, 2026 18:37
@potemkin666
potemkin666 merged commit c5283c4 into main May 5, 2026
1 of 3 checks passed
@potemkin666
potemkin666 deleted the copilot/remove-image-and-workflow branch May 5, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands BlueLens’s OCR capabilities by adding a document-image review workflow and a clue-driven search query generator, while also broadening the multi-engine relay and updating the UI/export surfaces to keep these new outputs visible and exportable.

Changes:

  • Add document_image and query_generator workflows with structured OCR/layout output and generated follow-up searches.
  • Expand reverse-search engine coverage (incl. Pinterest/SauceNAO/IQDB/Baidu/ASCII2D) across UI, config, OSINT lib, and doctor checks.
  • Enhance investigation UX and exports (deduped intake labeling/suppression, no-result autopsy, contradiction surfacing, batch CSV + enriched JSON export).

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/ui-regressions.test.js Updates UI regression assertions for new workflows, panels, engine set, and copy changes.
test/osint.test.js Adds test coverage for new reverse-search engine URL builders.
test/helpers.test.js Adds tests for new document/layout/logo/query helper functions.
styles.css Adds styling for quick/advanced action groups, result suppression, autopsy/contradiction cards, and AI suspicion panel.
server.js Expands doctor engine availability checks to the broader engine list.
README.md Rewrites README with new workflow framing, expanded engine list, and updated run/test guidance.
osint-lib.js Adds reverse-search URL and upload-page mappings for additional engines.
index.html Adds quick actions + advanced drawer, new OCR panels (document/query), new engine buttons, and other UI restructuring.
bluelens-helpers.js Introduces shared document/layout inference and query-spec composition helpers for browser + tests.
bluelens-config.js Updates default engine order/labels/icons to include the new engines.
assets/bluelens-ocean-banner.svg Adds a new README banner asset.
app.js Implements document-mode output, query generator output, intake suppression/autopsy/contradictions, AI suspicion checklist, engine wiring, and batch CSV export.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread index.html
Comment on lines +198 to +203
<img
class="table-art"
src="https://github.com/user-attachments/assets/59733571-36f8-4cec-b18c-52e88b2fb9ea"
alt="BlueLens visual reference"
title="External GitHub attachment retained as a visual reference"
loading="lazy"
Comment thread app.js
Comment on lines +2474 to +2481
<div class="mission-card">
<div class="mission-card-head">
<div>${escapeHtml(item?.label || "Item")}</div>
<div class="mission-card-meta">${escapeHtml(item?.meta || "")}</div>
</div>
<div class="mission-card-lines">${lines.map((line) => `<div>${escapeHtml(line)}</div>`).join("")}</div>
${links.length ? `<div class="mission-card-links">${links.map((link) => `<a class="chip chip-link" href="${escapeAttr(link.url)}" target="_blank" rel="noreferrer">${escapeHtml(link.label || link.url)}</a>`).join("")}</div>` : ""}
</div>
Comment thread app.js
Comment on lines +2514 to +2533
function parseFilenameStem(name) {
if (appHelpers.parseFilenameStem) return appHelpers.parseFilenameStem(name);
const raw = String(name || "").trim().replace(/\.[^.]+$/, "");
return raw.replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim();
}

function getCurrentReconContext() {
return normalizeReconEntities(state.ocrText || "");
}

function summarizeDocumentLayout(text) {
if (appHelpers.summarizeDocumentLayout) return appHelpers.summarizeDocumentLayout(text);
const lines = String(text || "")
.split(/\r?\n/)
.map((line) => line.trim())
.filter(Boolean);
const paragraphBreaks = String(text || "").split(/\n\s*\n/).filter((block) => block.trim()).length;
const headingCandidates = lines.filter((line) => line.length >= 4 && line.length <= 72 && (line === line.toUpperCase() || /^[A-Z][A-Za-z0-9 '&/-]{3,}$/.test(line))).slice(0, 4);
const kvRows = lines.filter((line) => /[:|]/.test(line) || /\b(total|date|name|address|price|receipt|invoice|menu|certificate|issued|expires)\b/i.test(line)).slice(0, 6);
const tableRows = lines.filter((line) => /\d/.test(line) && /[$€£¥]|(?:\s{2,}|\t)|\bqty\b|\btotal\b|\bsubtotal\b/i.test(line)).slice(0, 6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants