mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
fix: lint and type errors
This commit is contained in:
@@ -56,12 +56,12 @@ import { RadioButtonSelect } from './components/shared/RadioButtonSelect.js';
|
|||||||
import { ModelSelectionDialog } from './components/ModelSelectionDialog.js';
|
import { ModelSelectionDialog } from './components/ModelSelectionDialog.js';
|
||||||
import {
|
import {
|
||||||
ModelSwitchDialog,
|
ModelSwitchDialog,
|
||||||
VisionSwitchOutcome,
|
type VisionSwitchOutcome,
|
||||||
} from './components/ModelSwitchDialog.js';
|
} from './components/ModelSwitchDialog.js';
|
||||||
import {
|
import {
|
||||||
AVAILABLE_MODELS_QWEN,
|
AVAILABLE_MODELS_QWEN,
|
||||||
getOpenAIAvailableModelFromEnv,
|
getOpenAIAvailableModelFromEnv,
|
||||||
AvailableModel,
|
type AvailableModel,
|
||||||
} from './models/availableModels.js';
|
} from './models/availableModels.js';
|
||||||
import { processVisionSwitchOutcome } from './hooks/useVisionAutoSwitch.js';
|
import { processVisionSwitchOutcome } from './hooks/useVisionAutoSwitch.js';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -5,17 +5,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { AuthType } from '@qwen-code/qwen-code-core';
|
import { AuthType } from '@qwen-code/qwen-code-core';
|
||||||
import {
|
import type {
|
||||||
SlashCommand,
|
SlashCommand,
|
||||||
CommandContext,
|
CommandContext,
|
||||||
CommandKind,
|
|
||||||
OpenDialogActionReturn,
|
OpenDialogActionReturn,
|
||||||
MessageActionReturn,
|
MessageActionReturn,
|
||||||
} from './types.js';
|
} from './types.js';
|
||||||
|
import { CommandKind } from './types.js';
|
||||||
import {
|
import {
|
||||||
AVAILABLE_MODELS_QWEN,
|
AVAILABLE_MODELS_QWEN,
|
||||||
getOpenAIAvailableModelFromEnv,
|
getOpenAIAvailableModelFromEnv,
|
||||||
AvailableModel,
|
type AvailableModel,
|
||||||
} from '../models/availableModels.js';
|
} from '../models/availableModels.js';
|
||||||
|
|
||||||
function getAvailableModelsForAuthType(authType: AuthType): AvailableModel[] {
|
function getAvailableModelsForAuthType(authType: AuthType): AvailableModel[] {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import React from 'react';
|
|||||||
import { render } from 'ink-testing-library';
|
import { render } from 'ink-testing-library';
|
||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
import { ModelSelectionDialog } from './ModelSelectionDialog.js';
|
import { ModelSelectionDialog } from './ModelSelectionDialog.js';
|
||||||
import { AvailableModel } from '../models/availableModels.js';
|
import type { AvailableModel } from '../models/availableModels.js';
|
||||||
import { RadioSelectItem } from './shared/RadioButtonSelect.js';
|
import type { RadioSelectItem } from './shared/RadioButtonSelect.js';
|
||||||
|
|
||||||
// Mock the useKeypress hook
|
// Mock the useKeypress hook
|
||||||
const mockUseKeypress = vi.hoisted(() => vi.fn());
|
const mockUseKeypress = vi.hoisted(() => vi.fn());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import type React from 'react';
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text } from 'ink';
|
||||||
import { Colors } from '../colors.js';
|
import { Colors } from '../colors.js';
|
||||||
import {
|
import {
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
type RadioSelectItem,
|
type RadioSelectItem,
|
||||||
} from './shared/RadioButtonSelect.js';
|
} from './shared/RadioButtonSelect.js';
|
||||||
import { useKeypress } from '../hooks/useKeypress.js';
|
import { useKeypress } from '../hooks/useKeypress.js';
|
||||||
import { AvailableModel } from '../models/availableModels.js';
|
import type { AvailableModel } from '../models/availableModels.js';
|
||||||
|
|
||||||
export interface ModelSelectionDialogProps {
|
export interface ModelSelectionDialogProps {
|
||||||
availableModels: AvailableModel[];
|
availableModels: AvailableModel[];
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import type React from 'react';
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text } from 'ink';
|
||||||
import { Colors } from '../colors.js';
|
import { Colors } from '../colors.js';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
import { renderHook, act } from '@testing-library/react';
|
import { renderHook, act } from '@testing-library/react';
|
||||||
import { Part, PartListUnion } from '@google/genai';
|
import type { Part, PartListUnion } from '@google/genai';
|
||||||
import { AuthType, Config } from '@qwen-code/qwen-code-core';
|
import { AuthType, type Config } from '@qwen-code/qwen-code-core';
|
||||||
import {
|
import {
|
||||||
shouldOfferVisionSwitch,
|
shouldOfferVisionSwitch,
|
||||||
processVisionSwitchOutcome,
|
processVisionSwitchOutcome,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { type PartListUnion, type Part } from '@google/genai';
|
import { type PartListUnion, type Part } from '@google/genai';
|
||||||
import { AuthType, Config } from '@qwen-code/qwen-code-core';
|
import { AuthType, type Config } from '@qwen-code/qwen-code-core';
|
||||||
import { useCallback, useRef } from 'react';
|
import { useCallback, useRef } from 'react';
|
||||||
import { VisionSwitchOutcome } from '../components/ModelSwitchDialog.js';
|
import { VisionSwitchOutcome } from '../components/ModelSwitchDialog.js';
|
||||||
import {
|
import {
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
isVisionModel,
|
isVisionModel,
|
||||||
} from '../models/availableModels.js';
|
} from '../models/availableModels.js';
|
||||||
import { MessageType } from '../types.js';
|
import { MessageType } from '../types.js';
|
||||||
import { UseHistoryManagerReturn } from './useHistoryManager.js';
|
import type { UseHistoryManagerReturn } from './useHistoryManager.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a PartListUnion contains image parts
|
* Checks if a PartListUnion contains image parts
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import {
|
|||||||
type GenerateContentParameters,
|
type GenerateContentParameters,
|
||||||
GenerateContentResponse,
|
GenerateContentResponse,
|
||||||
} from '@google/genai';
|
} from '@google/genai';
|
||||||
import { Config } from '../../config/config.js';
|
import type { Config } from '../../config/config.js';
|
||||||
import type { ContentGeneratorConfig } from '../contentGenerator.js';
|
import type { ContentGeneratorConfig } from '../contentGenerator.js';
|
||||||
import type { OpenAICompatibleProvider } from './provider/index.js';
|
import type { OpenAICompatibleProvider } from './provider/index.js';
|
||||||
import { OpenAIContentConverter } from './converter.js';
|
import type { OpenAIContentConverter } from './converter.js';
|
||||||
import type { TelemetryService, RequestContext } from './telemetryService.js';
|
import type { TelemetryService, RequestContext } from './telemetryService.js';
|
||||||
import type { ErrorHandler } from './errorHandler.js';
|
import type { ErrorHandler } from './errorHandler.js';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ImageMetadata } from './types.js';
|
import type { ImageMetadata } from './types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image tokenizer for calculating image tokens based on dimensions
|
* Image tokenizer for calculating image tokens based on dimensions
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||||
import { DefaultRequestTokenizer } from './requestTokenizer.js';
|
import { DefaultRequestTokenizer } from './requestTokenizer.js';
|
||||||
import { CountTokensParameters } from '@google/genai';
|
import type { CountTokensParameters } from '@google/genai';
|
||||||
|
|
||||||
describe('DefaultRequestTokenizer', () => {
|
describe('DefaultRequestTokenizer', () => {
|
||||||
let tokenizer: DefaultRequestTokenizer;
|
let tokenizer: DefaultRequestTokenizer;
|
||||||
|
|||||||
@@ -4,8 +4,13 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CountTokensParameters, Content, Part, PartUnion } from '@google/genai';
|
import type {
|
||||||
import {
|
CountTokensParameters,
|
||||||
|
Content,
|
||||||
|
Part,
|
||||||
|
PartUnion,
|
||||||
|
} from '@google/genai';
|
||||||
|
import type {
|
||||||
RequestTokenizer,
|
RequestTokenizer,
|
||||||
TokenizerConfig,
|
TokenizerConfig,
|
||||||
TokenCalculationResult,
|
TokenCalculationResult,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CountTokensParameters } from '@google/genai';
|
import type { CountTokensParameters } from '@google/genai';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token calculation result for different content types
|
* Token calculation result for different content types
|
||||||
|
|||||||
Reference in New Issue
Block a user