feat: update relay-text to conditionally include usage based on StreamOptions #696
This commit is contained in:
@@ -140,10 +140,10 @@ func TextHelper(c *gin.Context) (newAPIError *types.NewAPIError) {
|
|||||||
returnPreConsumedQuota(c, relayInfo, userQuota, preConsumedQuota)
|
returnPreConsumedQuota(c, relayInfo, userQuota, preConsumedQuota)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
includeUsage := false
|
includeUsage := true
|
||||||
// 判断用户是否需要返回使用情况
|
// 判断用户是否需要返回使用情况
|
||||||
if textRequest.StreamOptions != nil && textRequest.StreamOptions.IncludeUsage {
|
if textRequest.StreamOptions != nil {
|
||||||
includeUsage = true
|
includeUsage = textRequest.StreamOptions.IncludeUsage
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果不支持StreamOptions,将StreamOptions设置为nil
|
// 如果不支持StreamOptions,将StreamOptions设置为nil
|
||||||
@@ -158,9 +158,7 @@ func TextHelper(c *gin.Context) (newAPIError *types.NewAPIError) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if includeUsage {
|
relayInfo.ShouldIncludeUsage = includeUsage
|
||||||
relayInfo.ShouldIncludeUsage = true
|
|
||||||
}
|
|
||||||
|
|
||||||
adaptor := GetAdaptor(relayInfo.ApiType)
|
adaptor := GetAdaptor(relayInfo.ApiType)
|
||||||
if adaptor == nil {
|
if adaptor == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user