-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
…tions
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Spell Check | ||
description: Spell check a document | ||
sidebar: | ||
order: 101 | ||
--- | ||
|
||
import { Code } from "@astrojs/starlight/components" | ||
import source from "../../../../../packages/sample/genaisrc/sc.genai.mts?raw" | ||
|
||
## Full source ([GitHub](https://github.com/microsoft/genaiscript/blob/main/packages/sample/genaisrc/sc.genai.mts)) | ||
|
||
<Code code={source} wrap={true} lang="ts" title="sc.genai.mts" /> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,34 @@ | ||
script({ | ||
title: "Spell checker", | ||
system: ["system", "system.files"], | ||
system: ["system", "system.files", "system.diff"], | ||
temperature: 0.1, | ||
}) | ||
|
||
const files = def("FILES", env.files, { endsWith: [".md", ".mdx"] }) | ||
// Get files from environment or modified files from Git if none provided | ||
let files = env.files | ||
if (files.length === 0) { | ||
// If no files are provided, read all modified files | ||
const gitStatus = await host.exec("git status --porcelain") | ||
const rx = /^\s+[M|U]\s+/ // modified or untracked | ||
files = await Promise.all( | ||
gitStatus.stdout | ||
.split(/\r?\n/g) | ||
.filter((filename) => rx.test(filename)) | ||
.filter((filename) => /\.(md|mdx)$/.test(filename)) | ||
.map( | ||
async (filename) => | ||
await workspace.readText(filename.replace(rx, "")) | ||
) | ||
) | ||
} | ||
def("FILES", files, { endsWith: [".md", ".mdx"] }) | ||
|
||
$`Fix the spelling and gramme of the content of ${files}. | ||
$`Fix the spelling and gramme of the content of FILES. Use diff format for small changes. | ||
- do NOT fix the frontmatter | ||
- do NOT fix code regions | ||
- do NOT fix \`code\` and \`\`\`code\`\`\` | ||
- in .mdx files, do NOT fix inline typescript code | ||
` | ||
|
||
defFileOutput(files, "fixed markdown or mdx files") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.