Skip to content

Commit

Permalink
Refactor imports and update changelog formatting across project files (
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan authored Sep 30, 2024
1 parent 3bb543e commit 3081ffa
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/src/content/docs/reference/scripts/system.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ index N in the above snippets, and then be prefixed with exactly the same whites
the original snippets above. See also the following examples of the expected response format.
CHANGELOG:
\`\`\`changelog
\`\`\`\`\`changelog
ChangeLog:1@<file>
Description: <summary>.
OriginalCode@4-6:
Expand Down Expand Up @@ -190,7 +190,7 @@ OriginalCode@23-23:
[23] <white space> <original code line>
ChangedCode@23-23:
[23] <white space> <changed code line>
\`\`\`
\`\`\`\`\`
`
`````

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import {
normalizeInt,
logVerbose,
logError,
delay,
dotGenaiscriptPath,
} from "../../core/src/util"
import { YAMLStringify } from "../../core/src/yaml"
Expand All @@ -70,6 +69,7 @@ import { resolveTokenEncoder } from "../../core/src/encoders"
import { writeFile } from "fs/promises"
import { writeFileSync } from "node:fs"
import { prettifyMarkdown } from "../../core/src/markdown"
import { delay } from "es-toolkit"

async function setupTraceWriting(trace: MarkdownTrace, filename: string) {
logVerbose(`trace: ${filename}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
normalizeInt,
logInfo,
logVerbose,
delay,
tagFilter,
toStringList,
} from "../../core/src/util"
Expand All @@ -40,6 +39,7 @@ import {
PromptScriptTestResult,
} from "../../core/src/server/messages"
import { generatePromptFooConfiguration } from "../../core/src/test"
import { delay } from "es-toolkit"

/**
* Parses model specifications from a string and returns a ModelOptions object.
Expand Down
12 changes: 0 additions & 12 deletions packages/core/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ export function trimNewlines(s: string) {
return s?.replace(/^\n*/, "").replace(/\n*$/, "")
}

export function delay<T>(millis: number, value?: T): Promise<T | undefined> {
return new Promise((resolve) => setTimeout(() => resolve(value), millis))
}

export function strcmp(a: string, b: string) {
if (a == b) return 0
if (a < b) return -1
Expand Down Expand Up @@ -197,14 +193,6 @@ export function concatArrays<T>(...arrays: T[][]): T[] {
return arrays[0].concat(...arrays.slice(1))
}

export function randomRange(min: number, max: number) {
return Math.round(Math.random() * (max - min) + min)
}

export function last<T>(a: ArrayLike<T>) {
return a[a.length - 1]
}

export function groupBy<T>(
list: T[],
key: (value: T) => string
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ import { MarkdownTrace } from "../../core/src/trace"
import {
dotGenaiscriptPath,
sha256string,
delay,
logInfo,
groupBy,
} from "../../core/src/util"
import { CORE_VERSION } from "../../core/src/version"
import { Fragment, GenerationResult } from "../../core/src/generation"
import { parametersToVars } from "../../core/src/parameters"
import { randomHex } from "../../core/src/crypto"
import { delay } from "es-toolkit"

export const FRAGMENTS_CHANGE = "fragmentsChange"
export const AI_REQUEST_CHANGE = "aiRequestChange"
Expand Down

0 comments on commit 3081ffa

Please sign in to comment.