mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-04-25 13:55:53 +03:00
[PR #776] [MERGED] feat: add AI email extraction with Cloudflare Workers AI #756
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/cloudflare_temp_email#756
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dreamhunter2333/cloudflare_temp_email/pull/776
Author: @dreamhunter2333
Created: 12/6/2025
Status: ✅ Merged
Merged: 12/6/2025
Merged by: @dreamhunter2333
Base:
main← Head:feature/email📝 Commits (2)
410400afeat: add AI email extraction with Cloudflare Workers AI06866f9feat: upgrade dependencies📊 Changes
27 files changed (+2475 additions, -1639 deletions)
View changed files
➕
db/2025-12-06-metadata.sql(+4 -0)📝
db/schema.sql(+1 -0)📝
frontend/package.json(+8 -8)📝
frontend/pnpm-lock.yaml(+823 -633)➕
frontend/src/components/AiExtractInfo.vue(+145 -0)📝
frontend/src/components/MailBox.vue(+3 -0)📝
frontend/src/components/MailContentRenderer.vue(+4 -0)📝
frontend/src/views/Admin.vue(+6 -0)➕
frontend/src/views/admin/AiExtractSettings.vue(+125 -0)📝
pages/package.json(+1 -1)📝
vitepress-docs/docs/.vitepress/en.ts(+1 -0)📝
vitepress-docs/docs/.vitepress/zh.ts(+1 -0)➕
vitepress-docs/docs/en/guide/feature/ai-extract.md(+70 -0)📝
vitepress-docs/docs/en/guide/worker-vars.md(+57 -57)➕
vitepress-docs/docs/zh/guide/feature/ai-extract.md(+70 -0)📝
vitepress-docs/package.json(+1 -1)📝
vitepress-docs/pnpm-lock.yaml(+483 -473)📝
worker/package.json(+6 -6)📝
worker/pnpm-lock.yaml(+375 -458)➕
worker/src/admin_api/ai_extract_settings.ts(+27 -0)...and 7 more files
📄 Description
User description
Summary
Add AI-powered email content extraction feature using Cloudflare Workers AI to automatically identify and extract important information from emails.
Features
Changes
Backend
worker/src/email/ai_extract.ts- Core AI extraction logic with priority-based extractionworker/src/admin_api/ai_extract_settings.ts- Admin API for allowlist configurationworker/src/email/index.ts- Integrate AI extraction into email processing workflowdb/2025-12-06-metadata.sql- Add metadata TEXT fieldworker/src/constants.ts- Add DB_VERSION v0.0.4 and AI_EXTRACT_SETTINGS_KEYworker/src/types.d.ts- Add AI binding and environment variablesFrontend
frontend/src/components/AiExtractInfo.vue- Reusable component for displaying AI extraction resultsfrontend/src/views/admin/AiExtractSettings.vue- Admin settings page for allowlist configurationfrontend/src/components/MailBox.vue- Show AI info in email list (compact mode)frontend/src/components/MailContentRenderer.vue- Show AI info in email detail viewfrontend/src/views/Admin.vue- Add AI Extract Settings tabDocumentation
vitepress-docs/docs/zh/guide/feature/ai-extract.md- Chinese documentationvitepress-docs/docs/en/guide/feature/ai-extract.md- English documentationworker/wrangler.toml.template- Add AI binding and environment variablesConfiguration
Environment Variables
ENABLE_AI_EMAIL_EXTRACT: Enable/disable AI extraction (default: false)AI_EXTRACT_MODEL: AI model to use (default: @cf/meta/llama-3.1-8b-instruct)Worker Bindings
```toml
[ai]
binding = "AI"
```
Extraction Types (Priority Order)
auth_code- Verification codes (OTP, security codes)auth_link- Authentication links (login, verify, activate, reset password)service_link- Service-related links (GitHub, GitLab, deployment notifications)subscription_link- Subscription management links (unsubscribe)other_link- Other valuable linksnone- No relevant content foundTechnical Highlights
Test Plan
Breaking Changes
None. This is a new feature with backward compatibility.
References
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
PR Type
Enhancement, Documentation
Description
Introduced AI-powered email content extraction using Cloudflare Workers AI.
Added frontend components to display extracted email information.
Implemented admin settings for AI extraction configuration.
Updated database schema to include metadata for AI extraction results.
Changes walkthrough 📝
13 files
New component for displaying AI extraction results.Integrated AI extraction info into email list view.Integrated AI extraction info into email detail view.Added AI Extract Settings tab in admin view.New admin settings page for AI extraction configuration.Backend API for AI extraction settings management.Database migration logic for metadata column.Registered AI extraction settings API endpoints.Core logic for AI-powered email content extraction.Integrated AI extraction into email processing workflow.Added types for AI extraction configuration and bindings.SQL script to add metadata column for AI extraction results.Updated schema to include metadata column.6 files
Added AI Email Recognition to English sidebar.Added AI 邮件识别 to Chinese sidebar.Updated changelog for v1.1.0 with AI extraction feature.English documentation for AI email recognition feature.Documented AI extraction-related variables in English.Chinese documentation for AI email recognition feature.2 files
Added constants for AI extraction settings.Added AI extraction configuration to template.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.