Merge pull request #3069 from obeone/fix-documentation

refactor(docs): update getDiff usage and add signal parameter in cust…
This commit is contained in:
Nate Sesti 2024-12-09 12:29:30 -08:00 • committed by GitHub
commit 9ebbc27537
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 6 deletions

View file

@ -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). -->

View file

@ -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,
},

View file

@ -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,
},

View file

@ -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,
},

View file

@ -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,
},