Skip to content

normalizeAiAgentReplyFormat

归一化 ai_agents.reply_format 与 IM 落库消息 type 映射。

函数签名

typescript
type AiAgentReplyFormat = 'markdown' | 'text' | 'json'

function normalizeAiAgentReplyFormat(
  replyFormatRaw: string | undefined | null,
): AiAgentReplyFormat

function imPersistedMessageTypeForReplyFormat(
  format: AiAgentReplyFormat,
): 'markdown' | 'text'

工作原理

  1. 未知值回退 markdown
  2. 落库时 jsontext 均存为 text type(仅 markdown 保留 markdown)。