(systemParts, content)
| 109 | } |
| 110 | } |
| 111 | |
| 112 | function appendCliSystemContent(systemParts, content) { |
| 113 | if (content === undefined || content === null) { |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | if (Array.isArray(content)) { |
| 118 | for (const item of content) { |
| 119 | appendCliSystemContent(systemParts, item) |
| 120 | } |
| 121 | return |
| 122 | } |
| 123 | |
| 124 | if (typeof content === 'string') { |
| 125 | systemParts.push(makeCliTextPart(content)) |
| 126 | return |
| 127 | } |
| 128 | |
| 129 | if (typeof content === 'object') { |
| 130 | if (isInjectedSystemPart(content)) { |
| 131 | return |
| 132 | } |
| 133 | |
| 134 | if (typeof content.text === 'string' && content.type === 'text') { |
| 135 | systemParts.push(content) |
| 136 | return |
| 137 | } |
| 138 | |
| 139 | systemParts.push(content) |
| 140 | return |
| 141 | } |
| 142 | |
| 143 | systemParts.push(makeCliTextPart(content)) |
| 144 | } |
| 145 | |
| 146 | function ensureCliSystemMessage(messages) { |
no test coverage detected