Open TimRivoli opened 1 year ago
The chat answers have \n instead of line feeds. That could be a simple string replacement and improve the appearance of the answers.
Have you solved it? I am also suffering from the same symptoms.
@TimRivoli I can have a look but can you be more specific. Where is this happening?
@TimRivoli I can have a look but can you be more specific. Where is this happening?
As shown in the picture above, when gpt answers a question, it does not recognize \n as a line feed and outputs it as is. Do you know a solution?
@TimRivoli I can have a look but can you be more specific. Where is this happening?
As shown in the picture above, when gpt answers a question, it does not recognize \n as a line feed and outputs it as is. Do you know a solution?
Hi, Unfortunately I can't test this code since my API key is some reason does not work in this app. I have tested my key in other apps and works ok with gpt-3.5 but not gpt-4 anyways. Can I ask you to test this with your API key and let me know If it's working. So I could do a proper pull request.
in OpenAIRepositoryImpl change the code at line 83 and 94 and paste this code.
private fun lookupDataFromResponse(jsonString: String): String {
val regex = """"text"\s*:\s*"([^"]+)"""".toRegex()
val matchResult = regex.find(jsonString)
if (matchResult != null && matchResult.groupValues.size > 1) {
val extractedText = matchResult.groupValues[1]
return extractedText.replace("\\n\\n", " ").replace("\\n", " ")
}
return " "
}
@TimRivoli I can have a look but can you be more specific. Where is this happening?
As shown in the picture above, when gpt answers a question, it does not recognize \n as a line feed and outputs it as is. Do you know a solution?
Hi, Unfortunately I can't test this code since my API key is some reason does not work in this app. I have tested my key in other apps and works ok with gpt-3.5 but not gpt-4 anyways. Can I ask you to test this with your API key and let me know If it's working. So I could do a proper pull request.
in OpenAIRepositoryImpl change the code at line 83 and 94 and paste this code.
private fun lookupDataFromResponse(jsonString: String): String { val regex = """"text"\s*:\s*"([^"]+)"""".toRegex() val matchResult = regex.find(jsonString) if (matchResult != null && matchResult.groupValues.size > 1) { val extractedText = matchResult.groupValues[1] return extractedText.replace("\\n\\n", " ").replace("\\n", " ") } return " " }
As a result of testing, it works very well. \n is no longer printed and the replace function works fine. Thank you very much:)
The chat answers have \n instead of line feeds. That could be a simple string replacement and improve the appearance of the answers.