From 9286bbbba6451adea63b00ade09e661b60a000fb Mon Sep 17 00:00:00 2001 From: Tadashi Date: Wed, 5 Feb 2025 13:42:13 +0700 Subject: [PATCH] feat: add thinking display --- libs/kotaemon/kotaemon/indices/qa/utils.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/kotaemon/kotaemon/indices/qa/utils.py b/libs/kotaemon/kotaemon/indices/qa/utils.py index c961f4ff..ec426f0f 100644 --- a/libs/kotaemon/kotaemon/indices/qa/utils.py +++ b/libs/kotaemon/kotaemon/indices/qa/utils.py @@ -80,3 +80,18 @@ def find_start_end_phrase( final_match = None return final_match, matched_length + + +def replace_think_tag_with_details(text): + text = text.replace( + "", + '
Thought
', # noqa + ) + text = text.replace("", "
") + return text + + +def strip_think_tag(text): + if "
" in text: + text = text.split("")[1] + return text