From 44433440702918ca4d2ef28465c1f219ab838cc7 Mon Sep 17 00:00:00 2001 From: gogiapandie Date: Wed, 14 Jan 2026 21:08:02 +0000 Subject: [PATCH 1/2] upsate --- .idx/integrations.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .idx/integrations.json diff --git a/.idx/integrations.json b/.idx/integrations.json new file mode 100644 index 0000000..dd01021 --- /dev/null +++ b/.idx/integrations.json @@ -0,0 +1,3 @@ +{ + "gemini_api": {} +} \ No newline at end of file From 0c9551e417f79cc33ec94062bd506453c648ab1e Mon Sep 17 00:00:00 2001 From: gogiapandie Date: Wed, 14 Jan 2026 21:08:37 +0000 Subject: [PATCH 2/2] commit --- .idx/integrations.json | 1 + src/app/app.component.ts | 29 ++++++++++++++++++++++------- src/styles.css | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/.idx/integrations.json b/.idx/integrations.json index dd01021..c668c7e 100644 --- a/.idx/integrations.json +++ b/.idx/integrations.json @@ -1,3 +1,4 @@ { + "cloud_run_deploy": {}, "gemini_api": {} } \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d55347d..039c05b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -55,7 +55,7 @@ The melody should be about: `; Prompt: -  
+ Examples: + + + +
{{ error }}

+
+
+

Generated Melody

+
{{ generatedTune }}
+
`, styleUrl: 'app.component.css' }) @@ -74,18 +84,22 @@ export class AppComponent { protected apiKey = viewChild.required>('apiKey'); protected loading = false; protected error = ''; + protected generatedTune = ''; async generateTune(prompt: string) { + if (!this.apiKey().nativeElement.value) { + this.error = 'Please enter an API key.'; + return; + } + this.error = ''; + this.generatedTune = ''; + prompt = basePrompt + prompt; - /** - * For production apps, make sure you use the Gemini API key **only** - * on the server. Find more at https://ai.google.dev/gemini-api/docs/get-started/web - */ const genAI = new GoogleGenerativeAI(this.apiKey().nativeElement.value); const model = genAI.getGenerativeModel({ - model: 'gemini-1.5-pro-latest' + model: 'gemini-pro' }); model.generationConfig.responseMimeType = 'application/json'; @@ -97,9 +111,10 @@ export class AppComponent { const text = response.text(); const tune = JSON.parse(text); + this.generatedTune = JSON.stringify(tune, null, 2); this.keyboard().playMelody(tune); } catch (e: unknown) { - this.error = e; + this.error = e as string; } finally { this.loading = false; } diff --git a/src/styles.css b/src/styles.css index f879613..c878122 100644 --- a/src/styles.css +++ b/src/styles.css @@ -15,3 +15,35 @@ */ /* You can add global styles to this file, and also import other style files */ + +:root { + --mat-app-background-color: #121212; + --mat-card-background-color: #1e1e1e; + --mat-card-header-text-color: #ffffff; + --mat-card-subtitle-text-color: #b3b3b3; + --mat-card-content-text-color: #ffffff; + --mat-primary-color: #bb86fc; + --mat-accent-color: #03dac6; + --mat-warn-color: #cf6679; +} + +body { + background-color: var(--mat-app-background-color); + color: white; + font-family: Roboto, "Helvetica Neue", sans-serif; + margin: 0; + padding: 24px; +} + +.mat-card { + background-color: var(--mat-card-background-color); + color: var(--mat-card-content-text-color); +} + +.mat-card-header { + color: var(--mat-card-header-text-color); +} + +.mat-card-subtitle { + color: var(--mat-card-subtitle-text-color); +}