Skip to content

Commit

Permalink
Remove new lines from llm output
Browse files Browse the repository at this point in the history
  • Loading branch information
Aegeontis committed Oct 18, 2024
1 parent 001d42e commit 39e2e57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/backend/llm_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ Future<void> isolateQueryOpenRouter(SendPort sendPort) async {
String resultBody =
responseMap["choices"][0]["message"]["content"].trim();
if (resultBody.isNotEmpty) {
// fix some special chars
print("LLM Response: Raw response: $resultBody");
// fix some special chars
resultBody = resultBody
.replaceAll("ö", "ö")
.replaceAll("ü", "ü")
.replaceAll("ü", "ä")
.replaceAll("ä", "ä")
.replaceAll("ß", "ß");
// remove new lines
resultBody = resultBody.replaceAll("\n", " ");
resultsPort.send(resultBody);
} else {
throw Exception("LLM Response: Response didn't include LLM answer");
Expand Down

0 comments on commit 39e2e57

Please # to comment.