Merge pull request #3069 from obeone/fix-documentation
refactor(docs): update getDiff usage and add signal parameter in cust…
This commit is contained in:
commit
9ebbc27537
5 changed files with 20 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
```
|
||||
|
||||
<!-- TODO: We need a config.ts reference -->
|
||||
<!-- For full `config.ts` reference, see [here](reference/config-ts.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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue