mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Fix oauth credential caching. (#2709)
This commit is contained in:
committed by
GitHub
parent
f3849627fc
commit
5c4c833ddd
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { AuthClient } from 'google-auth-library';
|
||||
import { OAuth2Client } from 'google-auth-library';
|
||||
import {
|
||||
CodeAssistGlobalUserSettingResponse,
|
||||
LoadCodeAssistRequest,
|
||||
@@ -46,7 +46,7 @@ export const CODE_ASSIST_API_VERSION = 'v1internal';
|
||||
|
||||
export class CodeAssistServer implements ContentGenerator {
|
||||
constructor(
|
||||
readonly auth: AuthClient,
|
||||
readonly client: OAuth2Client,
|
||||
readonly projectId?: string,
|
||||
readonly httpOptions: HttpOptions = {},
|
||||
) {}
|
||||
@@ -129,7 +129,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
req: object,
|
||||
signal?: AbortSignal,
|
||||
): Promise<T> {
|
||||
const res = await this.auth.request({
|
||||
const res = await this.client.request({
|
||||
url: `${CODE_ASSIST_ENDPOINT}/${CODE_ASSIST_API_VERSION}:${method}`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -144,7 +144,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
}
|
||||
|
||||
async getEndpoint<T>(method: string, signal?: AbortSignal): Promise<T> {
|
||||
const res = await this.auth.request({
|
||||
const res = await this.client.request({
|
||||
url: `${CODE_ASSIST_ENDPOINT}/${CODE_ASSIST_API_VERSION}:${method}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
@@ -162,7 +162,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
req: object,
|
||||
signal?: AbortSignal,
|
||||
): Promise<AsyncGenerator<T>> {
|
||||
const res = await this.auth.request({
|
||||
const res = await this.client.request({
|
||||
url: `${CODE_ASSIST_ENDPOINT}/${CODE_ASSIST_API_VERSION}:${method}`,
|
||||
method: 'POST',
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user