mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 20:17:29 +08:00
feat(ai-proxy): support handle array content in chatToolMessage2BedrockMessage (#3200)
Signed-off-by: Liang Deng <ytdengliang@gmail.com> Co-authored-by: rinfx <yucheng.lxr@alibaba-inc.com>
This commit is contained in:
@@ -1059,17 +1059,19 @@ func chatToolMessage2BedrockMessage(chatMessage chatMessage) bedrockMessage {
|
|||||||
Text: text,
|
Text: text,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
openaiContent := chatMessage.ParseContent()
|
} else if contentList, ok := chatMessage.Content.([]any); ok {
|
||||||
for _, part := range openaiContent {
|
for _, contentItem := range contentList {
|
||||||
var content bedrockMessageContent
|
contentMap, ok := contentItem.(map[string]any)
|
||||||
if part.Type == contentTypeText {
|
if ok && contentMap["type"] == contentTypeText {
|
||||||
content.Text = part.Text
|
if text, ok := contentMap[contentTypeText].(string); ok {
|
||||||
} else {
|
toolResultContent.Content = append(toolResultContent.Content, toolResultContentBlock{
|
||||||
continue
|
Text: text,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Warnf("only text content is supported, current content is %v", chatMessage.Content)
|
log.Warnf("the content type is not supported, current content is %v", chatMessage.Content)
|
||||||
}
|
}
|
||||||
return bedrockMessage{
|
return bedrockMessage{
|
||||||
Role: roleUser,
|
Role: roleUser,
|
||||||
|
|||||||
Reference in New Issue
Block a user