Skip to content

Commit 48bbe92

Browse files
Wang-Daojiyuan.wangfridayL
authored
Feat/fix palyground bug (#690)
* 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 --------- Co-authored-by: yuan.wang <[email protected]> Co-authored-by: chunyu li <[email protected]>
1 parent 0bae890 commit 48bbe92

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/memos/api/handlers/chat_handler.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,15 @@ def _format_mem_block(
840840
memory_content = m.get("memory", "")
841841
metadata = m.get("metadata", {})
842842
memory_type = metadata.get("memory_type", "")
843+
created_time = metadata.get("updated_at", "") or metadata.get("created_at", "")
844+
845+
# format time to YYYY-MM-DD HH:MM (ISO 8601 -> YYYY-MM-DD HH:MM)
846+
if created_time and isinstance(created_time, str):
847+
try:
848+
dt = datetime.fromisoformat(created_time)
849+
created_time = dt.strftime("%Y-%m-%d %H:%M")
850+
except ValueError:
851+
pass # keep original value
843852

844853
tag = "O" if "Outer" in str(memory_type) else "P"
845854
txt = memory_content.replace("\n", " ").strip()
@@ -850,6 +859,7 @@ def _format_mem_block(
850859
if tag == "O":
851860
lines_o.append(f"[{idx}:{mid}] :: [{tag}] {txt}\n")
852861
elif tag == "P":
862+
txt = f"(CreatedTime: {created_time}) {txt}"
853863
lines_p.append(f"[{idx}:{mid}] :: [{tag}] {txt}")
854864

855865
return "\n".join(lines_o), "\n".join(lines_p)

src/memos/templates/mos_prompts.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
- Do not use a connected format like [1:abc123,2:def456].
121121
- Brackets MUST be English half-width square brackets `[]`, NEVER use Chinese full-width brackets `【】` or any other symbols.
122122
- **When a sentence draws on an assistant/other-party memory**, mark the role in the sentence (“The assistant suggests…”) and add the corresponding citation at the end per this rule; e.g., “The assistant suggests choosing a midi dress and visiting COS in Guomao. [1:abc123]”
123-
- For preferences, do not mention the source in the response, do not appear `[Explicit/Implicit preference]` or `(Explicit/Implicit preference)` in the response
123+
- For preferences, do not mention the source in the response, do not appear `[Explicit preference]`, `[Implicit preference]`, `(Explicit preference)` or `(Implicit preference)` in the response
124124
125125
# Current Date: {date}
126126
@@ -155,6 +155,7 @@
155155
- Avoid meaningless blank lines
156156
- Keep the reply language consistent with the user's query language
157157
- **NEVER** mention internal mechanisms like "retrieved memories", "database", "AI views", "memory system", or similar technical terms in your responses to users
158+
- For preferences, do not mention the source in the response, do not appear `[Explicit preference]`, `[Implicit preference]`, `(Explicit preference)` or `(Implicit preference)` in the response
158159
- The last part of the response should not contain `(Note: ...)` or `(According to ...)` etc.
159160
160161
## Key Principles
@@ -226,7 +227,7 @@
226227
- 不要使用连接格式如[1:abc123,2:def456]。
227228
- 方括号必须是英文半角方括号`[]`,绝不使用中文全角括号`【】`或任何其他符号。
228229
- **当句子引用助手/其他方记忆时**,在句子中标注角色("助手建议…")并根据此规则在句尾添加相应引用;例如,"助手建议选择中长裙并访问国贸的COS。[1:abc123]"
229-
- 对于偏好,不要在回答中标注来源,不要出现`[显示/隐式偏好]`或`(显性/隐性偏好)`的字样
230+
- 对于偏好,不要在回答中标注来源,不要出现`[显式偏好]`或`[隐式偏好]`或`(显式偏好)`或`(隐式偏好)`的字样
230231
231232
# 当前日期:{date}
232233
@@ -261,6 +262,7 @@
261262
- 避免无意义的空行
262263
- 保持回复语言与用户查询语言一致
263264
- **绝不**在对用户的回复中提及内部机制,如"检索的记忆"、"数据库"、"AI观点"、"记忆系统"或类似技术术语
265+
- 对于偏好,不要在回答中标注来源,不要出现`[显式偏好]`或`[隐式偏好]`或`(显式偏好)`或`(隐式偏好)`的字样
264266
- 回复内容的结尾不要出现`(注: ...)`或`(根据...)`等解释
265267
266268
## 核心原则

0 commit comments

Comments
 (0)