-
Notifications
You must be signed in to change notification settings - Fork 225
agentic functions support #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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,4 +1,3 @@ | ||
| import { createProgressSpinner } from "./spinner" | ||
| import replaceExt from "replace-ext" | ||
| import { readFile } from "node:fs/promises" | ||
| import { DOCXTryParse } from "../../core/src/docx" | ||
|
|
@@ -38,19 +37,16 @@ export async function parseHTMLToText(file: string) { | |
| } | ||
|
|
||
| export async function jsonl2json(files: string[]) { | ||
| const spinner = createProgressSpinner(`converting...`) | ||
| for (const file of await expandFiles(files)) { | ||
| spinner.report({ message: file }) | ||
| if (!isJSONLFilename(file)) { | ||
| spinner.report({ succeeded: false }) | ||
| console.log(`skipping ${file}`) | ||
| continue | ||
| } | ||
| const objs = await readJSONL(file) | ||
| const out = replaceExt(file, ".json") | ||
| await writeText(out, JSON.stringify(objs, null, 2)) | ||
| spinner.report({ succeeded: true }) | ||
| console.log(`${file} -> ${out}`) | ||
| } | ||
| spinner.stop() | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing progress report for jsonl2json function.
|
||
|
|
||
| export async function parseTokens( | ||
|
|
@@ -61,18 +57,15 @@ export async function parseTokens( | |
| const encoder = await resolveTokenEncoder(model) | ||
|
|
||
| const files = await expandFiles(filesGlobs, options?.excludedFiles) | ||
| const progress = createProgressSpinner(`parsing ${files.length} files`) | ||
| console.log(`parsing ${files.length} files`) | ||
| let text = "" | ||
| for (const file of files) { | ||
| const content = await readText(file) | ||
| if (content) { | ||
| const tokens = estimateTokens(content, encoder) | ||
| progress.report({ | ||
| message: `${file}, ${tokens}`, | ||
| }) | ||
| console.log(`${file}, ${tokens}`) | ||
| text += `${file}, ${tokens}\n` | ||
| } | ||
| } | ||
| progress.stop() | ||
| console.log(text) | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing progress report for parseTokens function.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing import statement for createProgressSpinner from "./spinner".