fix: cast role to string for system check (TS type guard)
All checks were successful
Deploy / deploy (push) Successful in 1m35s

This commit is contained in:
Cosmo
2026-05-01 11:37:21 +00:00
parent 130a58637a
commit ea096a855b

View File

@@ -55,7 +55,7 @@ function toAnthropicTools(tools: any[]): any[] {
function historyToAnthropicMessages(history: HistoryMessage[]): any[] { function historyToAnthropicMessages(history: HistoryMessage[]): any[] {
const result: any[] = [] const result: any[] = []
for (const msg of history) { for (const msg of history) {
if (msg.role === 'system') continue // skip, goes in system field if ((msg.role as string) === 'system') continue // skip, goes in system field
if (msg.role === 'user') { if (msg.role === 'user') {
result.push({ role: 'user', content: msg.content || '' }) result.push({ role: 'user', content: msg.content || '' })
} else if (msg.role === 'assistant') { } else if (msg.role === 'assistant') {