Skip to content

Add Ask AI button for error log analysis#511

Open
whallysson wants to merge 1 commit intoopcodesio:mainfrom
whallysson:feature/ai-export-v2
Open

Add Ask AI button for error log analysis#511
whallysson wants to merge 1 commit intoopcodesio:mainfrom
whallysson:feature/ai-export-v2

Conversation

@whallysson
Copy link
Copy Markdown

@whallysson whallysson commented Mar 15, 2026

Summary

Adds a client-side "Ask AI" button to log entries with danger or warning severity levels, allowing users to quickly export error context to AI assistants for debugging help.

This is a complete rewrite of #469, taking a fundamentally different approach: zero backend, zero config, zero new dependencies. The entire feature runs client-side in a single Vue component (~160 lines).

Changes

  • New file: AskAiButton.vue — Self-contained component with two actions:

    • Copy for AI — Formats the log as structured markdown (level, timestamp, exception class, stack trace, context, analysis prompt) and copies to clipboard via navigator.clipboard with fallback to existing copyToClipboard helper
    • Open in ChatGPT — Opens chatgpt.com/?q= with a truncated version of the prompt (capped at ~1800 chars to stay under browser URL length limits)
  • Modified: BaseLogTable.vue (+7 lines) — Imports AskAiButton and renders it conditionally for danger/warning log levels, in both desktop and mobile layouts

Sensitive data sanitization

Before export, the component redacts:

  • JWT tokens (Bearer eyJ...)
  • API keys, passwords, tokens, secrets (key=value patterns)
  • Credit card numbers (1234-5678-9012-3456)
  • Document numbers (123.456.789-00)
  • Context object keys matching sensitive names (password, api_key, access_token, cvv, etc.)

Design decisions

  • Follows the same patterns as LogCopyButton.vue for consistency (same prop interface, similar UX feedback)
  • No Claude provider — Anthropic removed ?q= URL parameter support in Oct 2025
  • No backend config toggle — the button simply appears for error/warning levels, keeping the implementation minimal
  • No new stores, no API calls, no new routes or controllers

Test Results

All existing tests pass:

Tests: 333 passed (1004 assertions)
Duration: 1.68s

Related

Supersedes #469 (can be closed after merge).

Add a client-side "Ask AI" button to log entries with danger/warning
levels. Users can copy a pre-formatted markdown prompt to clipboard
or open the error directly in ChatGPT for AI-assisted debugging.

- Zero backend changes: all formatting and sanitization happens client-side
- Sanitizes sensitive data (JWT, passwords, API keys, credit cards) before export
- Truncates content for ChatGPT URL to stay within browser URL limits (~2000 chars)
- Follows existing LogCopyButton patterns for consistency
@whallysson whallysson changed the title feat: add Ask AI button for error log analysis Add Ask AI button for error log analysis Mar 15, 2026
@whallysson
Copy link
Copy Markdown
Author

Hi @arukompas, this is a lightweight, fully client-side addition — no backend changes, no new dependencies. Would love your feedback on the approach.

@cmaerz-rdn
Copy link
Copy Markdown

Just went here propose exactly this feature. 👍 Would love to see this soon.

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.

2 participants