refactor: Update tenant ID handling across the application

This commit is contained in:
wizardchen
2025-11-25 16:30:54 +08:00
parent 9f6f5f5773
commit 64c44c9e27
78 changed files with 437 additions and 601 deletions
+11 -2
View File
@@ -109,7 +109,7 @@ func (e *EvaluationService) EvaluationResult(ctx context.Context, taskID string)
return nil, err
}
tenantID := ctx.Value(types.TenantIDContextKey).(uint)
tenantID := ctx.Value(types.TenantIDContextKey).(uint64)
logger.Infof(
ctx,
"Checking tenant ID match, task tenant ID: %d, current tenant ID: %d",
@@ -138,7 +138,7 @@ func (e *EvaluationService) Evaluation(ctx context.Context,
datasetID, knowledgeBaseID, chatModelID, rerankModelID)
// Get tenant ID from context for multi-tenancy support
tenantID := ctx.Value(types.TenantIDContextKey).(uint)
tenantID := ctx.Value(types.TenantIDContextKey).(uint64)
logger.Infof(ctx, "Tenant ID: %d", tenantID)
// Handle knowledge base creation if not provided
@@ -154,6 +154,9 @@ func (e *EvaluationService) Evaluation(ctx context.Context,
var embeddingModelID, llmModelID string
for _, model := range models {
if model == nil {
continue
}
if model.Type == types.ModelTypeEmbedding {
embeddingModelID = model.ID
}
@@ -212,6 +215,9 @@ func (e *EvaluationService) Evaluation(ctx context.Context,
models, err := e.modelService.ListModels(ctx)
if err == nil {
for _, model := range models {
if model == nil {
continue
}
if model.Type == types.ModelTypeRerank {
rerankModelID = model.ID
break
@@ -230,6 +236,9 @@ func (e *EvaluationService) Evaluation(ctx context.Context,
models, err := e.modelService.ListModels(ctx)
if err == nil {
for _, model := range models {
if model == nil {
continue
}
if model.Type == types.ModelTypeKnowledgeQA {
chatModelID = model.ID
break