Skip to content

Commit cf5f2e2

Browse files
committed
fix: abort log
1 parent 578e172 commit cf5f2e2

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/server/api/memobase_server/controllers/modal/chat/merge_yolo.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ async def merge_or_valid_new_memos(
9292
temperature=0.2, # precise
9393
**PROMPTS[USE_LANGUAGE]["merge_yolo"].get_kwargs(),
9494
)
95+
oneline_response = r.data().replace("\n", "<br/>")
9596
if not r.ok():
9697
TRACE_LOG.warning(
9798
project_id,
@@ -100,14 +101,15 @@ async def merge_or_valid_new_memos(
100101
)
101102
return r
102103
memo_actions = parse_string_into_merge_yolo_action(r.data())
104+
105+
abort_infos = []
103106
for i, m in enumerate(new_memos):
104107
update_response = memo_actions.get(i + 1, None)
105108
if update_response is None:
106-
oneline_response = r.data().replace("\n", "<br/>")
107109
TRACE_LOG.warning(
108110
project_id,
109111
user_id,
110-
f"No Corresponding Merge Action: {m[0]}, <raw_response> {oneline_response} </raw_response>",
112+
f"No Corresponding Merge Action: {new_memos_input[i]}, <raw_response> {oneline_response} </raw_response>",
111113
)
112114
continue
113115
f_c, f_a = m[1], m[2]
@@ -166,17 +168,19 @@ async def merge_or_valid_new_memos(
166168
}
167169
)
168170
elif update_response["action"] == "ABORT":
169-
oneline_response = r.data().replace("\n", "<br/>")
170-
TRACE_LOG.info(
171-
project_id,
172-
user_id,
173-
f"Invalid merge: {m[0]}. <raw_response> {oneline_response} </raw_response>",
174-
)
171+
abort_infos.append(new_memos_input[i])
175172
else:
176173
TRACE_LOG.warning(
177174
project_id,
178175
user_id,
179176
f"Unkown merge action: {update_response['action']}",
180177
)
181178
continue
179+
180+
if len(abort_infos):
181+
TRACE_LOG.info(
182+
project_id,
183+
user_id,
184+
f"Invalid merge: {abort_infos}. <raw_response> {oneline_response} </raw_response>",
185+
)
182186
return Promise.resolve(profile_session_results)

src/server/api/memobase_server/prompts/utils.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,7 @@ def parse_line_into_subtopic(line: str) -> dict:
260260
2. ABORT::ABORT
261261
3. ABORT::ABORT
262262
4. ABORT::ABORT
263-
5. ABORT::ABORT
264-
6. ABORT::ABORT
265-
7. ABORT::ABORT
266-
8. ABORT::ABORT
267-
9. ABORT::ABORT
268-
10. APPEND::APPEND
269-
11. APPEND::APPEND
270-
12. APPEND::APPEND
271-
13. APPEND::APPEND"""
263+
5. APPEND::APPEND
264+
6. APPEND::APPEND"""
272265
)
273266
)

0 commit comments

Comments
 (0)