Update webviewer-redaction-ai per demo meeting#88
Update webviewer-redaction-ai per demo meeting#88Mohammed-AbdulRahman-Apryse wants to merge 9 commits intomainfrom
Conversation
This re-engineering serves: 1. Capture unidentifiable fields, e.g. unlabeled phone number in the document text. 2. Classify result, e.g. Person: Linda Nelson, Phone: 291 555 5555, Address: 18th Floor, 2822 Glenoaks St. 3. Redaction processing reads the classified results.
Expose live information while performing PII redaction: - Document name - LLM Model name - LLM input (prompt submission) - Response messages - Status
…s for The sample parses the PII result using classification, so this has been reflected to the mocked data to use by e2e tests.
1. Configuration - describe the credential parameters. 2. Chat Model Swapping - how to swap the default used chat model (OpenAI) by other chat models. 3. Sample architecture.
There was a problem hiding this comment.
Pull request overview
Updates the webviewer-redaction-ai sample to improve person-name extraction (including middle initials) and to support a labeled “Type: Value” response format, along with adding an AI panel UI for visibility into prompts/results.
Changes:
- Switch guardrail prompting from
assistantPrompttosystemPrompt, and update PII classification details/rules to produce labeled findings. - Add an AI Panel (UI + styles) and a new server
/api/configendpoint to surface model/prompt info to the client. - Update redaction parsing to use labeled output (
Label: value) and adjust mocks/tests accordingly.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| webviewer-redaction-ai/server/handler.js | Builds system prompt, validates analysis results, adds /api/config endpoint for client configuration display. |
| webviewer-redaction-ai/server/config.json | Updates prompt key to systemPrompt, expands person-name detail to include middle initials, revises rules to require labels. |
| webviewer-redaction-ai/client/redaction.js | Parses labeled AI output and uses the value portion for searching/redaction; sets overlay/contents to label. |
| webviewer-redaction-ai/client/document/analyzer.js | Stores the latest API step result in globalThis.aiAnalysisResult. |
| webviewer-redaction-ai/client/document/manager.js | Tracks loaded document filename for display in the AI panel. |
| webviewer-redaction-ai/client/index.js | Loads AI panel, fetches config, shows panel on document load, and adds CSS file. |
| webviewer-redaction-ai/client/globals.js | Adds globalThis.aiPanel. |
| webviewer-redaction-ai/client/ui/custom.json | Registers the new aiPanel modular panel. |
| webviewer-redaction-ai/client/ui/functionMap.js | Adds aiPanelRender and updates the AI redaction click handler to add chat bubbles + status. |
| webviewer-redaction-ai/client/ui/aiPanel.js | New AI panel component that renders model/document info and chat bubbles. |
| webviewer-redaction-ai/client/ui/styles.css | New styles for AI panel and message bubbles. |
| webviewer-redaction-ai/mocks/webviewer-redaction-ai.mock.js | Updates mocked analysis output to labeled Type: Value lines. |
| webviewer-redaction-ai/tests/e2e/webviewer-redaction-ai.spec.js | Adds an e2e test for AI panel visibility and mocked workflow calls. |
| webviewer-redaction-ai/README.md | Expands setup/configuration docs and adds a sample image; adds chat-model swapping and architecture notes. |
| webviewer-redaction-ai/mainsamplesource.json | Adds new UI files to the sample source manifest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1. Removed periods and added ".html" occurrence to the link in Readme. 2. Adding security level to control exposing LLM model name and the passed prompt to LLM. The affected files are server/handler.js and .env.example. 3. Corrected the description of Playwright e2e test 'AI Panel renders the expected results'. 4. Improved the splitting of piiEntity on the first colon only and skipping/handling lines that don't match the expected Label: value format. 5. Fixed a potential null reference by handling analyzeDocumentForPII() failure cases.
|
DavidEGutierrez
left a comment
There was a problem hiding this comment.
Tested locally passes e2e, code works, and PIIs are found and redacted, panel works.
There is an error message that would be related to my environment as I get an error message on the panel: "Unauthorized access to systems prompt".






Description
Identify person names with middle initials.
Resources
Checklist
If you are adding a new sample
lerna.jsonwith the new sample nameIf you are removing an old sample
lerna.json