Skip to content

Commit

Permalink
feat: add thinking display
Browse files Browse the repository at this point in the history
  • Loading branch information
taprosoft committed Feb 5, 2025
1 parent e90f895 commit 9286bbb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libs/kotaemon/kotaemon/indices/qa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"<think>",
'<details><summary><span style="color:grey">Thought</span></summary><blockquote>', # noqa
)
text = text.replace("</think>", "</blockquote></details>")
return text


def strip_think_tag(text):
if "</think>" in text:
text = text.split("</think>")[1]
return text

0 comments on commit 9286bbb

Please sign in to comment.