当我使用GPT3的游乐场时,经常会得到带有编号列表和段落格式的结果,如下所示:
Here's what the above class is doing:1. It creates a directory for the log file if it doesn't exist.2. It checks that the log file is newline-terminated.3. It writes a newline-terminated JSON object to the log file.4. It reads the log file and returns a dictionary with the following- list 1- list 2- list 3- list 4
然而,当我直接使用他们的API并从JSON结果中提取响应时,我得到的是压缩的文本版本,非常难读,类似这样:
Here's what the above class is doing:1. It creates a directory for the log file if it doesn't exist.2. It checks that the log file is newline-terminated.3. It writes a newline-terminated JSON object to the log file.4. It reads the log file and returns a dictionary with the following-list 1-list 2-list 3- list4
我的问题是,人们如何保持GPT结果的格式,以便它们以更整洁、更易读的方式显示?
回答:
问题出在我这边的前端。OpenAI API返回了正确的响应,而我使用了错误的空白CSS设置来渲染结果