fix(openai): add nil checks for web_search streaming to prevent panic
This commit is contained in:
@@ -115,7 +115,11 @@ func OaiResponsesStreamHandler(c *gin.Context, info *relaycommon.RelayInfo, resp
|
|||||||
if streamResponse.Item != nil {
|
if streamResponse.Item != nil {
|
||||||
switch streamResponse.Item.Type {
|
switch streamResponse.Item.Type {
|
||||||
case dto.BuildInCallWebSearchCall:
|
case dto.BuildInCallWebSearchCall:
|
||||||
info.ResponsesUsageInfo.BuiltInTools[dto.BuildInToolWebSearchPreview].CallCount++
|
if info != nil && info.ResponsesUsageInfo != nil && info.ResponsesUsageInfo.BuiltInTools != nil {
|
||||||
|
if webSearchTool, exists := info.ResponsesUsageInfo.BuiltInTools[dto.BuildInToolWebSearchPreview]; exists && webSearchTool != nil {
|
||||||
|
webSearchTool.CallCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user