Skip to content

Commit cf68051

Browse files
refactor: Move Configuration.gs to VertexAI.gs (#217)
Moves the constants from `Configuration.gs` to `VertexAI.gs` and deletes the `Configuration.gs` file. Updates the `README.md` to reflect the new file structure. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent 73f659b commit cf68051

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

apps-script/generative-ai/cat-add-on/Configuration.gs

Lines changed: 0 additions & 26 deletions
This file was deleted.

apps-script/generative-ai/cat-add-on/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Before you begin, ensure you have the following:
2727

2828
2. **Configure the Project ID:**
2929

30-
Open the `Configuration.gs` file and update the `PROJECT_ID` constant with your Google Cloud project ID:
30+
Open the `VertexAI.gs` file and update the `PROJECT_ID` constant with your Google Cloud project ID:
3131
```javascript
3232
const PROJECT_ID = 'YOUR_PROJECT_ID';
3333
```

apps-script/generative-ai/cat-add-on/VertexAI.gs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17+
// --- Configuration & Constants ---
18+
19+
/**
20+
* Your Google Cloud Project ID for Vertex AI access.
21+
* ⚠️ WARNING: Update this value before running.
22+
* NOTE: Ensure the Apps Script project has the 'https://www.googleapis.com/auth/cloud-platform' scope.
23+
*/
24+
const PROJECT_ID = 'your-project-id';
25+
const MODEL_ID = 'gemini-2.5-flash-image';
26+
const IMAGE_PROMPT = 'A high-quality, photorealistic image of a random cat.';
27+
1728
/**
1829
* Generates an image using the gemini-2.5-flash-image model on Vertex AI
1930
* and returns it as a Data URI.
@@ -22,7 +33,6 @@
2233
* @returns {string} A Data URI string (e.g., 'data:image/png;base64,...') or a fallback image URL on error.
2334
*/
2435
function generateImage(prompt) {
25-
// Uses global constants from Configuration.gs
2636
const ENDPOINT = `https://aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/global/publishers/google/models/${MODEL_ID}:generateContent`;
2737

2838
const payload = {

0 commit comments

Comments
 (0)