fix(spark-analytics): escape \\n in JS userPrompt strings
Python triple-quoted string interprets \n as literal newlines, producing invalid JS string literals and a SyntaxError that killed the entire script block. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -193,11 +193,11 @@ data:
|
|||||||
+ 'player behaviour, or game dynamics. When column names reference chess openings (ECO codes, opening names), '
|
+ 'player behaviour, or game dynamics. When column names reference chess openings (ECO codes, opening names), '
|
||||||
+ 'explain what those openings are.';
|
+ 'explain what those openings are.';
|
||||||
|
|
||||||
const userPrompt = 'Dataset: "' + dataset.label + '"\n'
|
const userPrompt = 'Dataset: "' + dataset.label + '"\\n'
|
||||||
+ 'Total rows: ' + dataset.total_rows + '\n'
|
+ 'Total rows: ' + dataset.total_rows + '\\n'
|
||||||
+ 'Columns: ' + dataset.headers.join(', ') + '\n\n'
|
+ 'Columns: ' + dataset.headers.join(', ') + '\\n\\n'
|
||||||
+ 'Sample data (first ' + dataset.sample.length + ' rows):\n'
|
+ 'Sample data (first ' + dataset.sample.length + ' rows):\\n'
|
||||||
+ sampleText + '\n\n'
|
+ sampleText + '\\n\\n'
|
||||||
+ 'What does this dataset tell us about chess?';
|
+ 'What does this dataset tell us about chess?';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user