@@ -48,7 +48,7 @@ public function generateTextDocument(?string $userId, string $description, strin
4848 $ converter = new GithubFlavoredMarkdownConverter ();
4949 $ htmlContent = $ converter ->convert ($ markdownContent )->getContent ();
5050 $ htmlStream = $ this ->stringToStream ($ htmlContent );
51- $ docxContent = $ this ->remoteService ->convertTo ('document.html ' , $ htmlStream , $ targetFormat, true );
51+ $ docxContent = $ this ->remoteService ->convertTo ('document.html ' , $ htmlStream , $ targetFormat );
5252
5353 return $ docxContent ;
5454 }
@@ -58,7 +58,19 @@ public function generateSpreadSheetDocument(?string $userId, string $description
5858 $ taskInput = $ prompt . "\n\n" . $ description ;
5959 $ csvContent = $ this ->runTextToTextTask ($ taskInput , $ userId );
6060 $ csvStream = $ this ->stringToStream ($ csvContent );
61- $ xlsxContent = $ this ->remoteService ->convertTo ('document.csv ' , $ csvStream , $ targetFormat , true );
61+
62+ // Passing these will ensure the CSV is correctly
63+ // parsed into a spreadsheet
64+ $ conversionOptions = [
65+ // Sets the input filter to use the following:
66+ // 44 - , (comma) as the field separator
67+ // 34 - " (double quote) as the text delimiter
68+ // 76 - UTF-8 as the character set
69+ // 1 - Start at line one of the input
70+ 'infilterOptions ' => '44,34,76,1 ' ,
71+ ];
72+
73+ $ xlsxContent = $ this ->remoteService ->convertTo ('document.csv ' , $ csvStream , $ targetFormat , $ conversionOptions );
6274
6375 return $ xlsxContent ;
6476 }
0 commit comments