Skip to content

Commit f29c7ec

Browse files
feat(dataconnect): Add confirmation for Gemini schema generation (#9282)
* feat(dataconnect): add confirmation for Gemini schema generation Instead of directly asking for an app description to generate a schema with Gemini, this change first asks the user to confirm if they want to use Gemini. If the user confirms, it then prompts for the app description with a default value of "an app for ${setup.projectId}". * prompts * changelog * m * feedback * typo * metrics * Update index.ts --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 1157731 commit f29c7ec

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Add a confirmation in `firebase init dataconnect` before asking for app idea description. (#9282)

src/init/features/dataconnect/index.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,22 @@ export async function askQuestions(setup: Setup): Promise<void> {
118118
"Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data",
119119
);
120120
}
121-
info.appDescription = await input({
122-
message: `Describe your app to automatically generate a schema with Gemini [Enter to use a template]:`,
121+
const wantToGenerate = await confirm({
122+
message: "Do you want to generate schema and queries with Gemini?",
123+
default: false,
123124
});
124-
if (info.appDescription) {
125+
if (wantToGenerate) {
125126
configstore.set("gemini", true);
126127
await ensureGIFApiTos(setup.projectId);
128+
info.appDescription = await input({
129+
message: `Describe your app idea:`,
130+
validate: async (s: string) => {
131+
if (s.length > 0) {
132+
return true;
133+
}
134+
return "Please enter a description for your app idea.";
135+
},
136+
});
127137
}
128138
}
129139
if (hasBilling) {
@@ -161,9 +171,14 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi
161171
await sdk.actuate(setup, config);
162172
} finally {
163173
void trackGA4("dataconnect_init", {
164-
project_status: setup.projectId ? (setup.isBillingEnabled ? "blaze" : "spark") : "missing",
165174
flow: info.analyticsFlow,
166-
provision_cloud_sql: String(info.shouldProvisionCSQL),
175+
project_status: setup.projectId
176+
? setup.isBillingEnabled
177+
? info.shouldProvisionCSQL
178+
? "blaze_provisioned_csql"
179+
: "blaze"
180+
: "spark"
181+
: "missing",
167182
});
168183
}
169184

@@ -646,7 +661,7 @@ async function promptForLocation(setup: Setup, info: RequiredInfo): Promise<void
646661
if (info.locationId === "") {
647662
const choices = await locationChoices(setup);
648663
info.locationId = await select<string>({
649-
message: "What location should the new Cloud SQL instance be in?",
664+
message: "What location would you like to use?",
650665
choices,
651666
default: FDC_DEFAULT_REGION,
652667
});

0 commit comments

Comments
 (0)