Skip to content

Commit 85e8dec

Browse files
committed
improvement(chat): guard question answer formatting against sparse arrays
1 parent a6890d3 commit 85e8dec

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/question

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/question/question.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import type { QuestionItem } from '@/app/workspace/[workspaceId]/home/components
1010
* `Prompt — Answer` line per question.
1111
*/
1212
export function formatQuestionAnswerMessage(questions: QuestionItem[], answers: string[]): string {
13-
if (questions.length === 1) return answers[0]
14-
return questions.map((q, i) => `${q.prompt}${answers[i]}`).join('\n')
13+
if (questions.length === 1) return answers[0] ?? ''
14+
return questions.map((q, i) => `${q.prompt}${answers[i] ?? ''}`).join('\n')
1515
}
1616

1717
/**

0 commit comments

Comments
 (0)