@@ -79,7 +79,7 @@ n日:箇条書き3
7979 return "" , fmt .Errorf ("failed to generate content: %w" , err )
8080 }
8181
82- if len (resp .Candidates ) == 0 || len (resp .Candidates [0 ].Content .Parts ) == 0 {
82+ if len (resp .Candidates ) == 0 || resp . Candidates [ 0 ]. Content == nil || len (resp .Candidates [0 ].Content .Parts ) == 0 {
8383 return "" , fmt .Errorf ("no content generated" )
8484 }
8585
@@ -125,7 +125,7 @@ func (g *GeminiClient) GenerateDailySummary(ctx context.Context, diaryContent st
125125 return "" , fmt .Errorf ("failed to generate content: %w" , err )
126126 }
127127
128- if len (resp .Candidates ) == 0 || len (resp .Candidates [0 ].Content .Parts ) == 0 {
128+ if len (resp .Candidates ) == 0 || resp . Candidates [ 0 ]. Content == nil || len (resp .Candidates [0 ].Content .Parts ) == 0 {
129129 return "" , fmt .Errorf ("no content generated" )
130130 }
131131
@@ -267,7 +267,7 @@ activities(活動・行動):
267267 return "" , fmt .Errorf ("failed to generate content: %w" , err )
268268 }
269269
270- if len (resp .Candidates ) == 0 || len (resp .Candidates [0 ].Content .Parts ) == 0 {
270+ if len (resp .Candidates ) == 0 || resp . Candidates [ 0 ]. Content == nil || len (resp .Candidates [0 ].Content .Parts ) == 0 {
271271 return "" , fmt .Errorf ("no content generated" )
272272 }
273273
@@ -360,7 +360,7 @@ func (g *GeminiClient) SplitDiaryIntoChunks(ctx context.Context, content string)
360360 return nil , fmt .Errorf ("failed to split diary into chunks: %w" , err )
361361 }
362362
363- if len (resp .Candidates ) == 0 || len (resp .Candidates [0 ].Content .Parts ) == 0 {
363+ if len (resp .Candidates ) == 0 || resp . Candidates [ 0 ]. Content == nil || len (resp .Candidates [0 ].Content .Parts ) == 0 {
364364 return nil , fmt .Errorf ("no content returned from chunk splitting" )
365365 }
366366
@@ -465,7 +465,7 @@ func (g *GeminiClient) GenerateHighlights(ctx context.Context, diaryContent stri
465465 return "" , fmt .Errorf ("failed to generate content: %w" , err )
466466 }
467467
468- if len (resp .Candidates ) == 0 || len (resp .Candidates [0 ].Content .Parts ) == 0 {
468+ if len (resp .Candidates ) == 0 || resp . Candidates [ 0 ]. Content == nil || len (resp .Candidates [0 ].Content .Parts ) == 0 {
469469 return "" , fmt .Errorf ("no content generated" )
470470 }
471471
0 commit comments