From 39e2e57fd4f5b81580557f2d0cc8c789fad0a84d Mon Sep 17 00:00:00 2001 From: Aegeontis <140899260+Aegeontis@users.noreply.github.com> Date: Sat, 19 Oct 2024 00:10:36 +0200 Subject: [PATCH] Remove new lines from llm output --- lib/backend/llm_interface.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/backend/llm_interface.dart b/lib/backend/llm_interface.dart index 0db4ad7..0dab114 100644 --- a/lib/backend/llm_interface.dart +++ b/lib/backend/llm_interface.dart @@ -82,14 +82,16 @@ Future 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");