feat: Update RerankerInfo structure and modify GenRelayInfoRerank function to accept RerankRequest

This commit is contained in:
1808837298@qq.com
2025-03-17 16:44:53 +08:00
parent b5aa3c129b
commit 6fef5aaf22
4 changed files with 25 additions and 15 deletions

View File

@@ -32,19 +32,20 @@ func RerankHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Respo
}
jinaRespResults := make([]dto.RerankResponseResult, len(xinRerankResponse.Results))
for i, result := range xinRerankResponse.Results {
var document any
if result.Document == "" {
document = info.Documents[result.Index]
} else {
document = result.Document
}
jinaRespResults[i] = dto.RerankResponseResult{
respResult := dto.RerankResponseResult{
Index: result.Index,
RelevanceScore: result.RelevanceScore,
Document: dto.RerankDocument{
Text: document,
},
}
if info.ReturnDocuments {
var document any
if result.Document == "" {
document = info.Documents[result.Index]
} else {
document = result.Document
}
respResult.Document = document
}
jinaRespResults[i] = respResult
}
jinaResp = dto.RerankResponse{
Results: jinaRespResults,