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

Function message_part_text

crates/opencode-tui/src/app/app.rs:3444–3462  ·  view source on GitHub ↗
(part: &ContextMessagePart)

Source from the content-addressed store, hash-verified

3442}
3443
3444fn message_part_text(part: &ContextMessagePart) -> String {
3445 match part {
3446 ContextMessagePart::Text { text } => text.clone(),
3447 ContextMessagePart::Reasoning { text } => format!("[reasoning] {}", text),
3448 ContextMessagePart::ToolCall {
3449 name, arguments, ..
3450 } => format!("[tool:{}] {}", name, arguments),
3451 ContextMessagePart::ToolResult {
3452 result, is_error, ..
3453 } => {
3454 if *is_error {
3455 return format!("[tool-error] {}", result);
3456 }
3457 format!("[tool-result] {}", result)
3458 }
3459 ContextMessagePart::File { path, .. } => format!("[file] {}", path),
3460 ContextMessagePart::Image { url } => format!("[image] {}", url),
3461 }
3462}
3463
3464fn infer_task_kind_from_message(message: &Message) -> TaskKind {
3465 let Some(last_part) = message.parts.last() else {

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected