Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions[bot]
323279eff6 chore(release): v0.0.11-nightly.1 2025-09-04 00:12:47 +00:00
tanzhenxin
b54fd6df06 chore: pump version to 0.0.10 (#502) 2025-09-02 17:55:22 +08:00
Fan
f024bba2ef chore: add configurable cache control (#498)
* chore: add configurable cache control

* fix: ci/cd
2025-09-01 22:02:46 +08:00
14 changed files with 77 additions and 15 deletions

1
.gitignore vendored
View File

@@ -15,6 +15,7 @@ bower_components
# Editors
.idea
*.iml
.cursor
# OS metadata
.DS_Store

View File

@@ -1,5 +1,10 @@
# Changelog
## 0.0.10
- Synced upstream `gemini-cli` to v0.2.1.
- Add todo write tool for task management and progress tracking.
## 0.0.9
- Synced upstream `gemini-cli` to v0.1.21.

View File

@@ -41,7 +41,7 @@ For security and isolation, Qwen Code can be run inside a container. This is the
You can run the published sandbox image directly. This is useful for environments where you only have Docker and want to run the CLI.
```bash
# Run the published sandbox image
docker run --rm -it ghcr.io/qwenlm/qwen-code:0.0.9
docker run --rm -it ghcr.io/qwenlm/qwen-code:0.0.10
```
- **Using the `--sandbox` flag:**
If you have Qwen Code installed locally (using the standard installation described above), you can instruct it to run inside the sandbox container.

12
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@qwen-code/qwen-code",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"workspaces": [
"packages/*"
],
@@ -12512,7 +12512,7 @@
},
"packages/cli": {
"name": "@qwen-code/qwen-code",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"dependencies": {
"@google/genai": "1.9.0",
"@iarna/toml": "^2.2.5",
@@ -12696,7 +12696,7 @@
},
"packages/core": {
"name": "@qwen-code/qwen-code-core",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"dependencies": {
"@google/genai": "1.13.0",
"@modelcontextprotocol/sdk": "^1.11.0",
@@ -12861,7 +12861,7 @@
},
"packages/test-utils": {
"name": "@qwen-code/qwen-code-test-utils",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "^5.3.3"
@@ -12872,7 +12872,7 @@
},
"packages/vscode-ide-companion": {
"name": "qwen-code-vscode-ide-companion",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"license": "LICENSE",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.15.1",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"engines": {
"node": ">=20.0.0"
},
@@ -13,7 +13,7 @@
"url": "git+https://github.com/QwenLM/qwen-code.git"
},
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.9"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.11-nightly.1"
},
"scripts": {
"start": "node scripts/start.js",

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"description": "Qwen Code",
"repository": {
"type": "git",
@@ -25,7 +25,7 @@
"dist"
],
"config": {
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.9"
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.11-nightly.1"
},
"dependencies": {
"@google/genai": "1.9.0",

View File

@@ -523,6 +523,41 @@ export const SETTINGS_SCHEMA = {
default: undefined as Record<string, unknown> | undefined,
description: 'Content generator settings.',
showInDialog: false,
properties: {
timeout: {
type: 'number',
label: 'Timeout',
category: 'Content Generator',
requiresRestart: false,
default: undefined as number | undefined,
description: 'Request timeout in milliseconds.',
parentKey: 'contentGenerator',
childKey: 'timeout',
showInDialog: true,
},
maxRetries: {
type: 'number',
label: 'Max Retries',
category: 'Content Generator',
requiresRestart: false,
default: undefined as number | undefined,
description: 'Maximum number of retries for failed requests.',
parentKey: 'contentGenerator',
childKey: 'maxRetries',
showInDialog: true,
},
disableCacheControl: {
type: 'boolean',
label: 'Disable Cache Control',
category: 'Content Generator',
requiresRestart: false,
default: false,
description: 'Disable cache control for DashScope providers.',
parentKey: 'contentGenerator',
childKey: 'disableCacheControl',
showInDialog: true,
},
},
},
enableOpenAILogging: {
type: 'boolean',

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-core",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"description": "Qwen Code Core",
"repository": {
"type": "git",

View File

@@ -217,6 +217,7 @@ export interface ConfigParameters {
contentGenerator?: {
timeout?: number;
maxRetries?: number;
disableCacheControl?: boolean;
samplingParams?: {
[key: string]: unknown;
};
@@ -302,6 +303,7 @@ export class Config {
private readonly contentGenerator?: {
timeout?: number;
maxRetries?: number;
disableCacheControl?: boolean;
samplingParams?: Record<string, unknown>;
};
private readonly cliVersion?: string;
@@ -801,6 +803,10 @@ export class Config {
return this.contentGenerator?.maxRetries;
}
getContentGeneratorDisableCacheControl(): boolean | undefined {
return this.contentGenerator?.disableCacheControl;
}
getContentGeneratorSamplingParams(): ContentGeneratorConfig['samplingParams'] {
return this.contentGenerator?.samplingParams as
| ContentGeneratorConfig['samplingParams']

View File

@@ -121,6 +121,7 @@ describe('createContentGeneratorConfig', () => {
getSamplingParams: vi.fn().mockReturnValue(undefined),
getContentGeneratorTimeout: vi.fn().mockReturnValue(undefined),
getContentGeneratorMaxRetries: vi.fn().mockReturnValue(undefined),
getContentGeneratorDisableCacheControl: vi.fn().mockReturnValue(undefined),
getContentGeneratorSamplingParams: vi.fn().mockReturnValue(undefined),
getCliVersion: vi.fn().mockReturnValue('1.0.0'),
} as unknown as Config;

View File

@@ -62,6 +62,8 @@ export type ContentGeneratorConfig = {
timeout?: number;
// Maximum retries for failed requests
maxRetries?: number;
// Disable cache control for DashScope providers
disableCacheControl?: boolean;
samplingParams?: {
top_p?: number;
top_k?: number;
@@ -99,6 +101,7 @@ export function createContentGeneratorConfig(
enableOpenAILogging: config.getEnableOpenAILogging(),
timeout: config.getContentGeneratorTimeout(),
maxRetries: config.getContentGeneratorMaxRetries(),
disableCacheControl: config.getContentGeneratorDisableCacheControl(),
samplingParams: config.getContentGeneratorSamplingParams(),
};

View File

@@ -212,6 +212,17 @@ export class OpenAIContentGenerator implements ContentGenerator {
);
}
/**
* Check if cache control should be disabled based on configuration.
*
* @returns true if cache control should be disabled, false otherwise
*/
private shouldDisableCacheControl(): boolean {
return (
this.config.getContentGeneratorConfig()?.disableCacheControl === true
);
}
/**
* Build metadata object for OpenAI API requests.
*
@@ -242,7 +253,7 @@ export class OpenAIContentGenerator implements ContentGenerator {
// Add cache control to system and last messages for DashScope providers
// Only add cache control to system message for non-streaming requests
if (this.isDashScopeProvider()) {
if (this.isDashScopeProvider() && !this.shouldDisableCacheControl()) {
messages = this.addDashScopeCacheControl(
messages,
streaming ? 'both' : 'system',

View File

@@ -1,6 +1,6 @@
{
"name": "@qwen-code/qwen-code-test-utils",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"private": true,
"main": "src/index.ts",
"license": "Apache-2.0",

View File

@@ -2,7 +2,7 @@
"name": "qwen-code-vscode-ide-companion",
"displayName": "Qwen Code Companion",
"description": "Enable Qwen Code with direct access to your VS Code workspace.",
"version": "0.0.9",
"version": "0.0.11-nightly.1",
"publisher": "qwenlm",
"icon": "assets/icon.png",
"repository": {