feat add FIM support for siliconflow
This commit is contained in:
@@ -36,6 +36,8 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|||||||
return fmt.Sprintf("%s/v1/embeddings", info.BaseUrl), nil
|
return fmt.Sprintf("%s/v1/embeddings", info.BaseUrl), nil
|
||||||
} else if info.RelayMode == constant.RelayModeChatCompletions {
|
} else if info.RelayMode == constant.RelayModeChatCompletions {
|
||||||
return fmt.Sprintf("%s/v1/chat/completions", info.BaseUrl), nil
|
return fmt.Sprintf("%s/v1/chat/completions", info.BaseUrl), nil
|
||||||
|
} else if info.RelayMode == constant.RelayModeCompletions {
|
||||||
|
return fmt.Sprintf("%s/v1/completions", info.BaseUrl), nil
|
||||||
}
|
}
|
||||||
return "", errors.New("invalid relay mode")
|
return "", errors.New("invalid relay mode")
|
||||||
}
|
}
|
||||||
@@ -68,6 +70,12 @@ func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycom
|
|||||||
} else {
|
} else {
|
||||||
err, usage = openai.OpenaiHandler(c, resp, info.PromptTokens, info.UpstreamModelName)
|
err, usage = openai.OpenaiHandler(c, resp, info.PromptTokens, info.UpstreamModelName)
|
||||||
}
|
}
|
||||||
|
case constant.RelayModeCompletions:
|
||||||
|
if info.IsStream {
|
||||||
|
err, usage = openai.OaiStreamHandler(c, resp, info)
|
||||||
|
} else {
|
||||||
|
err, usage = openai.OpenaiHandler(c, resp, info.PromptTokens, info.UpstreamModelName)
|
||||||
|
}
|
||||||
case constant.RelayModeEmbeddings:
|
case constant.RelayModeEmbeddings:
|
||||||
err, usage = openai.OpenaiHandler(c, resp, info.PromptTokens, info.UpstreamModelName)
|
err, usage = openai.OpenaiHandler(c, resp, info.PromptTokens, info.UpstreamModelName)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user