diff --git a/docs/docs/actions/how-to-customize.md b/docs/docs/actions/how-to-customize.md index 01cf2d064..81d33967b 100644 --- a/docs/docs/actions/how-to-customize.md +++ b/docs/docs/actions/how-to-customize.md @@ -33,9 +33,12 @@ export function modifyConfig(config: Config): Config { name: "commit", description: "Write a commit message", run: async function* (sdk) { - const diff = await sdk.ide.getDiff(); + // The getDiff function takes a boolean parameter that indicates whether + // to include unstaged changes in the diff or not. + const diff = await sdk.ide.getDiff(false); // Pass false to exclude unstaged changes for await (const message of sdk.llm.streamComplete( `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, + new AbortController().signal, { maxTokens: 20, }, @@ -47,7 +50,6 @@ export function modifyConfig(config: Config): Config { return config; } ``` - diff --git a/docs/docs/customize/deep-dives/configuration.md b/docs/docs/customize/deep-dives/configuration.md index 62f79952e..e2e2b91d1 100644 --- a/docs/docs/customize/deep-dives/configuration.md +++ b/docs/docs/customize/deep-dives/configuration.md @@ -50,9 +50,12 @@ export function modifyConfig(config: Config): Config { name: "commit", description: "Write a commit message", run: async function* (sdk) { - const diff = await sdk.ide.getDiff(); + // The getDiff function takes a boolean parameter that indicates whether + // to include unstaged changes in the diff or not. + const diff = await sdk.ide.getDiff(false); // Pass false to exclude unstaged changes for await (const message of sdk.llm.streamComplete( `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, + new AbortController().signal, { maxTokens: 20, }, diff --git a/docs/docs/customize/tutorials/build-your-own-slash-command.md b/docs/docs/customize/tutorials/build-your-own-slash-command.md index b3fc25c3a..dc450cdd4 100644 --- a/docs/docs/customize/tutorials/build-your-own-slash-command.md +++ b/docs/docs/customize/tutorials/build-your-own-slash-command.md @@ -44,9 +44,12 @@ export function modifyConfig(config: Config): Config { name: "commit", description: "Write a commit message", run: async function* (sdk) { - const diff = await sdk.ide.getDiff(true); + // The getDiff function takes a boolean parameter that indicates whether + // to include unstaged changes in the diff or not. + const diff = await sdk.ide.getDiff(false); // Pass false to exclude unstaged changes for await (const message of sdk.llm.streamComplete( `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, + new AbortController().signal, { maxTokens: 20, }, diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/actions/how-to-customize.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/actions/how-to-customize.md index 095d75918..2ffc4d0f2 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/actions/how-to-customize.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/actions/how-to-customize.md @@ -33,9 +33,12 @@ export function modifyConfig(config: Config): Config { name: "commit", description: "Write a commit message", run: async function* (sdk) { - const diff = await sdk.ide.getDiff(); + // getDiff 函数接受一个布尔参数,该参数指示是否 + // 在 diff 中包含未暂存的更改。 + const diff = await sdk.ide.getDiff(false); // 传递 false 以排除未暂存的更改 for await (const message of sdk.llm.streamComplete( `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, + new AbortController().signal, { maxTokens: 20, }, diff --git a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-slash-command.md b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-slash-command.md index 755bb2b14..ccf367094 100644 --- a/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-slash-command.md +++ b/docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/customize/tutorials/build-your-own-slash-command.md @@ -44,9 +44,12 @@ export function modifyConfig(config: Config): Config { name: "commit", description: "Write a commit message", run: async function* (sdk) { - const diff = await sdk.ide.getDiff(); + // getDiff 函数接受一个布尔参数,该参数指示是否 + // 在 diff 中包含未暂存的更改。 + const diff = await sdk.ide.getDiff(false); // 传递 false 以排除未暂存的更改 for await (const message of sdk.llm.streamComplete( `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, + new AbortController().signal, { maxTokens: 20, },