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:
@@ -9,6 +9,7 @@ import { useFileUpload } from '@/hooks/useFileUpload';
|
||||
import { useTaskPolling } from '@/hooks/useTaskPolling';
|
||||
import { generateToolSchema } from '@/utils/seo';
|
||||
import { useFileStore } from '@/stores/fileStore';
|
||||
import { dispatchRatingPrompt } from '@/utils/ratingPrompt';
|
||||
|
||||
export default function ChatPdf() {
|
||||
const { t } = useTranslation();
|
||||
@@ -30,7 +31,8 @@ export default function ChatPdf() {
|
||||
taskId,
|
||||
onComplete: (r) => {
|
||||
setPhase('done');
|
||||
setReply((r as Record<string, unknown>).reply as string || '');
|
||||
setReply(r.reply || '');
|
||||
dispatchRatingPrompt('chat-pdf');
|
||||
},
|
||||
onError: () => setPhase('done'),
|
||||
});
|
||||
|
||||
@@ -17,6 +17,7 @@ import ManualProcedure from './pdf-flowchart/ManualProcedure';
|
||||
import FlowGeneration from './pdf-flowchart/FlowGeneration';
|
||||
import FlowChart from './pdf-flowchart/FlowChart';
|
||||
import FlowChat from './pdf-flowchart/FlowChat';
|
||||
import { dispatchRatingPrompt } from '@/utils/ratingPrompt';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Component
|
||||
@@ -150,6 +151,7 @@ export default function PdfFlowchart() {
|
||||
|
||||
const handleGenerationDone = () => {
|
||||
setStep(3);
|
||||
dispatchRatingPrompt('pdf-flowchart');
|
||||
};
|
||||
|
||||
const handleFlowUpdate = (updated: Flowchart) => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import AdSlot from '@/components/layout/AdSlot';
|
||||
import { useTaskPolling } from '@/hooks/useTaskPolling';
|
||||
import { generateToolSchema } from '@/utils/seo';
|
||||
import api, { type TaskResponse, type TaskResult } from '@/services/api';
|
||||
import { dispatchRatingPrompt } from '@/utils/ratingPrompt';
|
||||
|
||||
export default function QrCodeGenerator() {
|
||||
const { t } = useTranslation();
|
||||
@@ -113,6 +114,7 @@ export default function QrCodeGenerator() {
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<a href={downloadUrl} download={result.filename || 'qrcode.png'}
|
||||
onClick={() => dispatchRatingPrompt('qr-code')}
|
||||
className="btn-primary flex-1">{t('common.download')}</a>
|
||||
<button onClick={handleReset} className="btn-secondary flex-1">{t('common.startOver')}</button>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useFileUpload } from '@/hooks/useFileUpload';
|
||||
import { useTaskPolling } from '@/hooks/useTaskPolling';
|
||||
import { generateToolSchema } from '@/utils/seo';
|
||||
import { useFileStore } from '@/stores/fileStore';
|
||||
import { dispatchRatingPrompt } from '@/utils/ratingPrompt';
|
||||
|
||||
export default function SummarizePdf() {
|
||||
const { t } = useTranslation();
|
||||
@@ -30,7 +31,8 @@ export default function SummarizePdf() {
|
||||
taskId,
|
||||
onComplete: (r) => {
|
||||
setPhase('done');
|
||||
setSummary((r as Record<string, unknown>).summary as string || '');
|
||||
setSummary(r.summary || '');
|
||||
dispatchRatingPrompt('summarize-pdf');
|
||||
},
|
||||
onError: () => setPhase('done'),
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useFileUpload } from '@/hooks/useFileUpload';
|
||||
import { useTaskPolling } from '@/hooks/useTaskPolling';
|
||||
import { generateToolSchema } from '@/utils/seo';
|
||||
import { useFileStore } from '@/stores/fileStore';
|
||||
import { dispatchRatingPrompt } from '@/utils/ratingPrompt';
|
||||
|
||||
interface ExtractedTable {
|
||||
page: number;
|
||||
@@ -35,8 +36,9 @@ export default function TableExtractor() {
|
||||
taskId,
|
||||
onComplete: (r) => {
|
||||
setPhase('done');
|
||||
const raw = (r as Record<string, unknown>).tables;
|
||||
const raw = r.tables;
|
||||
if (Array.isArray(raw)) setTables(raw as ExtractedTable[]);
|
||||
dispatchRatingPrompt('extract-tables');
|
||||
},
|
||||
onError: () => setPhase('done'),
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useFileUpload } from '@/hooks/useFileUpload';
|
||||
import { useTaskPolling } from '@/hooks/useTaskPolling';
|
||||
import { generateToolSchema } from '@/utils/seo';
|
||||
import { useFileStore } from '@/stores/fileStore';
|
||||
import { dispatchRatingPrompt } from '@/utils/ratingPrompt';
|
||||
|
||||
const LANGUAGES = [
|
||||
{ value: 'en', label: 'English' },
|
||||
@@ -45,7 +46,8 @@ export default function TranslatePdf() {
|
||||
taskId,
|
||||
onComplete: (r) => {
|
||||
setPhase('done');
|
||||
setTranslation((r as Record<string, unknown>).translation as string || '');
|
||||
setTranslation(r.translation || '');
|
||||
dispatchRatingPrompt('translate-pdf');
|
||||
},
|
||||
onError: () => setPhase('done'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user