Remove unused codes (#15579)

### What problem does this PR solve?

Remove unused code.

### Type of change

- [x] Refactoring

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-06-03 17:35:36 +08:00
committed by GitHub
parent b363146997
commit 2061edd308
9 changed files with 7 additions and 442 deletions

View File

@@ -22,7 +22,6 @@ import (
"github.com/gin-gonic/gin"
"ragflow/internal/common"
"ragflow/internal/dao"
"ragflow/internal/service"
)
@@ -142,73 +141,6 @@ func (h *LLMHandler) SetAPIKey(c *gin.Context) {
})
}
// Factories get model provider factories
// @Summary Get Model Provider Factories
// @Description Get list of model provider factories
// @Tags llm
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Success 200 {array} FactoryResponse
// @Router /v1/llm/factories [get]
func (h *LLMHandler) Factories(c *gin.Context) {
_, errorCode, errorMessage := GetUser(c)
if errorCode != common.CodeSuccess {
jsonError(c, errorCode, errorMessage)
return
}
// Get model providers
dao := dao.NewModelProviderDAO()
providers := dao.GetAllProviders()
// Filter out unwanted providers
filtered := make([]FactoryResponse, 0)
excluded := map[string]bool{
"Youdao": true,
"FastEmbed": true,
"BAAI": true,
"Builtin": true,
}
for _, provider := range providers {
if excluded[provider.Name] {
continue
}
// Collect unique model types from LLMs
modelTypes := make(map[string]bool)
for _, llm := range provider.LLMs {
modelTypes[llm.ModelType] = true
}
// Convert to slice
modelTypeSlice := make([]string, 0, len(modelTypes))
for mt := range modelTypes {
modelTypeSlice = append(modelTypeSlice, mt)
}
// If no model types found, use defaults
if len(modelTypeSlice) == 0 {
modelTypeSlice = []string{"chat", "embedding", "rerank", "image2text", "speech2text", "tts", "ocr"}
}
filtered = append(filtered, FactoryResponse{
Name: provider.Name,
Logo: provider.Logo,
Tags: provider.Tags,
Status: provider.Status,
Rank: provider.Rank,
ModelTypes: modelTypeSlice,
})
}
c.JSON(http.StatusOK, gin.H{
"code": common.CodeSuccess,
"data": filtered,
})
}
// ListApp lists LLMs grouped by factory
// @Summary List LLMs
// @Description Get list of LLMs grouped by factory with availability info