Skip to content

Commit

Permalink
wip: Use utility function to clean up a key
Browse files Browse the repository at this point in the history
  • Loading branch information
burivuhster committed Sep 11, 2024
1 parent a962c18 commit f3becd0
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { ChatVertexAI } from '@langchain/google-vertexai';
import type { SafetySetting } from '@google/generative-ai';
import { ProjectsClient } from '@google-cloud/resource-manager';
import { formatPrivateKey } from 'n8n-nodes-base/dist/utils/utilities';
import { getConnectionHintNoticeField } from '../../../utils/sharedFields';
import { N8nLlmTracing } from '../N8nLlmTracing';
import { additionalOptions } from '../gemini-common/additional-options';
Expand Down Expand Up @@ -97,7 +98,7 @@ export class LmChatGoogleVertex implements INodeType {
const results: Array<{ name: string; value: string }> = [];

const credentials = await this.getCredentials('googleApi');
const privateKey = (credentials.privateKey as string).replace(/\\n/g, '\n').trim();
const privateKey = formatPrivateKey(credentials.privateKey as string);
const email = (credentials.email as string).trim();

const client = new ProjectsClient({
Expand Down Expand Up @@ -125,7 +126,7 @@ export class LmChatGoogleVertex implements INodeType {

async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
const credentials = await this.getCredentials('googleApi');
const privateKey = (credentials.privateKey as string).replace(/\\n/g, '\n').trim();
const privateKey = formatPrivateKey(credentials.privateKey as string);
const email = (credentials.email as string).trim();

const modelName = this.getNodeParameter('modelName', itemIndex) as string;
Expand Down

0 comments on commit f3becd0

Please sign in to comment.