MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / user

Method user

crates/opencode-session/src/message.rs:109–124  ·  view source on GitHub ↗
(session_id: impl Into<String>, text: impl Into<String>)

Source from the content-addressed store, hash-verified

107
108impl SessionMessage {
109 pub fn user(session_id: impl Into<String>, text: impl Into<String>) -> Self {
110 Self {
111 id: format!("msg_{}", uuid::Uuid::new_v4()),
112 session_id: session_id.into(),
113 role: MessageRole::User,
114 parts: vec![MessagePart {
115 id: format!("prt_{}", uuid::Uuid::new_v4()),
116 part_type: PartType::Text { text: text.into(), synthetic: None, ignored: None },
117 created_at: Utc::now(),
118 message_id: None,
119 }],
120 created_at: Utc::now(),
121 metadata: HashMap::new(),
122 usage: None,
123 }
124 }
125
126 pub fn assistant(session_id: impl Into<String>) -> Self {
127 Self {

Callers

nothing calls this directly

Calls 1

newFunction · 0.85

Tested by

no test coverage detected