Chat Nodes

Applies to: ChengOS v0.2.0+ | Last verified: 2026-09-25 | Source: crates/cheng-nodes/src/nodes/builtin/chat

chat/input and chat/output are the two ends of a conversational workflow: one receives the incoming message and session identity, the other returns the reply on the same session. chat/history_search is the read side — list conversations, search messages, or pull the messages around one hit — and it is what lets an agent answer questions about what was already said without keeping the entire history in the prompt.

Chat Input Node — chat/input

Receive multi-modal input (text, images, files, etc.), process and send to downstream nodes

Inputs

FieldTypeRequiredDefaultDescription
raw_inputstring (port)✅—Raw input payload (JSON format). Connection port, not a form field. Control: textarea
user_message_richobject (port)—nullOptional rich user message from upstream nodes. Connection port, not a form field.
contextobject—nullOptional AgentContext restored before this workflow execution
conversation_idstring (port)—nullConversation ID (optional), generated at entry and passed through to all downstream nodes. Connection port, not a form field.
workspace_idstring (port)—nullWorkspace ID (optional), used for per-workspace chat isolation. Connection port, not a form field.
document_idstring (port)—nullDocument ID (optional), injected by document page and passed through ambient context to downstream nodes. Connection port, not a form field.
stream_modeboolean—falseEnable streaming send. Control: switch
enable_ocrboolean—falseEnable OCR for images. Control: switch
merge_strategyenum—per_fileMulti-input merge strategy. Control: select. Options: merge_all (合并所有消息为一个包), per_file (每个文件单独一个包), per_line (每行单独一个包)
max_file_size_mbinteger—50Maximum file size (MB). Control: number
model_overridestring—nullModel override (format: credential_id::model_name)

Outputs

FieldTypeDescription
agent_contextobject (port)AgentContext wrapper, connectable directly to agent/llm context port. Connection port, not a form field.
user_messagestring (port)User message text. Connection port, not a form field.
user_message_richobject (port)Structured user message with multimodal parts. Connection port, not a form field.
conversation_idstring (port)Conversation ID (passed through to downstream nodes). Connection port, not a form field.
workspace_idstring (port)Workspace ID (passed through for per-workspace isolation). Connection port, not a form field.
document_idstring (port)Document ID (passed through ambient context to downstream document nodes). Connection port, not a form field.
statsobjectProcessing statistics
ui_eventenumUI event
model_overridestringModel override (format: credential_id::model_name)
attachments_jsonstring (port)Attachments JSON array, connectable directly to io/file_upload.files_json. Connection port, not a form field.

Chat Output Node — chat/output

Receive message packets and render to chat interface, supports streaming display, virtualization and message export

Inputs

FieldTypeRequiredDefaultDescription
contextobject (port)—""Agent final reply text or AgentContext (auto extracts text). Connection port, not a form field.
artifactsobject (port)—[]Artifact reference(s) to render as media attachments. Connection port, not a form field.
tracestring (port)—nullAgent execution trace (thinking process). Connection port, not a form field.
themeenum—systemDisplay theme. Control: select. Options: light, dark, system
autoscrollboolean—trueAuto scroll to latest message. Control: switch
keep_messagesinteger—1000Maximum messages to keep in memory. Control: number
virtualize_thresholdinteger—100Enable virtualization when message count exceeds this value. Control: slider
display_formatenum—standardMessage display format. Control: select. Options: compact (紧凑模式), standard (标准模式), detailed (详细模式)
show_timestampboolean—trueShow message timestamp. Control: switch

Outputs

FieldTypeDescription
replystringAssistant final reply text content
tracestringAgent execution trace (thinking process)
ui_eventsarray<enum>UI events to send to frontend
message_countintegerCurrent total messages retained
virtualizedbooleanWhether virtualization rendering is enabled
statsobjectProcessing statistics

Chat History Search — chat/history_search

Search past chat conversations across the workspace. Exposed as an on-demand tool to LLM/Agent — NOT a default context provider. Do not use for file paths or file contents; use file tools for those.

Inputs

FieldTypeRequiredDefaultDescription
actionenum—search_messagesWhat to do: list_conversations | search_messages | get_conversation_messages | get_message_context. Options: list_conversations (列出 workspace 内活跃过的会话(按 updated_at desc)。), search_messages (按关键字 + 时间范围检索消息。), get_conversation_messages (取指定会话最近 N 条消息。), get_message_context (以某条消息为中心扩展上下文。)
workspace_idstring—nullWorkspace UUID. Falls back to execution metadata if absent.
target_conversation_idstring—nullRestrict the search to a specific conversation. Distinct from the current session's conversation_id so cross-session searches are possible.
querystring—nullKeyword (case-insensitive, ILIKE-style).
time_rangeenum—last_week时间范围。默认 last_week。 Options: last_hour, last_day, last_week, last_month, all_time
limitinteger—10单次返回上限。
message_idstring—null锚点 message_id(仅 get_message_context 使用)。
context_beforeinteger—2锚点之前要带出多少条消息。
context_afterinteger—2锚点之后要带出多少条消息。
snippet_max_charsinteger—200snippet 最大字符数(按字符截断,避免单条消息撑爆上下文)。

Outputs

FieldTypeDescription
foundbooleanFound
no_results_foundbooleanNo Results Found
totalintegerTotal
resultsarray<object>Results
summarystringSummary
suggestionstringSuggestion
call_limit_reachedboolean当本次执行的搜索配额已用尽时为 true,调用方应避免再次发起。

Next steps