fix: cast role to string for system check (TS type guard)
All checks were successful
Deploy / deploy (push) Successful in 1m35s
All checks were successful
Deploy / deploy (push) Successful in 1m35s
This commit is contained in:
@@ -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') {
|
||||||
|
|||||||
Reference in New Issue
Block a user