Skip to content

Commit 9de723b

Browse files
Wang-Daojiyuan.wangfridayLCaralHsi
authored
Feat/fix palyground bug (#727)
* fix playground bug, internet search judge * fix playground internet bug * modify delete mem * modify tool resp bug in multi cube * fix bug in playground chat handle and search inter * modify prompt * fix bug in playground * fix bug playfround * fix bug * fix code * fix model bug in playground * modify plan b * llm param modify * add logger in playground * modify code * fix bug * modify code * modify code * fix bug * fix search bug in plarground * fixx bug * move schadualr to back * modify pref location * modify fast net search * add tags and new package * modify prompt fix bug * remove nltk due to image promblem * prompt modify * modify bug remove redundant field * modify bug * fix playground bug * fix bug * bust internet topk * bust to 50 * fix bug cite * modify search * remote query add in playground * modify bug * modify pref bug * move add position * modify chat prompt * modify overthinking * add logger in playground chat * midify mem * remove must in prompt --------- Co-authored-by: yuan.wang <[email protected]> Co-authored-by: chunyu li <[email protected]> Co-authored-by: CaralHsi <[email protected]>
1 parent 3c01d1e commit 9de723b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/memos/api/handlers/chat_handler.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def generate_chat_response() -> Generator[str, None, None]:
405405
readable_cube_ids=readable_cube_ids,
406406
mode="fast",
407407
internet_search=False,
408-
top_k=5,
408+
top_k=20,
409409
chat_history=chat_req.history,
410410
session_id=chat_req.session_id,
411411
include_preference=True,
@@ -428,7 +428,7 @@ def generate_chat_response() -> Generator[str, None, None]:
428428
memories_list = text_mem_results[0]["memories"]
429429

430430
# Filter memories by threshold
431-
filtered_memories = self._filter_memories_by_threshold(memories_list)
431+
filtered_memories = self._filter_memories_by_threshold(memories_list)[:5]
432432

433433
# Prepare reference data (first search)
434434
reference = prepare_reference_data(filtered_memories)
@@ -459,9 +459,7 @@ def generate_chat_response() -> Generator[str, None, None]:
459459
searcher = self.dependencies.searcher
460460
parsed_goal = searcher.task_goal_parser.parse(
461461
task_description=chat_req.query,
462-
context="\n".join(
463-
[memory.get("memory", "") for memory in filtered_memories]
464-
),
462+
context="\n".join([memory.get("memory", "") for memory in memories_list]),
465463
conversation=chat_req.history,
466464
mode="fine",
467465
)
@@ -481,7 +479,7 @@ def generate_chat_response() -> Generator[str, None, None]:
481479
# ====== second deep search ======
482480
search_req = APISearchRequest(
483481
query=(parsed_goal.rephrased_query or chat_req.query)
484-
+ (f"{parsed_goal.tags}" if parsed_goal.tags else ""),
482+
+ (f" {parsed_goal.memories}" if parsed_goal.memories else ""),
485483
user_id=chat_req.user_id,
486484
readable_cube_ids=readable_cube_ids,
487485
mode="fast",

src/memos/memories/textual/tree_text_memory/retrieve/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
1. Keys: the high-level keywords directly relevant to the user’s task.
55
2. Tags: thematic tags to help categorize and retrieve related memories.
66
3. Goal Type: retrieval | qa | generation
7-
4. Rephrased instruction: Give a rephrased task instruction based on the former conversation to make it less confusing to look alone. Make full use of information related to the query, including user's personal information, such as user's name, location, preferences, etc. If you think the task instruction is easy enough to understand, or there is no former conversation, set "rephrased_instruction" to an empty string.
7+
4. Rephrased instruction: Give a rephrased task instruction based on the former conversation to make it less confusing to look alone. Make full use of information related to the query, including user's personal information, such as user's name, location, preferences, etc. If you think the task instruction is enough for search, or there is no former conversation, set "rephrased_instruction" to an empty string.
88
5. Need for internet search: If the user's task instruction only involves objective facts or can be completed without introducing external knowledge, set "internet_search" to False. Otherwise, set it to True.
99
6. Memories: Provide 2–5 short semantic expansions or rephrasings of the rephrased/original user task instruction. These are used for improved embedding search coverage. Each should be clear, concise, and meaningful for retrieval.
1010

0 commit comments

Comments
 (0)