Skip to content

Conversation

@daoyuly
Copy link

@daoyuly daoyuly commented Nov 6, 2025

新增两个实用小功能:
1、抽取消息中文本内容
2、简单统计消息中的数量

for part in self.content:
if isinstance(part, TextPart):
text_parts.append(part.text)
elif isinstance(part, ThinkPart) and include_think and part.encrypted is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why only when part.encrypted is None? encrypted is the raw encrypted message in base64 but doesn't mean that the think field is "encrypted".

text_parts.append(part.text)
elif isinstance(part, ThinkPart) and include_think and part.encrypted is None:
text_parts.append(part.think)
return "".join(text_parts)
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about joining with \n?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just moved the whole context module into kosong.contrib because we no longer consider it as a core feature.

@stdrc
Copy link
Collaborator

stdrc commented Nov 16, 2025

Do you still want to push forward this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants