refactor: simplify model selection and attribute handling

- fix ShortAttrInfo.GetAttrValue receiver naming
- replace conditional branches with switch statements
- log test task parameters during validation
This commit is contained in:
douxu 2026-07-14 17:07:06 +08:00
parent 72e2143cb3
commit 2468ea7f31
2 changed files with 9 additions and 2 deletions

View File

@ -154,8 +154,7 @@ func validateBatchImportParams(params map[string]any) bool {
func validateTestTaskParams(params map[string]any) bool { func validateTestTaskParams(params map[string]any) bool {
// Test task has optional parameters, all are valid // Test task has optional parameters, all are valid
// sleep_duration defaults to 60 seconds if not provided // sleep_duration defaults to 60 seconds if not provided
// TODO Add more validation logic for test task parameters if needed fmt.Println("Test task parameters:", params)
fmt.Println(params)
return true return true
} }

View File

@ -1264,6 +1264,14 @@ func runFuzzySearch(ctx context.Context, rdb *redis.Client, searchInput string,
termLastPart = term[lastDotIndex+1:] termLastPart = term[lastDotIndex+1:]
} }
if recommendLenType == constants.FullRecommendLength && hierarchy == constants.GridRecommendHierarchyType {
exists, err := rdb.SIsMember(ctx, constants.RedisAllGridSetKey, termLastPart).Result()
if err != nil || !exists {
logger.Info(ctx, "query key by redis fuzzy search failed or term not in redis all grid set", "query_key", fuzzyInput, "exists", exists, "error", err)
continue
}
}
switch recommendLenType { switch recommendLenType {
case constants.FullRecommendLength: case constants.FullRecommendLength:
if result.Term == "" { if result.Term == "" {