fix ESLint

7fcd40c829b7499ca91b8d3fd83d5b83ff838fd1

InterestingDarkness <computeridiot999@gmail.com>

2 files changed, +15 -15Ignore whitespace
src/endpoints/backends/chat-completions.js+8 -8
@@ -72,7 +72,7 @@ async function generateJWTToken(serviceAccount) {
7272
7373 const header = {
7474 alg: 'RS256',
7575 typ: 'JWT',
7676 };
7777
7878 const payload = {
@@ -80,7 +80,7 @@ async function generateJWTToken(serviceAccount) {
8080 scope: 'https://www.googleapis.com/auth/cloud-platform',
8181 aud: 'https://oauth2.googleapis.com/token',
8282 iat: now,
8383 exp: expiry,
8484 };
8585
8686 const headerBase64 = Buffer.from(JSON.stringify(header)).toString('base64url');
@@ -104,12 +104,12 @@ async function getAccessToken(jwtToken) {
104104 const response = await fetch('https://oauth2.googleapis.com/token', {
105105 method: 'POST',
106106 headers: {
107107 'Content-Type': 'application/x-www-form-urlencoded',
108108 },
109109 body: new URLSearchParams({
110110 grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
111111 assertion: jwtToken,
112112 }),
113113 });
114114
115115 if (!response.ok) {
@@ -133,7 +133,7 @@ async function getVertexAIAuth(request) {
133133 if (request.body.reverse_proxy) {
134134 return {
135135 authHeader: `Bearer ${request.body.proxy_password}`,
136136 authType: 'proxy',
137137 };
138138 }
139139
@@ -143,7 +143,7 @@ async function getVertexAIAuth(request) {
143143 if (apiKey) {
144144 return {
145145 authHeader: `Bearer ${apiKey}`,
146146 authType: 'express',
147147 };
148148 }
149149 throw new Error('API key is required for Vertex AI Express mode');
@@ -166,7 +166,7 @@ async function getVertexAIAuth(request) {
166166
167167 return {
168168 authHeader: `Bearer ${accessToken}`,
169169 authType: 'full',
170170 };
171171 } catch (error) {
172172 console.error('Failed to authenticate with service account:', error);
src/endpoints/google.js+7 -7
@@ -17,7 +17,7 @@ async function getVertexAIAuth(request) {
1717 if (request.body.reverse_proxy) {
1818 return {
1919 authHeader: `Bearer ${request.body.proxy_password}`,
2020 authType: 'proxy',
2121 };
2222 }
2323
@@ -26,7 +26,7 @@ async function getVertexAIAuth(request) {
2626 if (apiKey) {
2727 return {
2828 authHeader: `Bearer ${apiKey}`,
2929 authType: 'express',
3030 };
3131 }
3232 throw new Error('API key is required for Vertex AI Express mode');
@@ -46,7 +46,7 @@ async function getVertexAIAuth(request) {
4646 const accessToken = await getAccessToken(jwtToken);
4747 return {
4848 authHeader: `Bearer ${accessToken}`,
4949 authType: 'full',
5050 };
5151 } catch (error) {
5252 console.error('Failed to authenticate with service account:', error);
@@ -70,7 +70,7 @@ async function generateJWTToken(serviceAccount) {
7070
7171 const header = {
7272 alg: 'RS256',
7373 typ: 'JWT',
7474 };
7575
7676 const payload = {
@@ -78,7 +78,7 @@ async function generateJWTToken(serviceAccount) {
7878 scope: 'https://www.googleapis.com/auth/cloud-platform',
7979 aud: 'https://oauth2.googleapis.com/token',
8080 iat: now,
8181 exp: expiry,
8282 };
8383
8484 const headerBase64 = Buffer.from(JSON.stringify(header)).toString('base64url');
@@ -99,8 +99,8 @@ async function getAccessToken(jwtToken) {
9999 headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
100100 body: new URLSearchParams({
101101 grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
102102 assertion: jwtToken,
103103 }),
104104 });
105105
106106 if (!response.ok) {