Skip to content

Commit 69c87ea

Browse files
authored
fix chat_history.txt re thinking models
1 parent bbc10e5 commit 69c87ea

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/gui_tabs_database_query.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@ def show_error_message(self, error_message):
519519
def on_submission_finished(self):
520520
self.submit_button.setDisabled(False)
521521

522+
ix = self.raw_response.lower().rfind("</think>")
523+
answer_only = self.raw_response[ix + len("</think>"):] if ix != -1 else self.raw_response
524+
answer_only = answer_only.lstrip("\n")
525+
526+
try:
527+
with open(input_text_file, "w", encoding="utf-8") as f:
528+
f.write(answer_only)
529+
except OSError as e:
530+
logging.exception(f"Could not write chat_history.txt: {e}")
531+
522532
def update_transcription(self, transcription_text):
523533
self.text_input.setPlainText(transcription_text)
524534

0 commit comments

Comments
 (0)