Skip to content

Commit f333888

Browse files
whipser030黑布林CaralHsifridayL
authored
Patch: deduplicate add objects (#714)
* update reader and search strategy * set strategy reader and search config * fix install problem * fix * fix test * turn off graph recall * turn off graph recall * turn off graph recall * fix Searcher input bug * fix Searcher * fix Search * fix bug * adjust strategy reader * adjust strategy reader * adjust search config input * reformat code * re pr * format repair * fix time issue * develop feedback process * feedback handler configuration * upgrade feedback using * add threshold * update prompt * update prompt * fix handler * add feedback scheduler * add handler change node update * add handler change node update * add handler change node update * add handler change node update * fix interface input * add chunk and ratio filter * update stopwords * fix messages queue * add seach_by_keywords_LIKE * add doc filter * add retrieve query * add retrieve queies * patch info filter * add log and make embedding safety net * add log and make embedding safety net * deduplicate add objects --------- Co-authored-by: 黑布林 <[email protected]> Co-authored-by: CaralHsi <[email protected]> Co-authored-by: chunyu li <[email protected]>
1 parent d64cf2f commit f333888

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/memos/mem_feedback/feedback.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,19 @@ def correct_item(data):
618618
return None
619619

620620
dehallu_res = [correct_item(item) for item in operations]
621-
llm_operations = [item for item in dehallu_res if item]
621+
dehalluded_operations = [item for item in dehallu_res if item]
622+
623+
# deduplicate add objects
624+
add_texts = []
625+
llm_operations = []
626+
for item in dehalluded_operations:
627+
if item["operation"].lower() == "add" and "text" in item and item["text"]:
628+
if item["text"] in add_texts:
629+
continue
630+
llm_operations.append(item)
631+
add_texts.append(item["text"])
632+
elif item["operation"].lower() == "update":
633+
llm_operations.append(item)
622634

623635
# Update takes precedence over add
624636
has_update = any(item.get("operation").lower() == "update" for item in llm_operations)

0 commit comments

Comments
 (0)