Siri AppIntent phrasing

When my AppShortcut phrase is:

"Go (.$direction) with (.applicationName)"

Then everything works correctly, the AppIntent correctly receives the parameter. But when my phrase is:

"What is my game (.$direction) with (.applicationName)"

The an alert dialog pops up saying:

"Hey siri what is my game tomorrow with {app name}

Do you want me to use ChatGPT to answer that?"

The phrase is obviously heard correctly, and it's exactly what I've specified in the AppShortcut. Why isn't it being sent to my AppIntent?

import Foundation
import AppIntents

@available(iOS 17.0, *)
enum Direction: String, CaseIterable, AppEnum {
    case today, yesterday, tomorrow, next

     static var typeDisplayRepresentation: TypeDisplayRepresentation {
         TypeDisplayRepresentation(name: "Direction")
     }

    static var caseDisplayRepresentations: [Direction: DisplayRepresentation] = [
         .today: DisplayRepresentation(title: "today", synonyms: []),
         .yesterday: DisplayRepresentation(title: "yesterday", synonyms: []),
         .tomorrow: DisplayRepresentation(title: "tomorrow", synonyms: []),
         .next: DisplayRepresentation(title: "next", synonyms: [])
     ]
 }

@available(iOS 17.0, *)
struct MoveItemIntent: AppIntent {
    static var title: LocalizedStringResource = "Move Item"

    @Parameter(title: "Direction")
    var direction: Direction

    func perform() async throws -> some IntentResult {
        // Logic to move item in the specified direction
        print("Moving item \(direction)")
        return .result()
    }
}

@available(iOS 17.0, *)
final class MyShortcuts: AppShortcutsProvider {
    
    static let shortcutTileColor = ShortcutTileColor.navy
    
    static var appShortcuts: [AppShortcut] {
        
        AppShortcut(
            intent: MoveItemIntent()
            , phrases: [
                         "Go \(\.$direction) with \(.applicationName)"
//                            "What is my game \(\.$direction) with \(.applicationName)"
                        ]
            , shortTitle: "Test of direction parameter"
            , systemImageName: "soccerball"
        )
    }
}

A a starting point, have you added a string catalog named AppShortcuts.xcstrings, and after that's set up, tried out the phrase testing tool? That's available in Xcode through Product > App Shortcuts Preview.

If that phrase is working in the tool, but produces a different result on the device, then we'll want to see a bug report with a sysdiagnose attached. If you file one, post the FB number here for reference.

— Ed Ford,  DTS Engineer

This is better but now has a different problem.

I setup "AppShortcuts.cxstrings" and ran "Product / Build" and it populated the file like this....

  "sourceLanguage" : "en",
  "strings" : {
    "What is my game ${direction} with ${applicationName}" : {
      "extractionState" : "extracted_with_value",
      "localizations" : {
        "en" : {
          "stringSet" : {
            "state" : "new",
            "values" : [
              "What is my game ${direction} with ${applicationName}"
            ]
          }
        }
      }
    }
  },
  "version" : "1.1"
}

When I say the phrase with the parameters "yesterday" or "tomorrow" it works perfectly. When I use "today" or "next", then it pops up dialog with a list of all of the parameter options to choose from.

Siri AppIntent phrasing
 
 
Q