{#if showAnalyzer}

๐Ÿ” Advanced RFP Question Analysis

Get comprehensive analysis with structured previous answers, AI-generated responses considering stress points, gap analysis, and actionable suggestions.

d.text).join('\n') || ''} />
{:else}
{#if availableCategories.length > 0}

Reference Document Category

{#each availableCategories as category} {@const categoryDocs = $referenceDocuments.filter(doc => doc.category === category)} {/each}

AI will only reference documents from the selected category when generating answers.

{/if}

Question {currentQuestionIndex + 1} of {questionsToProcess.length}

{#if currentQuestion}
{currentQuestion.text}

Choose Answer Source

Previous RFP Answers
{#if previousAnswers.length > 0}
{#each previousAnswers as answer, index}
๐Ÿ“„ {answer.documentSource || answer.docName}
{answer.matchPercentage}%
match
{answer.category || 'General'} ๐Ÿ“ Page {answer.pageNumber || 'N/A'} {#if answer.source === 'regex-pattern'} ๐Ÿ“‹ Regex Match {:else if answer.source === 'vector-search'} ๐Ÿง  Vector Match {/if} {#if answer.isExactMatch} โœ… EXACT MATCH {/if} {#if answer.extractionStrategy} {answer.extractionStrategy} {/if}
{#if answer.question && answer.answer}
{#if answer.source === 'vector-search' && answer.matchedKeywords && answer.matchedKeywords.length > 0}
Matched keywords: {#each answer.matchedKeywords as keyword} {keyword} {/each}
{/if} {#if answer.question !== 'Relevant Content'}
Original Question:
"{answer.question}"
{/if}
Complete Answer:
{#if selectedAnswerType === 'previous'} {/if}
{#if formattedAnswers.has(`${answer.docName}-${answer.question.substring(0, 50)}`)} {@const formattedAnswer = formattedAnswers.get(`${answer.docName}-${answer.question.substring(0, 50)}`)}
AI-Formatted Answer
{#each (formattedAnswer.formattedAnswer || formattedAnswer.answer).split('\n\n') as paragraph} {#if paragraph.trim()}

{@html paragraph.trim().replace(/\n/g, '
')}

{/if} {/each}
View Original Answer
{#each answer.answer.split('\n\n') as paragraph} {#if paragraph.trim()}

{@html paragraph.trim().replace(/\n/g, '
')}

{/if} {/each}
{:else}
{#each answer.answer.split('\n\n') as paragraph} {#if paragraph.trim()}

{@html paragraph.trim().replace(/\n/g, '
')}

{/if} {/each}
{/if}
{:else}
{answer.content}
{/if}
Matched words: {#if answer.matchedWords && answer.matchedWords.length > 0} {answer.matchedWords.slice(0, 5).join(', ')} {#if answer.matchedWords.length > 5} +{answer.matchedWords.length - 5} more {/if} {:else} Content-based match {/if}
Type: {answer.sectionType || 'content'} | Strategy: {answer.extractionStrategy || answer.source || 'extraction'} {#if answer.documentSource} | Source: {answer.documentSource} {/if}
{/each}
Search Summary: Found {previousAnswers.length} relevant matches {#if previousAnswers.some(a => a.isExactMatch)} โ€ข Contains exact question match! {/if} {#if previousAnswers.filter(a => a.matchPercentage >= 80).length > 0} โ€ข {previousAnswers.filter(a => a.matchPercentage >= 80).length} high-confidence matches {/if}
{:else}
{#if referenceDocsWithContent.length === 0}
No reference documents loaded yet...
Documents available: {$referenceDocuments.length}
{#if $referenceDocuments.length > 0}
{#each $referenceDocuments as doc}
โ€ข {doc.name} ({doc.fileType || 'unknown type'})
{/each}
{/if}
{:else}
No relevant previous answers found for this question
Searched {referenceDocsWithContent.length} documents with content:
{#each referenceDocsWithContent as doc}
โ€ข {doc.name}: {doc.content?.length || 0} characters
{/each}
Check browser console for detailed search logs
{/if}
{/if}
AI Generated Answer {#if currentAnswer && currentAnswer.isFormatted} AI-Formatted {/if} {#if currentAnswer && currentAnswer.hasAdditionalInfo} Enhanced {/if}
{#if currentAnswer && (currentAnswer.finalAnswer || currentAnswer.aiGeneratedAnswer)}
{#if currentAnswer.isFormatted && currentAnswer.finalAnswer}
AI-Enhanced Answer
{currentAnswer.finalAnswer}
View Original Generated Answer
{currentAnswer.aiGeneratedAnswer}
{:else}
{currentAnswer.finalAnswer || currentAnswer.aiGeneratedAnswer}
{/if} {#if currentAnswer.citations && currentAnswer.citations.length > 0}
Citations:
{#each currentAnswer.citations as citation}
โ€ข {citation}
{/each}
{/if}
Add Additional Information for AI Processing:
{:else if $isLoading}
Generating and formatting AI answer in real-time...
{:else}
AI-generated answer will appear here after clicking "Generate Answer"...
{/if}
Suggestions
โ€ข Include specific metrics and KPIs
โ€ข Add relevant case studies or examples
โ€ข Mention compliance and security standards
{/if}
{#each questionsToProcess as question, index} {/each}

AI Answer Generation

Searches previous RFP responses for relevant content
Provides citations with source and page numbers
Suggests improvements based on new RFP context
Allows full editing before finalization
{#if $isLoading}
Generating AI Answers
This may take a few moments...
{/if}
{/if}