Google AI Studio और Cloud Run पर, कस्टम निर्देशों के साथ उपयोगकर्ता की पुष्टि करने वाला एआई ऐप्लिकेशन बनाना

1. परिचय

इस कोडलैब में, Google AI Studio को पसंद के मुताबिक़ निर्देशों के साथ कॉन्फ़िगर किया जाएगा. इससे, प्रोडक्शन के लिए सुरक्षित डेवलपमेंट पैटर्न को बुनियादी चरण के तौर पर इस्तेमाल किया जा सकेगा. साथ ही, "Personal Gemini Journal" ऐप्लिकेशन बनाया जाएगा. यह ऐप्लिकेशन, पुष्टि किया गया एक वेब ऐप्लिकेशन है. इसकी मदद से, उपयोगकर्ता साइन इन कर सकते हैं और Gemini के साथ इंटरैक्ट करके, आइडिया पर मंथन कर सकते हैं या जर्नल लिख सकते हैं. साथ ही, अपने इंटरैक्शन की खास जानकारी और लॉग को Cloud Firestore में अपने-आप सेव कर सकते हैं.

Google AI Studio में एंटरप्राइज़ प्रोडक्शन से जुड़े निर्देश सीधे तौर पर एम्बेड करके, एआई मॉडल को सुरक्षा के सख्त तरीकों का पालन करने का निर्देश दिया जाता है. जैसे, थ्रेट मॉडलिंग, सुरक्षित कोडिंग स्टैंडर्ड, डेटाबेस आइसोलेशन, और सीक्रेट मैनेजमेंट. इससे आपको ऐप्लिकेशन कोड जनरेट करने और उसे बनाए रखने में मदद मिलती है.

आपको क्या बनाना होगा

  • कॉन्फ़िगर किया गया Google AI Studio ऐप्लिकेशन, जिसमें सुरक्षा से जुड़े कस्टम निर्देश शामिल हैं.
  • "Personal Gemini Journal" वेब ऐप्लिकेशन, जिसमें ये सुविधाएं शामिल हैं:
    • Firebase की मदद से उपयोगकर्ता की पुष्टि करना.
    • Gemini API के साथ मल्टी-टर्न इंटरैक्शन.
    • उपयोगकर्ता के लिए अलग से Firestore दस्तावेज़ स्टोरेज.
    • Google Cloud Secret Manager की मदद से, एपीआई पासकोड को सुरक्षित तरीके से वापस पाना.
  • Google AI Studio का इस्तेमाल करके बनाई गई, आपकी अपनी यूनीक सुविधाएं.

आपको क्या सीखने को मिलेगा

  • Google AI Studio में, पसंद के मुताबिक़ निर्देश कॉन्फ़िगर करने का तरीक़ा. जैसे, थ्रेट मॉडलिंग, सुरक्षित कोडिंग, Firestore की सुरक्षा, Secret Manager, सुरक्षा की समीक्षाएं, और README जनरेट करना.
  • नई सेवाएं (जैसे, जगह की जानकारी, मैसेज सेवा या बाहरी एपीआई) जोड़ने के लिए, कस्टम निर्देशों को डिज़ाइन करने और उन्हें बेहतर बनाने का तरीका.
  • एलएलएम ऐप्लिकेशन बनाने और उन्हें बड़े पैमाने पर उपलब्ध कराने के लिए, सुरक्षित डेवलपमेंट पैटर्न.
  • कंटेनराइज़्ड वेब ऐप्लिकेशन को Google Cloud Run पर डिप्लॉय करने का तरीका.
  • अपने-आप होने वाली पुष्टि के लिए, Cloud Run के संसाधनों को टैग करने का तरीका.

आपको इन चीज़ों की ज़रूरत पड़ेगी

  • Google AI Studio का ऐक्सेस.
  • बिलिंग की सुविधा वाला Google Cloud प्रोजेक्ट.
  • gcloud सीएलआई इंस्टॉल किया गया हो और उसकी पुष्टि की गई हो (या Google Cloud Shell).
  • वर्शन कंट्रोल के लिए Git.

2. Google AI Studio को कॉन्फ़िगर करना

Google AI Studio में अपना सुरक्षित वर्कस्पेस एनवायरमेंट सेट अप करने के लिए, यह तरीका अपनाएं.

पहला चरण: नया ऐप्लिकेशन बनाना

  1. Google AI Studio खोलें.
  2. बाईं ओर मौजूद नेविगेशन पैनल में, Build सेक्शन में जाएं और New App पर क्लिक करें. आपके व्यू के आधार पर, आपको यह Build Mode के तौर पर भी दिख सकता है.
  3. सेटिंग के लिए, सबसे ऊपर दाईं ओर मौजूद गियर आइकॉन (⚙) पर क्लिक करें.
  4. वह बेस मॉडल और फ़्रेमवर्क चुनें जिसका आपको इस्तेमाल करना है या डिफ़ॉल्ट सेटिंग को बनाए रखें.
  5. सिस्टम से जुड़े निर्देशों में जाकर, कस्टम निर्देश वाले बॉक्स पर क्लिक करें.

दूसरा चरण: अपनी पसंद के मुताबिक़ निर्देश जोड़ना

Google AI Studio एक बेहतरीन प्लैटफ़ॉर्म है. इसकी मदद से, तेज़ी से प्रोटोटाइप बनाए जा सकते हैं और अपने आइडिया को हकीकत में बदला जा सकता है. यह पक्का करने के लिए कि आपका ऐप्लिकेशन सुरक्षित तरीके से स्केल करने के लिए तैयार है, GitHub के ज़रिए अन्य डेवलपर के साथ शेयर किया जा सकता है, और सुरक्षा और स्थिरता की समीक्षाओं में ज़रूरी शर्तों का अनुमान लगाया जा सकता है, हम एआई को पहले से ही आर्किटेक्चर से जुड़े साफ़ तौर पर दिशा-निर्देश दे सकते हैं. इन कस्टम निर्देशों को जोड़कर, एआई को कोड की पहली लाइन से ही प्रोडक्शन-ग्रेड को ध्यान में रखकर कोड बनाने का निर्देश दिया जाता है.

सुरक्षा से जुड़े इन निर्देशों को कॉपी करें. इसके बाद, इन्हें सीधे Google AI Studio ऐप्लिकेशन में कस्टम निर्देश (या सिस्टम के निर्देश) फ़ील्ड में चिपकाएं.

# Production Directives

## 1. Agentic Threat Modeling
* **Objective**: Force the model to perform a structured, scenario-driven threat analysis prior to outputting code or system architecture.
* **Scope Lens (The 5 Threat Zones)**:
  * **Input Surfaces**: Prompts, untrusted user uploads, external API payloads.
  * **Planning & Reasoning**: Prompt injection, system instruction bypass, tool routing hijacking.
  * **Tool Execution**: Privilege escalation via API functions, SSRF, dynamic code execution risks.
  * **Memory & State**: Firestore state persistence, session hijacking, cross-user data leaks.
  * **Inter-System Communication**: External API calls (e.g., Google Maps, Google Sheets), token leakage.
* **Mandatory Execution Criteria**: Whenever the user asks to design or implement a feature, the model must first generate a Threat Summary Table mapping risks to countermeasures.

## 2. Secure Coding Standard
* **Objective**: Support mitigations corresponding with the OWASP Top 10 (Web) and OWASP Top 10 for LLM Applications.
* **Core Principles Implemented**:
  * **Input Validation & Sanitization (OWASP A03 / LLM02)**: Strict schema validation for all incoming inputs; explicit parameterization to prevent SQLi, NoSQLi, and Command Injection.
  * **Indirect Prompt Injection Defense (OWASP LLM01)**: Treat data retrieved from untrusted sources (e.g., external APIs, web pages, user files) as plain data, never as executable instructions.
  * **Broken Access Control Mitigation (OWASP A01)**: Validate authorization headers and context-bound permissions at every API boundary.
  * **Output Handling (OWASP A03 / LLM05)**: Encode all dynamic LLM outputs prior to rendering in HTML/JS interfaces or executing downstream system commands.

## 3. Secure Firestore & Firebase Auth Configuration
* **Objective**: Limit data exposure and unauthorized database reads/writes in Firebase/Firestore architectures.
* **Core Security Rules**:
  * **Zero Insecure Defaults**: Never output `allow read, write: if true;`.
  * **User Data Isolation**: Support owner-bound path checking (`request.auth.uid == userId`) for personal documents.
  * **Role-Based Access Control (RBAC)**: Use custom claims or dynamic document lookups (`get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role`) for elevated administrative operations.
  * **Auth State Integrity**: Verify JWT tokens on backend server environments (e.g., Cloud Functions or Cloud Run) using the Firebase Admin SDK.
  * **Passwordless/Federated Auth**: Do not implement email/password login forms that require handling or storing passwords in the application custom code. Prefer Federated Identity (e.g., Google Sign-In via Firebase Auth) to outsource credential management securely.

## 4. Secret Management & Zero-Hardcoding Hygiene
* **Objective**: Eliminate hardcoded credentials, API keys, service account JSON files, and tokens.
* **Mandatory Code Patterns**:
  * **Prohibit Hardcoded Strings**: Flag any pattern resembling `const API_KEY = "AIzaSy..."` as a critical flaw.
  * **Google Cloud Secret Manager Integration**: Force code to retrieve operational credentials dynamically using Secret Manager or environment variable injection:
  ```python
  from google.cloud import secretmanager

  def access_secret(secret_id: str, version_id: str = "latest") -> str:
      client = secretmanager.SecretManagerServiceClient()
      name = f"projects/your-project-id/secrets/{secret_id}/versions/{version_id}"
      response = client.access_secret_version(request={"name": name})
      return response.payload.data.decode("UTF-8")
  ```

## 5. Security Reviewer Persona
* **Objective**: Review any code for common security issues, based on the threat model and best practices.
* **Review Methodology**:
  * Inspect for hardcoded credentials and unsafe default settings.
  * Map data flow from untrusted entry point to storage/execution sink.
  * Validate access control checks at every function boundary.
  * Provide a severity-ranked vulnerability list with concrete code diffs for remediation.

## 6. Functional Stability & Walkthroughs
* **Objective**: In the absence of writing tests, produce steps to test that a user can walk through, broken down into specific pieces of functionality that another coding tool can turn into actual test scripts. **Every type of process and user interaction that a user can see or trigger must have a corresponding test case written out.**

# Production Directives

## 1. Agentic Threat Modeling
* **Objective**: Force the model to perform a structured, scenario-driven threat analysis prior to outputting code or system architecture.
* **Scope Lens (The 5 Threat Zones)**:
  * **Input Surfaces**: Prompts, untrusted user uploads, external API payloads.
  * **Planning & Reasoning**: Prompt injection, system instruction bypass, tool routing hijacking.
  * **Tool Execution**: Privilege escalation via API functions, SSRF, dynamic code execution risks.
  * **Memory & State**: Firestore state persistence, session hijacking, cross-user data leaks.
  * **Inter-System Communication**: External API calls (e.g., Google Maps, Google Sheets), token leakage.
* **Mandatory Execution Criteria**: Whenever the user asks to design or implement a feature, the model must first generate a Threat Summary Table mapping risks to countermeasures.

## 2. Secure Coding Standard
* **Objective**: Support mitigations corresponding with the OWASP Top 10 (Web) and OWASP Top 10 for LLM Applications.
* **Core Principles Implemented**:
  * **Input Validation & Sanitization (OWASP A03 / LLM02)**: Strict schema validation for all incoming inputs; explicit parameterization to prevent SQLi, NoSQLi, and Command Injection.
  * **Indirect Prompt Injection Defense (OWASP LLM01)**: Treat data retrieved from untrusted sources (e.g., external APIs, web pages, user files) as plain data, never as executable instructions.
  * **Broken Access Control Mitigation (OWASP A01)**: Validate authorization headers and context-bound permissions at every API boundary.
  * **Output Handling (OWASP A03 / LLM05)**: Encode all dynamic LLM outputs prior to rendering in HTML/JS interfaces or executing downstream system commands.

## 3. Secure Firestore & Firebase Auth Configuration
* **Objective**: Limit data exposure and unauthorized database reads/writes in Firebase/Firestore architectures.
* **Core Security Rules**:
  * **Zero Insecure Defaults**: Never output `allow read, write: if true;`.
  * **User Data Isolation**: Support owner-bound path checking (`request.auth.uid == userId`) for personal documents.
  * **Role-Based Access Control (RBAC)**: Use custom claims or dynamic document lookups (`get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role`) for elevated administrative operations.
  * **Auth State Integrity**: Verify JWT tokens on backend server environments (e.g., Cloud Functions or Cloud Run) using the Firebase Admin SDK.

## 4. Secret Management & Zero-Hardcoding Hygiene
* **Objective**: Eliminate hardcoded credentials, API keys, service account JSON files, and tokens.
* **Mandatory Code Patterns**:
  * **Prohibit Hardcoded Strings**: Flag any pattern resembling `const API_KEY = "AIzaSy..."` as a critical flaw.
  * **Google Cloud Secret Manager Integration**: Force code to retrieve operational credentials dynamically using Secret Manager or environment variable injection:
  ```python
  from google.cloud import secretmanager

  def access_secret(secret_id: str, version_id: str = "latest") -> str:
      client = secretmanager.SecretManagerServiceClient()
      name = f"projects/your-project-id/secrets/{secret_id}/versions/{version_id}"
      response = client.access_secret_version(request={"name": name})
      return response.payload.data.decode("UTF-8")
  ```

## 5. Security Reviewer Persona
* **Objective**: Review any code for common security issues, based on the threat model and best practices.
* **Review Methodology**:
  * Inspect for hardcoded credentials and unsafe default settings.
  * Map data flow from untrusted entry point to storage/execution sink.
  * Validate access control checks at every function boundary.
  * Provide a severity-ranked vulnerability list with concrete code diffs for remediation.

## 6. Functional Stability & Walkthroughs
* **Objective**: In the absence of writing tests, produce steps to test that a user can walk through, broken down into specific pieces of functionality that another coding tool can turn into actual test scripts. **Every type of process and user interaction that a user can see or trigger must have a corresponding test case written out.**

* **Interactive Functionality**: Any buttons that submit an input, either to Gemini API, Firestore, or any added functionality, must actually work.
* **Gemini Model Resilience & Fallback Protocol**: Whenever implementing server-side or client-side Gemini AI features with `@google/genai`:
  1. **Resilient Model Fallback Ladder**:
    Never hardcode a single model string to execute content generation in a single try. Always wrap `generateContent` or `generateContentStream` calls with an automated fallback ladder ordered by availability and latency:
    - Primary: `"gemini-3.6-flash"`
    - High-Availability Fallback: `"gemini-3.1-flash-lite"`
    - Dynamic Alias: `"gemini-flash-latest"`
    - Deep Reasoning Fallback: `"gemini-3.7-flash"`
  2. **Error Recovery Matrix**:
    Catch recoverable HTTP/API status codes (`503 UNAVAILABLE`, `429 RESOURCE_EXHAUSTED`, `404 NOT_FOUND`, `500 INTERNAL`) and sequentially attempt the next model in the fallback chain before bubbling an error up to the UI.
  3. **Standard Helper Implementation**:
    Always scaffold a reusable helper utility (e.g., `generateContentWithFallback`) in backend routes to ensure uniform resilience across all endpoints.
* **Server-Side Robustness & Payload Ingestion Standards**: Across all backend frameworks and runtimes:
  1. **Top-Level Request Deserialization (Ordering Guarantee)**:
    Always mount and configure body parsers and JSON payload middleware before defining any endpoint routes. Handlers must never be registered upstream of payload decoding middleware.
  2. **Defensive Payload Ingestion (Null-Safe Destructuring)**:
    Never assume incoming request bodies, query parameters, or headers exist. Always sanitize and guard input sources with fallback defaults prior to destructuring (e.g., `const data = (req.body && typeof req.body === 'object') ? req.body : {};`). Treat any missing payload as a valid empty input or return a clean `400 Bad Request` instead of allowing unhandled runtime exceptions.
  3. **Unified Full-Stack Dev Script Alignment**:
    Whenever a backend service layer or API proxy is introduced, ensure project configuration and startup scripts (`dev`, `build`, `start`) boot the unified server entrypoint rather than a frontend-only static bundler.
* **Database Persistence, Clean Payloads, & Transaction Integrity**: Whenever handling user input, document creation, or AI generation workflows:
  1. **Strict Undefined-Stripping (Zero-Crash Payload Hygiene)**:
    - Before passing any object to database SDKs (Firestore `setDoc`/`updateDoc`, SQL ORMs, MongoDB, etc.), sanitize the payload to strip all `undefined` values (e.g., using a sanitizer utility or `JSON.parse(JSON.stringify(payload))` / object filtering). Never allow `undefined` properties to reach the database driver.
  2. **Guaranteed Transaction Verification (Input-to-Save Completeness)**:
    - Whenever a user submits an input (prompt, form, reflection, chat, or interaction), the application MUST ensure both the user input AND any generated output are successfully persisted.
    - If user input is received but the save operation or downstream generation fails, the system MUST NOT fail silently.
  3. **Explicit Error Escalation & User Feedback**:
    - Always catch database write rejections and display a clear, accessible error banner or toast in the UI with a "Retry Save" option.
    - Never clear the user's input buffer or reset UI state if the persistence operation has not settled with a confirmed successful write.

## 7. README Generator
* **Objective**: Force the model to generate a professional, production-grade `README.md` file that guides developers step-by-step on how to configure, secure, and deploy the application to Google Cloud Run, supporting compliance with security rules and campaign verification requirements.
* **Scope Lens (Deployment & Configuration Zones)**:
  * **Environment & Prerequisites**: Specific instructions on enabling necessary Google Cloud APIs (Cloud Run, Secret Manager, Firestore) and installing the Firebase / Google Cloud SDK (gcloud CLI).
  * **Secret Management Setup**: Step-by-step guidance on creating Secret Manager secrets (e.g., `GEMINI_API_KEY`) and granting the Cloud Run runtime service account the necessary Secret Manager Secret Accessor IAM permissions.
  * **Database Security Configuration**: Instructions for provisioning Cloud Firestore and deploying secure, owner-bound security rules (`firestore.rules`).
  * **Cloud Run Deployment Flow**: Pre-formatted, container-friendly deploy instructions utilizing the `gcloud run deploy` command.
  * **Required Campaign Labeling**: Detailed instructions on applying the mandatory resource label to register the service for automated challenge verification.
* **Mandatory Execution Criteria**: When invoked, the model must output a fully populated, copy-pasteable README structure. It is highly recommended that the generated README includes:
  1. **Firestore Security Rules**: The exact rules block supporting user data isolation:
     ```javascript
     rules_version = '2';
     service cloud.firestore {
       match /databases/{database}/documents {
         match /users/{userId}/interactions/{interactionId} {
           allow read, write: if request.auth != null && request.auth.uid == userId;
         }
       }
     }
     ```
  2. **Secret Manager Bindings**:
     ```bash
     # Create and populate the secret
     gcloud secrets create GEMINI_API_KEY --replication-policy="automatic"
     echo -n "YOUR_API_KEY" | gcloud secrets versions add GEMINI_API_KEY --data-file=-

     # Grant the default Cloud Run service account access to read the secret
     gcloud secrets add-iam-policy-binding GEMINI_API_KEY \
       --member="serviceAccount:YOUR_PROJECT_NUMBER-compute@developer.gserviceaccount.com" \
       --role="roles/secretmanager.secretAccessor"
     ```
  3. **Verification Binding**:
     ```bash
     gcloud run services update <SERVICE_NAME> \
       --update-labels=dev-tutorial=cloud-run-ai-challenge \
       --region=<REGION>
     ```

## 7. README Generator
* **Objective**: Force the model to generate a professional, production-grade `README.md` file that guides developers step-by-step on how to configure, secure, and deploy the application to Google Cloud Run, supporting compliance with security rules and campaign verification requirements.
* **Scope Lens (Deployment & Configuration Zones)**:
  * **Environment & Prerequisites**: Specific instructions on enabling necessary Google Cloud APIs (Cloud Run, Secret Manager, Firestore) and installing the Firebase / Google Cloud SDK (gcloud CLI).
  * **Secret Management Setup**: Step-by-step guidance on creating Secret Manager secrets (e.g., `GEMINI_API_KEY`) and granting the Cloud Run runtime service account the necessary Secret Manager Secret Accessor IAM permissions.
  * **Database Security Configuration**: Instructions for provisioning Cloud Firestore and deploying secure, owner-bound security rules (`firestore.rules`).
  * **Cloud Run Deployment Flow**: Pre-formatted, container-friendly deploy instructions utilizing the `gcloud run deploy` command.
  * **Required Campaign Labeling**: Detailed instructions on applying the mandatory resource label to register the service for automated challenge verification:
* **Mandatory Execution Criteria**: When invoked, the model must output a fully populated, copy-pasteable README structure. It is highly recommended that the generated README includes:
  1. **Firestore Security Rules**: The exact rules block supporting user data isolation:
     ```javascript
     rules_version = '2';
     service cloud.firestore {
       match /databases/{database}/documents {
         match /users/{userId}/interactions/{interactionId} {
           allow read, write: if request.auth != null && request.auth.uid == userId;
         }
       }
     }
     ```
  2. **Secret Manager Bindings**:
     ```bash
     # Create and populate the secret
     gcloud secrets create GEMINI_API_KEY --replication-policy="automatic"
     echo -n "YOUR_API_KEY" | gcloud secrets versions add GEMINI_API_KEY --data-file=-

     # Grant the default Cloud Run service account access to read the secret
     gcloud secrets add-iam-policy-binding GEMINI_API_KEY \
       --member="serviceAccount:YOUR_PROJECT_NUMBER-compute@developer.gserviceaccount.com" \
       --role="roles/secretmanager.secretAccessor"
     ```
  3. **Verification Binding**:
     ```bash
     gcloud run services update <SERVICE_NAME> \
       --update-labels=dev-tutorial=cloud-run-ai-challenge \
       --region=<REGION>
     ```

3. डेवलपर चैलेंज: "Personal Gemini Journal" बनाएं

सुरक्षित AI Studio ऐप्लिकेशन को कॉन्फ़िगर करने के बाद, आपका चैलेंज Personal Gemini Journal को डिज़ाइन करना और बनाना है. यह एक सुरक्षित वेब ऐप्लिकेशन है, जिसमें जर्नल बनाए जा सकते हैं.

शुरुआत करने के लिए, यहाँ दिए गए प्रॉम्प्ट को कॉपी करके, सीधे Google AI Studio चैट में पेस्ट करें. यह आपका शुरुआती प्रॉम्प्ट होगा. एआई से ऐप्लिकेशन आर्किटेक्चर डिज़ाइन करने और स्टार्टर कोड जनरेट करने में मदद लें.

Help me build a user-authenticated web application that uses the Gemini API and Firestore. 

**User Flow:**
1. The user arrives at the landing page and is prompted to Sign In.
2. After successful authentication, the user is taken to their private dashboard.
3. The dashboard allows the user to write multi-turn "journal entries" or "reflections" and converse with Gemini.
4. Gemini provides helpful summaries, brainstorming ideas, or reflections on the user's input.
5. All interactions (prompts and Gemini responses) are saved to the Firstore, isolated strictly to this specific user so that different users can't read each other's entries.
6. The user can view a history of their past entries.

**Tech Stack Requirements:**
| Component | Technology | Purpose |
| :--- | :--- | :--- |
| **User Identity** | Firebase Authentication | Secure login via Google Sign-In, do not directly store emails and passwords. |
| **Backend Database** | Cloud Firestore | User-isolated document storage for saving chat history and session summaries. |
| **AI Processing Engine** | Gemini 3.6 Flash API | Generates replies and provides summarization of user journal entries. |
| **Secret Management** | Secret Manager / Env Vars | Securely stores Gemini API keys and Firebase credentials. |

आपको सबसे पहले थ्रेट मॉडल का विश्लेषण दिखेगा. इसमें बताया गया है कि AI Studio, आपके ऐप्लिकेशन पर लागू होने वाली सामान्य समस्याओं को कैसे मैनेज करेगा. जैसे, यह पक्का करना कि आपकी GEMINI_API_KEY कभी भी क्लाइंट-साइड पर ज़ाहिर न हो. साथ ही, Firestore के साथ एट्रिब्यूट-आधारित ऐक्सेस कंट्रोल (एबीएसी) का इस्तेमाल करना, ताकि उपयोगकर्ता एक-दूसरे की एंट्री न देख सकें.

I have initiated the Firebase setup request for Firebase Authentication and Cloud Firestore. Please review and accept the Firebase terms in the setup prompt to continue.

एआई स्टूडियो से ऐप्लिकेशन जनरेट होने के बाद, आपको विंडो में अपने ऐप्लिकेशन की झलक दिखेगी! अब टेस्ट करने का समय आ गया है. अगर आपको बुनियादी सुविधाओं से जुड़ी समस्याएं आती हैं, तो उनके बारे में AI Studio को ज़्यादा जानकारी दें, ताकि वह उन्हें ठीक कर सके.

  1. पक्का करें कि आपके पास उपयोगकर्ता के तौर पर लॉग इन करने की सुविधा हो.
  2. Gemini के साथ इंटरैक्शन की सुविधा को टेस्ट करें.
  3. रिफ़्लेक्शन सेव करें, लॉग आउट करें, और फिर से लॉग इन करें. इसके बाद, देखें कि वे सेव हुए हैं या नहीं.
  4. अपने टेस्ट केस के अन्य चरणों को पूरा करें. साथ ही, यह पक्का करें कि वे काम कर रहे हों.

होने वाली गड़बड़ियों का लॉग भी अपने-आप रिकॉर्ड हो जाता है. इसके बाद, बाईं ओर मौजूद आउटपुट बॉक्स में सबसे नीचे, गड़बड़ियां ठीक करें बटन पर क्लिक करके, AI Studio से उन्हें ठीक करने के लिए कहा जा सकता है.

अगर आपको लगता है कि कोई सुविधा मौजूद नहीं है या कोई गड़बड़ी है, तो उसके बारे में बताएं. साथ ही, AI Studio को उसे ठीक करने के लिए कहें.

4. Cloud Run पर डिप्लॉय करें

ऐप्लिकेशन बनाने और उसके काम करने के बाद, उसे Google Cloud का इस्तेमाल करके एक्सपोर्ट और डिप्लॉय किया जा सकता है.

Google AI Studio से डिप्लॉय करना और लेबल करना

  1. ऐप्लिकेशन डैशबोर्ड में सबसे ऊपर दाईं ओर, पब्लिश करें बटन ढूंढें.
  2. इसके बाद, अपनी पसंद के मुताबिक विकल्प चुनें और एक यूनीक ऐप्लिकेशन यूआरएल बनाएं.
  3. अपना ऐप्लिकेशन पब्लिश करें पर क्लिक करें
  4. पब्लिश करने के बाद, नए लिंक पर जाएं और अपने लाइव ऐप्लिकेशन को टेस्ट करें!
  5. Google Cloud में आपका ऐप्लिकेशन जिस Cloud Run सेवा पर चल रहा है उसे देखने के लिए, ऐडवांस सेटिंग पर क्लिक करें.
  6. हरे रंग के सही के निशान के बगल में मौजूद सेवा का नाम देखें.
  7. Services टैब पर क्लिक करें और सेवा के नाम के बगल में मौजूद बॉक्स को चुनें.
  8. सबसे ऊपर मौजूद बॉक्स में, लेबल पर क्लिक करें. इस बॉक्स में, "एक सेवा चुनी गई" लिखा होता है
  9. + लेबल जोड़ें पर क्लिक करें
  10. कुंजी 2 में, dev-tutorial लिखें और वैल्यू 2 में cloud-run-ai-challenge डालें
  11. टाइपिंग की गलतियां देखें और सेव करें पर क्लिक करें

5. GitHub पर बदलाव करना और शेयर करना

अब आपके पास अपने ऐप्लिकेशन में बदलाव करने और उसे फिर से पब्लिश करने का विकल्प है, ताकि वह यूनीक बन सके!

चैलेंज को पूरा करने के लिए, आपको GitHub पर अपना प्रोजेक्ट शेयर करना होगा. इसमें डिप्लॉय करने के चरणों की जानकारी देने वाली README फ़ाइल भी शामिल होनी चाहिए. इससे आपकी ऑडियंस आपके काम को देख पाती है और जज आपके ऐप्लिकेशन को टेस्ट कर पाते हैं. साथ ही, अगर आपको अपने ऐप्लिकेशन में किए गए बदलावों का इतिहास ट्रैक करना है, तो वह भी किया जा सकता है. इससे लोग आपके ऐप्लिकेशन के सफ़र को देख पाएंगे.

GitHub पर शेयर करने के लिए, AI Studio में वापस जाएं:

  1. सबसे ऊपर दाईं ओर मौजूद, शेयर करें बटन पर क्लिक करें.
  2. साइड में स्क्रोल करके, GitHub पर जाएं
  3. GitHub से कनेक्ट करने और अपने प्रोजेक्ट के लिए रिपॉज़िटरी बनाने के लिए, यह तरीका अपनाएं.

6. अगले चरण

चैलेंज के लिए प्रोटोटाइप को बेहतर बनाना

मुख्य ज़रूरी शर्तें तो बस शुरुआत हैं. अपने प्रोजेक्ट को सबसे अलग बनाने और सोशल चैलेंज के लिए अपनी रेटिंग को बेहतर बनाने के लिए, आपको कस्टम सुविधाओं के साथ ऐप्लिकेशन को बेहतर बनाना चाहिए. यहां कुछ आइडिया दिए गए हैं:

  • जगह की जानकारी के हिसाब से एंट्री (Google Maps इंटिग्रेशन): उपयोगकर्ताओं को अपनी जर्नल एंट्री में जगह की जानकारी पिन करने की अनुमति दें. इसे सुरक्षित तरीके से लागू करने के लिए, अपने कस्टम निर्देशों में Google Maps से जुड़ा एक निर्देश जोड़ें. इससे मॉडल को Google Maps API के साथ सुरक्षित तरीके से इंटरैक्ट करने और एपीआई पासकोड हासिल करने में मदद मिलेगी.
  • एडमिन डैशबोर्ड: रोल के हिसाब से ऐक्सेस देने (आरबीएसी) की सुविधा लागू करें. एडमिन की भूमिकाओं के लिए निर्देश जोड़ें. इससे एआई को यह तय करने में मदद मिलेगी कि एडमिन के तौर पर मिली अनुमतियों के लिए, सुरक्षा जांच कैसे जनरेट करनी है.
  • बाहरी सूचनाएं (Slack/Discord/ईमेल): इंटिग्रेशन सेट अप करें, ताकि खास तरह की जर्नल एंट्री पार्स होने पर, उपयोगकर्ता को बाहरी सिस्टम पर सूचना दी जा सके. पुष्टि करने के क्रेडेंशियल और पेलोड स्कीमा को मैनेज करने के लिए, सूचना एपीआई डायरेक्टिव तय करें.

जब भी आपको अपने ऐप्लिकेशन में कोई नई सेवा जोड़नी हो, तो सबसे पहले Google AI Studio में जाकर, निर्देशों को पसंद के मुताबिक बनाने की सुविधा का इस्तेमाल करें. इससे मॉडल को नई सेवा के लिए, प्रोडक्शन-ग्रेड कोड स्ट्रक्चर, सुरक्षा, और गड़बड़ी को ठीक करने की सुविधा बनाए रखने में मदद मिलती है.

Antigravity पर पोर्ट करना (ज़रूरी नहीं)

अपने प्रोजेक्ट को और बेहतर बनाने, उसकी जांच करने, और उसे सुरक्षित बनाने के लिए, उसे Antigravity के डेवलपमेंट एनवायरमेंट में ले जाया जा सकता है:

  • अपनी पसंद के मुताबिक बनाई गई ऐप्लिकेशन स्किल को, Antigravity में स्थानीय भाषा के नियमों/स्किल (SKILL.md) के तौर पर इंपोर्ट करें.
  • टेस्ट-ड्रिवन डेवलपमेंट (टीडीडी) स्किल का फ़ायदा लें.
  • Cloud Run पर फिर से डिप्लॉय करने से पहले, सुरक्षा से जुड़ी जांच अपने-आप चलाने के लिए, Git हुक सेट अप करें.

7. खास जानकारी और सबमिशन से जुड़े दिशा-निर्देश

डिलीवर किए जाने वाले कॉन्टेंट की खास जानकारी

अपने प्रोजेक्ट की पुष्टि करने के लिए, पक्का करें कि आपके पास ये ऐसेट तैयार हों:

  1. Cloud Run का लाइव यूआरएल या ऐप्लिकेशन के बारे में सिलसिलेवार जानकारी: डिप्लॉय किए गए आपके ऐप्लिकेशन का ऐक्टिव पब्लिक एंडपॉइंट या कोई वीडियो, स्क्रीनशॉट वाली ब्लॉग पोस्ट या कोई अन्य मीडिया, जिससे यह पता चले कि उपयोगकर्ता आपके ऐप्लिकेशन में कैसे लॉग इन करते हैं और उसे कैसे इस्तेमाल करते हैं. (सबमिट करने के लिए, ऐप्लिकेशन को चालू रखने की ज़रूरत नहीं है. बस इसे एक बार डिप्लॉय करके देखें कि यह प्रोडक्शन में काम करता है या नहीं.)
  2. ऐप्लिकेशन का सोर्स कोड: सार्वजनिक या शेयर की गई GitHub/GitLab रिपॉज़िटरी का लिंक, जिसमें आपके फ़्रंटएंड/बैकएंड कोड, डिप्लॉयमेंट के चरणों के साथ README, कॉन्फ़िगरेशन, और Firestore के सुरक्षा नियम शामिल हों.

🏆 सोशल चैलेंज में हिस्सा लेना

याद रखें कि "Personal Gemini Journal" बेसलाइन सिर्फ़ एक शुरुआत है! हम चाहते हैं कि आप इस शुरुआती पॉइंट से आगे बढ़ें. सबमिट किए गए ऐप्लिकेशन का आकलन, भरोसेमंद होने, उपयोगिता, स्थिरता, और सुरक्षा के आधार पर किया जाता है. चैलेंज में टॉप पर आने के लिए, Google AI Studio में तय किए गए कस्टम सुरक्षा निर्देशों और अतिरिक्त सुविधाओं का इस्तेमाल करें. इससे आपको बुनियादी टेंप्लेट से बेहतर, यूनीक, और मज़बूत सुविधाएं डिज़ाइन करने और उन्हें लागू करने में मदद मिलेगी.

अगर आपने कस्टम सुविधाएं या तीसरे पक्ष के अतिरिक्त इंटिग्रेशन लागू किए हैं, तो अपनी रिपॉज़िटरी के README.md और सार्वजनिक शोकेस या डिप्लॉय किए गए ऐप्लिकेशन में, चरणों और बदलावों के बारे में जानकारी दें.

सबमिट करने के निर्देश

सबमिशन की प्रोसेस पूरी करने और सोशल शोकेस में हिस्सा लेने के लिए:

  1. फ़ॉर्म सबमिट करें: सबमिशन फ़ॉर्म में अपना ईमेल पता, Cloud Run प्रोजेक्ट/सेवा का नाम, सोशल मीडिया/ब्लॉग के लिंक, और रिपॉज़िटरी का लिंक डालें.
  2. सोशल मीडिया / ब्लॉग पर पोस्ट करें: अपने प्रोजेक्ट को LinkedIn, X या किसी अन्य प्लैटफ़ॉर्म पर शेयर करें. इसके लिए, #AccelerateAIwithCloudRun हैशटैग का इस्तेमाल करें. इसके अलावा, प्रोजेक्ट को लागू करने के चरणों को दिखाते हुए एक लेख पब्लिश करें. आपने जो यूनीक सुविधाएं बनाई हैं उन्हें हाइलाइट करें. साथ ही, यह भी बताएं कि आपने उन्हें लागू करने के लिए, Google AI Studio का इस्तेमाल कैसे किया.
  3. मूल्यांकन की शर्तें: आपके सबमिशन का मूल्यांकन इन शर्तों के आधार पर किया जाएगा:
    • भरोसेमंद जानकारी होना: कोड और डिज़ाइन का ओरिजनल होना. क्या आपने स्टार्टर लैब के अलावा, यूनीक सुविधाएं बनाई हैं?
    • इस्तेमाल करने में आसानी: सिंगल साइन-ऑन की मदद से पुष्टि करने की सुविधा और बिना किसी गड़बड़ी के उपयोगकर्ता के साथ इंटरैक्शन.
    • स्थिरता: गड़बड़ियों को ठीक करने और डिप्लॉयमेंट के अपटाइम को बेहतर बनाने की सुविधा.
    • सुरक्षा: डेटाबेस पाथ, एपीआई पासकोड, और ऐक्सेस कंट्रोल को बेहतर बनाया गया है.