Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: autoblocksai/javascript-sdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.0.19
Choose a base ref
...
head repository: autoblocksai/javascript-sdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.0.20
Choose a head ref
  • 3 commits
  • 6 files changed
  • 2 contributors

Commits on Nov 16, 2023

  1. Dont require empty object to build templates w/o placeholders (#63)

    This makes it so you don't need to pass an empty object for the `params`
    argument for templates that have no placeholders. The overloads makes
    the error messages kind of hard to understand though...
    
    <img width="871" alt="Screenshot 2023-11-15 at 6 24 49 PM"
    src="https://github.com/autoblocksai/javascript-sdk/assets/7498009/cfa924c0-eb8d-4530-b6da-4a94b71995b6">
    
    <img width="969" alt="Screenshot 2023-11-15 at 6 28 08 PM"
    src="https://github.com/autoblocksai/javascript-sdk/assets/7498009/b8d13833-170d-4c23-8863-bdc161df3e35">
    
    ---------
    
    Co-authored-by: review-agent-prime[bot] <147289438+review-agent-prime[bot]@users.noreply.github.com>
    Nicole White and review-agent-prime[bot] authored Nov 16, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    81791df View commit details
  2. Revert "Dont require empty object to build templates w/o placeholders" (

    #64)
    
    Reverts #63
    
    The overload messes up the autocomplete for `params` for the templates
    that do have placeholders
    Nicole White authored Nov 16, 2023
    Copy the full SHA
    d7c755c View commit details
  3. Make logs less verbose (#65)

    ```
    > test-prompt-manager-ts@0.0.0 gen:watch
    > nodemon --quiet --watch prompt-templates --ext "*" --exec "npm run gen"
    
    
    > test-prompt-manager-ts@0.0.0 gen
    > autoblocks prompts generate
    
    ✓ Compiled in 3ms (2 templates)
    
    > test-prompt-manager-ts@0.0.0 gen
    > autoblocks prompts generate
    
    ✓ Compiled in 3ms (2 templates)
    
    > test-prompt-manager-ts@0.0.0 gen
    > autoblocks prompts generate
    
    ✓ Compiled in 3ms (2 templates)
    ```
    Nicole White authored Nov 16, 2023
    Copy the full SHA
    055db6f View commit details
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -105,5 +105,5 @@ jobs:
run: |
yalc add @autoblocks/client && \
npm install && \
npm run ab-prompts-generate && \
npm run gen && \
npm run start
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ pnpm-lock.yaml
.prettierignore
.gitignore
assets/
autoblocks-templates/
prompt-templates/
*.snap
6 changes: 4 additions & 2 deletions e2e/test-prompt-manager-ts/package.json
Original file line number Diff line number Diff line change
@@ -8,11 +8,13 @@
"type": "module",
"scripts": {
"start": "jest",
"ab-prompts-generate": "autoblocks prompts generate"
"gen": "autoblocks prompts generate",
"gen:watch": "nodemon --quiet --watch prompt-templates --ext \"*\" --exec \"npm run gen\""
},
"dependencies": {
"@types/jest": "*",
"jest": "*",
"nodemon": "*",
"openai": "*",
"ts-jest": "*"
},
@@ -21,6 +23,6 @@
"testEnvironment": "node"
},
"autoblocks": {
"templatesDirectory": "autoblocks-templates"
"templatesDirectory": "prompt-templates"
}
}
12 changes: 6 additions & 6 deletions src/prompts-cli/index.ts
Original file line number Diff line number Diff line change
@@ -224,9 +224,6 @@ export class PromptsCLI {
});
const uniquePlaceholderNames = Array.from(new Set(placeholderNames));

console.log(`Found template ${relativePath}`);
console.log(` Placeholders: ${uniquePlaceholderNames.join(', ')}`);

this.templatePlaceholders[relativePath] = uniquePlaceholderNames;
}
}),
@@ -263,12 +260,11 @@ export class PromptsCLI {
}

async run(): Promise<void> {
const startTime = Date.now();

const templatesDirectory =
await this.findTemplatesDirectoryFromNearestPackageJson();

console.log(`Found templates directory: ${templatesDirectory}`);
console.log('Generating types...');

await this.walkDirectory({
directoryName: templatesDirectory,
pathToTemplatesDirectory: templatesDirectory,
@@ -277,5 +273,9 @@ export class PromptsCLI {
await Promise.all(
autogenerationConfigs.map((config) => this.handleConfig(config)),
);

const duration = Date.now() - startTime;
const numTemplates = Object.keys(this.templates).length;
console.log(`✓ Compiled in ${duration}ms (${numTemplates} templates)`);
}
}