Skip to content
Snippets Groups Projects
Unverified Commit 311fca72 authored by James Briggs's avatar James Briggs
Browse files

add force refresh for topic clustering

parent 9f347b50
No related branches found
No related tags found
No related merge requests found
...@@ -148,7 +148,7 @@ class Conversation(BaseModel): ...@@ -148,7 +148,7 @@ class Conversation(BaseModel):
for message in topic.docs: for message in topic.docs:
self.topics.append((i, message)) self.topics.append((i, message))
def split_by_topic(self) -> Tuple[List[Tuple[int, str]], List[DocumentSplit]]: def split_by_topic(self, force: bool = False) -> Tuple[List[Tuple[int, str]], List[DocumentSplit]]:
""" """
Splits the messages into topics based on their semantic similarity. Splits the messages into topics based on their semantic similarity.
...@@ -166,6 +166,10 @@ class Conversation(BaseModel): ...@@ -166,6 +166,10 @@ class Conversation(BaseModel):
) )
new_topics: List[DocumentSplit] = [] new_topics: List[DocumentSplit] = []
if self.topics:
# reset self.topics
self.topics = []
# Get unclusteed messages. # Get unclusteed messages.
unclustered_messages = self.messages[len(self.topics) :] unclustered_messages = self.messages[len(self.topics) :]
if not unclustered_messages: if not unclustered_messages:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment