MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / newMessage

Function newMessage

demo/chat/App.tsx:75–85  ·  view source on GitHub ↗
(
  role: ChatMessage["role"],
  content: string,
)

Source from the content-addressed store, hash-verified

73}
74
75function newMessage(
76 role: ChatMessage["role"],
77 content: string,
78): ChatMessage {
79 return {
80 id: `${role[0]}-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
81 role,
82 content,
83 at: new Date().toISOString(),
84 };
85}
86
87export function ChatApp() {
88 const [session, setSession] = useState<ChatSession>(() => createSession());

Callers 1

ChatAppFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected