Refactor AI Agent and AI Config handling across multiple files
- Updated function signatures to accept AI Agent and AI Config as non-pointer types for better clarity and safety. - Modified instances where AI Agent and AI Config were dereferenced to improve code readability. - Removed unnecessary nil checks for AI Agent and AI Config, simplifying the logic. - Adjusted related tests and services to align with the new function signatures. - Cleaned up code in runtime, skills, and executor packages to ensure consistency in handling AI configurations.
This commit is contained in:
@@ -3,8 +3,6 @@ package skills
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"cs-agent/internal/pkg/errorsx"
|
||||
)
|
||||
|
||||
func newPlanService() *planService {
|
||||
@@ -15,13 +13,7 @@ type planService struct{}
|
||||
|
||||
// BuildExecutionPlan 构建当前请求的 Skill 执行计划。
|
||||
func (s *planService) BuildExecutionPlan(execCtx context.Context, ctx RuntimeContext) (*ExecutionPlan, error) {
|
||||
if ctx.AIAgent == nil {
|
||||
return nil, errorsx.InvalidParam("AIAgent不能为空")
|
||||
}
|
||||
if ctx.AIConfig == nil {
|
||||
return nil, errorsx.InvalidParam("AIConfig不能为空")
|
||||
}
|
||||
skill, matchReason, routeTrace, err := MatchSkill(execCtx, ctx, ctx.AIAgent, ctx.AIConfig)
|
||||
skill, matchReason, routeTrace, err := MatchSkill(execCtx, ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user