Skip to content

Commit 5b305a4

Browse files
committed
improvement(comparisons): order llms-full comparison questions as the page does
Opening questions lead, glance questions follow the at-a-glance table, and the switching question follows the feature table, so each answer comes after the evidence it builds on.
1 parent a68fc67 commit 5b305a4

2 files changed

Lines changed: 35 additions & 17 deletions

File tree

‎apps/sim/app/(landing)/comparisons/utils.ts‎

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,20 +184,33 @@ export function betterThanQuestion(competitor: CompetitorProfile): string {
184184
}
185185

186186
/**
187-
* Every buyer question the page answers in its own section, in page order: the lead question,
188-
* the "better than" question, then the intro, glance, and closing questions.
187+
* The buyer questions the page answers in their own sections, grouped by position: `opening`
188+
* (the lead, "better than", and intro questions) ahead of the product definitions, `glance`
189+
* after the at-a-glance table, and `closing` after the documented limitations.
189190
*/
190-
export function getQuestionSections(competitor: CompetitorProfile): ComparisonQuestion[] {
191+
export function getQuestionSectionGroups(competitor: CompetitorProfile): {
192+
opening: ComparisonQuestion[]
193+
glance: ComparisonQuestion[]
194+
closing: ComparisonQuestion[]
195+
} {
191196
const { leadQuestion, leadAnswer, betterThanAnswer, questions } = competitor
192-
return [
193-
...(leadQuestion && leadAnswer ? [{ question: leadQuestion, answer: leadAnswer }] : []),
194-
...(betterThanAnswer
195-
? [{ question: betterThanQuestion(competitor), answer: betterThanAnswer }]
196-
: []),
197-
...(questions?.intro ?? []),
198-
...(questions?.glance ?? []),
199-
...(questions?.closing ?? []),
200-
]
197+
return {
198+
opening: [
199+
...(leadQuestion && leadAnswer ? [{ question: leadQuestion, answer: leadAnswer }] : []),
200+
...(betterThanAnswer
201+
? [{ question: betterThanQuestion(competitor), answer: betterThanAnswer }]
202+
: []),
203+
...(questions?.intro ?? []),
204+
],
205+
glance: questions?.glance ?? [],
206+
closing: questions?.closing ?? [],
207+
}
208+
}
209+
210+
/** Every question from {@link getQuestionSectionGroups}, in page order. */
211+
function getQuestionSections(competitor: CompetitorProfile): ComparisonQuestion[] {
212+
const { opening, glance, closing } = getQuestionSectionGroups(competitor)
213+
return [...opening, ...glance, ...closing]
201214
}
202215

203216
function proseToText(prose: Prose): string {

‎apps/sim/app/llms-full.txt/route.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CREDIT_TIERS } from '@/lib/billing/constants'
2-
import type { CompetitorProfile, Fact, Prose } from '@/lib/compare/data'
2+
import type { ComparisonQuestion, CompetitorProfile, Fact, Prose } from '@/lib/compare/data'
33
import { simProfile } from '@/lib/compare/data'
44
import { toSiteUrl } from '@/lib/core/utils/urls'
55
import { getAllCustomerStoryMeta, getCustomerStorySource } from '@/lib/customers/registry'
@@ -13,7 +13,7 @@ import {
1313
ALL_COMPETITORS,
1414
buildBottomLine,
1515
getLatestVerifiedDate,
16-
getQuestionSections,
16+
getQuestionSectionGroups,
1717
SIM_LATEST_VERIFIED,
1818
} from '@/app/(landing)/comparisons/utils'
1919
import { PLATFORM_MENU } from '@/app/(landing)/components/navbar/components/nav-menu-chip'
@@ -81,8 +81,13 @@ function isoDate(date: Date): string {
8181
}
8282

8383
/** The key facts of one `/comparisons/{id}` page as markdown, from the same profile data. */
84+
function questionMarkdown({ question, answer }: ComparisonQuestion): string {
85+
return `**${question}**\n\n${proseToMarkdown(answer)}`
86+
}
87+
8488
function comparisonMarkdown(competitor: CompetitorProfile): string {
8589
const verdict = buildBottomLine(competitor)
90+
const questions = getQuestionSectionGroups(competitor)
8691
const verified = new Date(
8792
Math.max(SIM_LATEST_VERIFIED.getTime(), getLatestVerifiedDate(competitor).getTime())
8893
)
@@ -100,9 +105,7 @@ function comparisonMarkdown(competitor: CompetitorProfile): string {
100105
`URL: ${toSiteUrl(`/comparisons/${competitor.id}`)} · Facts last verified ${isoDate(verified)}`,
101106
`${competitor.name}: ${competitor.oneLiner}`,
102107
competitor.leadAnswer && !competitor.leadQuestion ? proseToMarkdown(competitor.leadAnswer) : '',
103-
...getQuestionSections(competitor).map(
104-
({ question, answer }) => `**${question}**\n\n${proseToMarkdown(answer)}`
105-
),
108+
...questions.opening.map(questionMarkdown),
106109
competitor.glance
107110
? [
108111
`| Decision point | Sim | ${competitor.name} |`,
@@ -113,6 +116,7 @@ function comparisonMarkdown(competitor: CompetitorProfile): string {
113116
),
114117
].join('\n')
115118
: '',
119+
...questions.glance.map(questionMarkdown),
116120
`- ${verdict.chooseSim}\n- ${verdict.chooseCompetitor}`,
117121
competitor.standoutFeatures.length > 0
118122
? `Standout features of ${competitor.name}:\n\n${competitor.standoutFeatures.map((f) => `- ${f.title}: ${f.description}`).join('\n')}`
@@ -121,6 +125,7 @@ function comparisonMarkdown(competitor: CompetitorProfile): string {
121125
? `Documented limitations of ${competitor.name}:\n\n${competitor.limitations.map((l) => `- ${l.title}: ${l.description}`).join('\n')}`
122126
: '',
123127
[`| Feature | Sim | ${competitor.name} |`, '| --- | --- | --- |', ...rows].join('\n'),
128+
...questions.closing.map(questionMarkdown),
124129
]
125130
.filter(Boolean)
126131
.join('\n\n')

0 commit comments

Comments
 (0)