(sectionId)
| 767 | } |
| 768 | |
| 769 | function getSectionGuide(sectionId) { |
| 770 | const section = findSectionOrThrow(sectionId); |
| 771 | const templates = getFieldSuggestionsForSection(section.id); |
| 772 | const missingFields = templates |
| 773 | .map((item) => item.field) |
| 774 | .filter((field) => { |
| 775 | const value = section.content?.[field]; |
| 776 | return !safeString(value).trim() || isSamplePlaceholder(value); |
| 777 | }); |
| 778 | return { |
| 779 | sectionId: section.id, |
| 780 | sectionName: section.name, |
| 781 | suggestedFields: templates, |
| 782 | fieldSchemas: stateCache.sectionSchemas?.[section.id] || {}, |
| 783 | missingFields, |
| 784 | nextSuggestedQuestion: templates.find((item) => missingFields.includes(item.field))?.prompt ?? null, |
| 785 | }; |
| 786 | } |
| 787 | |
| 788 | function detectSectionIdFromPrompt(prompt) { |
| 789 | const normalized = prompt.toLowerCase(); |
no test coverage detected