MCPcopy Create free account
hub / github.com/astercloud/aster / addTextMessage

Function addTextMessage

ui/src/stores/chat.ts:90–101  ·  view source on GitHub ↗
(role: "user" | "assistant" | "system", text: string)

Source from the content-addressed store, hash-verified

88 * 添加文本消息(简便方法)
89 */
90 const addTextMessage = (role: "user" | "assistant" | "system", text: string): TextMessage => {
91 const message: TextMessage = {
92 id: generateId("msg"),
93 type: "text",
94 role,
95 content: { text },
96 createdAt: Date.now(),
97 status: role === "user" ? "sent" : undefined,
98 };
99 addMessage(message);
100 return message;
101 };
102
103 /**
104 * 创建用户消息

Callers 2

createUserMessageFunction · 0.85

Calls 2

generateIdFunction · 0.90
addMessageFunction · 0.85

Tested by

no test coverage detected