feat: 修复重试后请求结构混乱,修复rerank端点无法使用
This commit is contained in:
@@ -53,13 +53,18 @@ func trimModelThinking(modelName string) string {
|
||||
func GeminiHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types.NewAPIError) {
|
||||
info.InitChannelMeta(c)
|
||||
|
||||
request, ok := info.Request.(*dto.GeminiChatRequest)
|
||||
geminiReq, ok := info.Request.(*dto.GeminiChatRequest)
|
||||
if !ok {
|
||||
common.FatalLog(fmt.Sprintf("invalid request type, expected *dto.GeminiChatRequest, got %T", info.Request))
|
||||
}
|
||||
|
||||
request, err := common.DeepCopy(geminiReq)
|
||||
if err != nil {
|
||||
return types.NewError(fmt.Errorf("failed to copy request to GeminiChatRequest: %w", err), types.ErrorCodeInvalidRequest, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
|
||||
// model mapped 模型映射
|
||||
err := helper.ModelMappedHelper(c, info, request)
|
||||
err = helper.ModelMappedHelper(c, info, request)
|
||||
if err != nil {
|
||||
return types.NewError(err, types.ErrorCodeChannelModelMappedError, types.ErrOptionWithSkipRetry())
|
||||
}
|
||||
@@ -170,7 +175,7 @@ func GeminiEmbeddingHandler(c *gin.Context, info *relaycommon.RelayInfo) (newAPI
|
||||
isBatch := strings.HasSuffix(c.Request.URL.Path, "batchEmbedContents")
|
||||
info.IsGeminiBatchEmbedding = isBatch
|
||||
|
||||
var req any
|
||||
var req dto.Request
|
||||
var err error
|
||||
var inputTexts []string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user