From 3d17b1aadbe8ac65b591ed0ba31b5d5800dff0f5 Mon Sep 17 00:00:00 2001
From: Juuso Rytilahti <rytilahti.juuso@gmail.com>
Date: Mon, 9 Oct 2023 16:36:02 +0300
Subject: [PATCH] Replace he original translation with the improved version for
 ChatGPt

---
 translator_script.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/translator_script.py b/translator_script.py
index 9ce8817..9534bf1 100644
--- a/translator_script.py
+++ b/translator_script.py
@@ -408,6 +408,10 @@ if file_content:
         final_translation_of_chunk = only_improved_translations[best_version_num]
 
         #EXTRACT THE FINAL TRANSLATION
+        # Replaces the original translation in messages with the best translation to give the ChatGPT the best translation as context
+        #TODO this is ugly code.
+        previous_messages[len(previous_messages)-1]["content"] = final_translation_of_chunk
+        
         #final_translation_of_chunk = extract_final_translation(improved_trans_with_rationale[0])
         write_to_file("./debug/chunk"+str(i)+"_final_translation.md", final_translation_of_chunk)
 
-- 
GitLab