feat: Implement rating prompt feature across tools

- Added a rating prompt dispatch mechanism to various tools (ChatPdf, PdfFlowchart, QrCodeGenerator, SummarizePdf, TranslatePdf, TableExtractor) to encourage user feedback after tool usage.
- Introduced a new utility for handling rating prompts, including event dispatching and current tool identification.
- Updated the ToolRating component to manage user feedback submission, including UI enhancements and state management.
- Enhanced the sitemap generation script to include new routes for pricing and blog pages.
- Removed hardcoded API key in pdf_ai_service.py for improved security.
- Added a project status report documenting current implementation against the roadmap.
- Updated translations for rating prompts in Arabic, English, and French.
- Ensured consistency in frontend route registry and backend task processing.
This commit is contained in:
Your Name
2026-03-10 23:52:56 +02:00
parent a14c31c594
commit d4c7195eeb
19 changed files with 628 additions and 119 deletions

View File

@@ -14,42 +14,68 @@ from datetime import datetime
# ─── Route definitions with priority and changefreq ──────────────────────────
PAGES = [
{'path': '/', 'changefreq': 'daily', 'priority': '1.0'},
{'path': '/about', 'changefreq': 'monthly', 'priority': '0.4'},
{'path': '/contact', 'changefreq': 'monthly', 'priority': '0.4'},
{'path': '/privacy', 'changefreq': 'yearly', 'priority': '0.3'},
{'path': '/terms', 'changefreq': 'yearly', 'priority': '0.3'},
{'path': '/', 'changefreq': 'daily', 'priority': '1.0'},
{'path': '/about', 'changefreq': 'monthly', 'priority': '0.4'},
{'path': '/contact', 'changefreq': 'monthly', 'priority': '0.4'},
{'path': '/privacy', 'changefreq': 'yearly', 'priority': '0.3'},
{'path': '/terms', 'changefreq': 'yearly', 'priority': '0.3'},
{'path': '/pricing', 'changefreq': 'monthly', 'priority': '0.7'},
{'path': '/blog', 'changefreq': 'weekly', 'priority': '0.6'},
]
# PDF Tools
PDF_TOOLS = [
'pdf-to-word', 'word-to-pdf', 'compress-pdf', 'merge-pdf',
'split-pdf', 'rotate-pdf', 'pdf-to-images', 'images-to-pdf',
'watermark-pdf', 'remove-watermark-pdf', 'protect-pdf', 'unlock-pdf',
'page-numbers', 'reorder-pdf', 'extract-pages', 'pdf-editor',
'pdf-flowchart', 'pdf-to-excel',
{'slug': 'pdf-to-word', 'priority': '0.9'},
{'slug': 'word-to-pdf', 'priority': '0.9'},
{'slug': 'compress-pdf', 'priority': '0.9'},
{'slug': 'merge-pdf', 'priority': '0.9'},
{'slug': 'split-pdf', 'priority': '0.8'},
{'slug': 'rotate-pdf', 'priority': '0.7'},
{'slug': 'pdf-to-images', 'priority': '0.8'},
{'slug': 'images-to-pdf', 'priority': '0.8'},
{'slug': 'watermark-pdf', 'priority': '0.7'},
{'slug': 'remove-watermark-pdf','priority': '0.7'},
{'slug': 'protect-pdf', 'priority': '0.8'},
{'slug': 'unlock-pdf', 'priority': '0.8'},
{'slug': 'page-numbers', 'priority': '0.7'},
{'slug': 'reorder-pdf', 'priority': '0.7'},
{'slug': 'extract-pages', 'priority': '0.7'},
{'slug': 'pdf-editor', 'priority': '0.8'},
{'slug': 'pdf-flowchart', 'priority': '0.7'},
{'slug': 'pdf-to-excel', 'priority': '0.8'},
]
# Image Tools
IMAGE_TOOLS = [
'image-converter', 'image-resize', 'compress-image', 'remove-background',
{'slug': 'image-converter', 'priority': '0.8'},
{'slug': 'image-resize', 'priority': '0.8'},
{'slug': 'compress-image', 'priority': '0.8'},
{'slug': 'remove-background', 'priority': '0.8'},
]
# AI Tools
AI_TOOLS = [
'ocr', 'chat-pdf', 'summarize-pdf', 'translate-pdf', 'extract-tables',
{'slug': 'ocr', 'priority': '0.8'},
{'slug': 'chat-pdf', 'priority': '0.8'},
{'slug': 'summarize-pdf', 'priority': '0.8'},
{'slug': 'translate-pdf', 'priority': '0.8'},
{'slug': 'extract-tables', 'priority': '0.8'},
]
# Convert / Utility Tools
UTILITY_TOOLS = [
'html-to-pdf', 'qr-code', 'video-to-gif', 'word-counter', 'text-cleaner',
{'slug': 'html-to-pdf', 'priority': '0.7'},
{'slug': 'qr-code', 'priority': '0.7'},
{'slug': 'video-to-gif', 'priority': '0.7'},
{'slug': 'word-counter', 'priority': '0.6'},
{'slug': 'text-cleaner', 'priority': '0.6'},
]
TOOL_GROUPS = [
('PDF Tools', PDF_TOOLS, '0.9'),
('Image Tools', IMAGE_TOOLS, '0.8'),
('AI Tools', AI_TOOLS, '0.8'),
('Utility Tools', UTILITY_TOOLS, '0.7'),
('PDF Tools', PDF_TOOLS),
('Image Tools', IMAGE_TOOLS),
('AI Tools', AI_TOOLS),
('Utility Tools', UTILITY_TOOLS),
]
@@ -67,14 +93,14 @@ def generate_sitemap(domain: str) -> str:
</url>''')
# Tool pages by category
for label, slugs, priority in TOOL_GROUPS:
for label, routes in TOOL_GROUPS:
urls.append(f'\n <!-- {label} -->')
for slug in slugs:
for route in routes:
urls.append(f''' <url>
<loc>{domain}/tools/{slug}</loc>
<loc>{domain}/tools/{route["slug"]}</loc>
<lastmod>{today}</lastmod>
<changefreq>weekly</changefreq>
<priority>{priority}</priority>
<priority>{route["priority"]}</priority>
</url>''')
sitemap = f'''<?xml version="1.0" encoding="UTF-8"?>
@@ -97,7 +123,7 @@ def main():
with open(args.output, 'w', encoding='utf-8') as f:
f.write(sitemap)
total = len(PAGES) + sum(len(slugs) for _, slugs, _ in TOOL_GROUPS)
total = len(PAGES) + sum(len(routes) for _, routes in TOOL_GROUPS)
print(f"Sitemap generated: {args.output}")
print(f"Total URLs: {total}")