Skip to content

Commit 4571d6a

Browse files
authored
fix(component,ai,gemini): add operation validation for cache task (#1130)
Because - The cache task was missing validation for the required `operation` field, which could lead to runtime errors or unexpected behavior when users don't specify which cache operation to perform This commit - Adds validation to check if the `operation` field is specified before proceeding with cache operations
1 parent e392cf5 commit 4571d6a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/component/ai/gemini/v0/task_cache.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ func (e *execution) cache(ctx context.Context, job *base.Job) error {
1717
return nil
1818
}
1919

20+
// Check if operation is specified
21+
if in.Operation == "" {
22+
err := fmt.Errorf("caching operation is not specified")
23+
job.Error.Error(ctx, err)
24+
return nil
25+
}
26+
2027
// Create Gemini client
2128
client, err := e.createGeminiClient(ctx)
2229
if err != nil {

0 commit comments

Comments
 (0)