fix: add patch for sync upstream

This commit is contained in:
mingholy.lmh
2025-08-20 22:24:53 +08:00
parent c546d86d44
commit 1e2bbd1be3
23 changed files with 508 additions and 303 deletions

View File

@@ -65,7 +65,7 @@ export class QwenContentGenerator extends OpenAIContentGenerator {
/**
* Override error logging behavior to suppress auth errors during token refresh
*/
protected shouldSuppressErrorLogging(
protected override shouldSuppressErrorLogging(
error: unknown,
_request: GenerateContentParameters,
): boolean {
@@ -76,7 +76,7 @@ export class QwenContentGenerator extends OpenAIContentGenerator {
/**
* Override to use dynamic token and endpoint
*/
async generateContent(
override async generateContent(
request: GenerateContentParameters,
userPromptId: string,
): Promise<GenerateContentResponse> {
@@ -100,7 +100,7 @@ export class QwenContentGenerator extends OpenAIContentGenerator {
/**
* Override to use dynamic token and endpoint
*/
async generateContentStream(
override async generateContentStream(
request: GenerateContentParameters,
userPromptId: string,
): Promise<AsyncGenerator<GenerateContentResponse>> {
@@ -127,7 +127,7 @@ export class QwenContentGenerator extends OpenAIContentGenerator {
/**
* Override to use dynamic token and endpoint
*/
async countTokens(
override async countTokens(
request: CountTokensParameters,
): Promise<CountTokensResponse> {
return this.withValidToken(async (token) => {
@@ -148,7 +148,7 @@ export class QwenContentGenerator extends OpenAIContentGenerator {
/**
* Override to use dynamic token and endpoint
*/
async embedContent(
override async embedContent(
request: EmbedContentParameters,
): Promise<EmbedContentResponse> {
return this.withValidToken(async (token) => {

View File

@@ -223,17 +223,9 @@ describe('Type Guards', () => {
describe('QwenOAuth2Client', () => {
let client: QwenOAuth2Client;
let _mockConfig: Config;
let originalFetch: typeof global.fetch;
beforeEach(() => {
// Setup mock config
_mockConfig = {
getQwenClientId: vi.fn().mockReturnValue('test-client-id'),
isBrowserLaunchSuppressed: vi.fn().mockReturnValue(false),
getProxy: vi.fn().mockReturnValue(undefined),
} as unknown as Config;
// Create client instance
client = new QwenOAuth2Client({ proxy: undefined });
@@ -1010,7 +1002,6 @@ describe('getQwenOAuthClient - Enhanced Error Scenarios', () => {
describe('authWithQwenDeviceFlow - Comprehensive Testing', () => {
let mockConfig: Config;
let originalFetch: typeof global.fetch;
let _client: QwenOAuth2Client;
beforeEach(() => {
mockConfig = {
@@ -1018,7 +1009,7 @@ describe('authWithQwenDeviceFlow - Comprehensive Testing', () => {
isBrowserLaunchSuppressed: vi.fn().mockReturnValue(false),
} as unknown as Config;
_client = new QwenOAuth2Client({ proxy: undefined });
new QwenOAuth2Client({ proxy: undefined });
originalFetch = global.fetch;
global.fetch = vi.fn();

View File

@@ -234,11 +234,8 @@ export interface IQwenOAuth2Client {
*/
export class QwenOAuth2Client implements IQwenOAuth2Client {
private credentials: QwenCredentials = {};
private proxy?: string;
constructor(options: { proxy?: string }) {
this.proxy = options.proxy;
}
constructor(_options?: { proxy?: string }) {}
setCredentials(credentials: QwenCredentials): void {
this.credentials = credentials;