Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
70373f9
fix playground bug, internet search judge
Dec 4, 2025
d181339
Merge branch 'dev' into feat/fix_palyground_bug
Dec 4, 2025
11cf00a
fix playground internet bug
Dec 4, 2025
6b10ce1
merge dev
Dec 4, 2025
c861f61
modify delete mem
Dec 4, 2025
e638039
modify tool resp bug in multi cube
Dec 4, 2025
dcd3d50
Merge branch 'dev' into feat/fix_palyground_bug
Dec 4, 2025
0c0eff8
Merge branch 'dev' into feat/fix_palyground_bug
Dec 5, 2025
8765dc4
fix bug in playground chat handle and search inter
Dec 5, 2025
1a335db
modify prompt
Dec 5, 2025
18320ff
fix bug in playground
Dec 6, 2025
666b897
fix bug playfround
Dec 6, 2025
275b9b6
Merge branch 'dev' into feat/fix_palyground_bug
Dec 7, 2025
0d22512
fix bug
Dec 7, 2025
d38f55f
Merge branch 'dev' into feat/fix_palyground_bug
Dec 7, 2025
a9eb1f6
fix code
Dec 7, 2025
94ad709
Merge branch 'dev' into feat/fix_palyground_bug
Dec 7, 2025
723a14f
fix model bug in playground
Dec 7, 2025
6f06a23
Merge branch 'dev' into feat/fix_palyground_bug
Dec 7, 2025
a300670
Merge branch 'dev' into feat/fix_palyground_bug
Dec 8, 2025
7ee13b1
Merge branch 'dev' into feat/fix_palyground_bug
Dec 8, 2025
5ab6e92
modify plan b
Dec 8, 2025
1bb0bcd
llm param modify
Dec 8, 2025
1b607e7
Merge branch 'dev' into feat/fix_palyground_bug
Dec 8, 2025
f5bc426
add logger in playground
Dec 8, 2025
a9fa309
modify code
Dec 9, 2025
d2efa24
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
9ebfbe1
Merge branch 'dev' into feat/fix_palyground_bug
fridayL Dec 9, 2025
4c055d0
fix bug
Dec 9, 2025
27b4fc4
modify code
Dec 9, 2025
cefeefb
modify code
Dec 9, 2025
7e05fa7
fix bug
Dec 9, 2025
a4f66b1
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
9b47647
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
05da172
fix search bug in plarground
Dec 9, 2025
e410ec2
fixx bug
Dec 9, 2025
0324588
move schadualr to back
Dec 9, 2025
a834028
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
4084954
modify pref location
Dec 9, 2025
de5e372
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
87861ab
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
8b547b8
modify fast net search
Dec 9, 2025
c915867
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
2f238fd
Merge branch 'dev' into feat/fix_palyground_bug
Dec 9, 2025
4543332
add tags and new package
Dec 10, 2025
c51ef0d
merge dev
Dec 10, 2025
033e8bd
modify prompt fix bug
Dec 10, 2025
e300112
Merge branch 'dev' into feat/fix_palyground_bug
Dec 10, 2025
da498fc
Merge branch 'dev' into feat/fix_palyground_bug
Dec 10, 2025
4057f5d
remove nltk due to image promblem
Dec 10, 2025
479d74e
Merge branch 'dev' into feat/fix_palyground_bug
Dec 10, 2025
ecff6e5
prompt modify
Dec 11, 2025
1b4ef23
Merge branch 'dev' into feat/fix_palyground_bug
Dec 11, 2025
7e18cae
modify bug remove redundant field
Dec 11, 2025
a70ffa3
modify bug
Dec 11, 2025
e06eff2
merge dev
Dec 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/memos/api/handlers/chat_handler.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不要硬编码,最好整个配置

Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,14 @@ def generate_chat_response() -> Generator[str, None, None]:
memories_list = text_mem_results[0]["memories"]

# Filter memories by threshold
second_filtered_memories = self._filter_memories_by_threshold(memories_list)
second_filtered_memories = self._filter_memories_by_threshold(memories_list, 15)

# dedup and supplement memories
fast_length = len(filtered_memories)
supplement_length = max(0, chat_req.top_k - fast_length)
filtered_memories = self._dedup_and_supplement_memories(
filtered_memories, second_filtered_memories
)
)[:supplement_length]

# Prepare remain reference data (second search)
reference = prepare_reference_data(filtered_memories)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def _process_result(
confidence=0.99,
usage=[],
tags=tags,
key=title,
embedding=self.embedder.embed([content])[0],
internet_info={
"title": title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def _process_result(
sources=[SourceMessage(type="web", url=url)] if url else [],
visibility="public",
tags=self._extract_tags(title, content, summary),
key=title,
info=info_,
background="",
confidence=0.99,
Expand Down
6 changes: 4 additions & 2 deletions src/memos/templates/mos_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
- Do not use a connected format like [1:abc123,2:def456].
- Brackets MUST be English half-width square brackets `[]`, NEVER use Chinese full-width brackets `【】` or any other symbols.
- **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]”
- For preferences, do not mention the source in the response, do not appear `[Explicit/Implicit preference]` or `(Explicit/Implicit preference)` in the response

# Current Date: {date}

Expand All @@ -144,7 +145,6 @@
- Only reference memories that are directly relevant to the user's question
- Prioritize the most appropriate memory type based on the context and nature of the query
- Responses must not contain non-existent citations
- Explicit and implicit preferences can be referenced if relevant to the user's question, but must not be cited or source-attributed in responses
- **Attribution-first selection:** Distinguish memory from user vs from assistant vs third party before composing. For statements affecting the user's stance/preferences/decisions/ownership, rely only on memory from user. Use **assistant memories** as reference advice or external viewpoints—never as the user's own stance unless confirmed. Never attribute third-party information to the user.

### Response Style
Expand All @@ -155,6 +155,7 @@
- Avoid meaningless blank lines
- Keep the reply language consistent with the user's query language
- **NEVER** mention internal mechanisms like "retrieved memories", "database", "AI views", "memory system", or similar technical terms in your responses to users
- The last part of the response should not contain `(Note: ...)` or `(According to ...)` etc.

## Key Principles
- Reference only relevant memories to avoid information overload
Expand Down Expand Up @@ -225,6 +226,7 @@
- 不要使用连接格式如[1:abc123,2:def456]。
- 方括号必须是英文半角方括号`[]`,绝不使用中文全角括号`【】`或任何其他符号。
- **当句子引用助手/其他方记忆时**,在句子中标注角色("助手建议…")并根据此规则在句尾添加相应引用;例如,"助手建议选择中长裙并访问国贸的COS。[1:abc123]"
- 对于偏好,不要在回答中标注来源,不要出现`[显示/隐式偏好]`或`(显性/隐性偏好)`的字样

# 当前日期:{date}

Expand All @@ -249,7 +251,6 @@
- 仅引用与用户问题直接相关的记忆
- 根据上下文和查询性质优先选择最合适的记忆类型
- 回复中不得包含不存在的引用
- 如与用户问题相关,可以引用显式和隐式偏好,但不得在回复中引用或标注来源
- **归属优先选择:** 在组织回复前,区分记忆来自用户、助手还是第三方。对于影响用户立场/偏好/决定/所有权的陈述,仅依赖来自用户的记忆。将**助手记忆**作为参考建议或外部观点使用——除非经确认,否则绝不作为用户自己的立场。绝不将第三方信息归因于用户。

### 回复风格
Expand All @@ -260,6 +261,7 @@
- 避免无意义的空行
- 保持回复语言与用户查询语言一致
- **绝不**在对用户的回复中提及内部机制,如"检索的记忆"、"数据库"、"AI观点"、"记忆系统"或类似技术术语
- 回复内容的最后不要出现`(注: ...)`或`(根据...)`等解释

## 核心原则
- 仅引用相关记忆以避免信息过载
Expand Down