MCPcopy Create free account
hub / github.com/Louisym/MiniCC / Message

Class Message

tutorials/01_agentic_loop_basics.py:32–50  ·  view source on GitHub ↗

一条对话消息,就像聊天记录里的一条。

Source from the content-addressed store, hash-verified

30# - content(内容): 说了什么?
31
32class Message:
33 """一条对话消息,就像聊天记录里的一条。"""
34
35 def __init__(self, role: str, content: str):
36 """
37 参数:
38 role: 谁说的。可选值:
39 "user" = 用户(你)
40 "assistant" = AI 助手(Claude)
41 "tool" = 工具返回的结果
42 content: 说了什么(文字内容)
43 """
44 self.role = role
45 self.content = content
46
47 def __repr__(self):
48 # 方便打印查看
49 preview = self.content[:50] + "..." if len(self.content) > 50 else self.content
50 return f"Message(role={self.role!r}, content={preview!r})"
51
52
53# ============================================================

Callers 1

run_turnFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected