Skip to content

Commit

Permalink
Check if calories is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
kkdai committed Jul 24, 2024
1 parent 0b91053 commit 872dd67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ func (app *GeminiApp) GeminiFunctionCall(prompt string) string {
fmt.Println("date: ", date, "calories: ", calories, "foodItem: ", foodItem)

// If the calories are not provided, ask gemini to calculate the calories.
if calories == 0 {
// Check and convert the calories to float64.
// Convert the calories to float64. (type any = interface{})
if calories == nil {
fmt.Println("Asking Gemini to guess the calories...")
// using default prompt to ask user.
prompt := fmt.Sprintf("我剛剛吃了 %s, 請幫我猜測卡路里,大概就好,只要回覆我數字。", foodItem)
Expand Down

0 comments on commit 872dd67

Please sign in to comment.