From ca6e0e9bb2fc72c0bfde5b9edd322088f3132bbe Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 16 Oct 2024 15:01:59 -0700 Subject: [PATCH] fix: containers without priority set should have max priority (#109) * fix: containers without priority set should have max priority Closes https://github.com/microsoft/vscode-copilot/issues/9289 * run validation on pr * 0.3.0-alpha.6 --- CHANGELOG.md | 4 ++++ build/base.yml | 1 - package-lock.json | 6 +++--- package.json | 2 +- src/base/promptRenderer.ts | 4 ++-- src/base/test/renderer.test.tsx | 3 +-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afe9dfa..acec3d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.3.0-alpha.6 + +- **fix:** containers without priority set should have max priority + ## 0.3.0-alpha.5 - **feat:** add `Expandable` elements to the renderer. See the [readme](./README.md#expandable-text) for details. diff --git a/build/base.yml b/build/base.yml index e0ecd49..821fd0d 100644 --- a/build/base.yml +++ b/build/base.yml @@ -4,7 +4,6 @@ trigger: branches: include: - main -pr: none resources: repositories: diff --git a/package-lock.json b/package-lock.json index 8244f8b..f6b852b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "@vscode/prompt-tsx", - "version": "0.3.0-alpha.5", + "version": "0.3.0-alpha.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@vscode/prompt-tsx", - "version": "0.3.0-alpha.5", - "license": "SEE LICENSE IN LICENSE", + "version": "0.3.0-alpha.6", + "license": "MIT", "devDependencies": { "@microsoft/tiktokenizer": "^1.0.6", "@types/node": "^20.11.30", diff --git a/package.json b/package.json index 0e62e5e..794b4b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vscode/prompt-tsx", - "version": "0.3.0-alpha.5", + "version": "0.3.0-alpha.6", "description": "Declare LLM prompts with TSX", "main": "./dist/base/index.js", "types": "./dist/base/index.d.ts", diff --git a/src/base/promptRenderer.ts b/src/base/promptRenderer.ts index 2e494df..fe1ccba 100644 --- a/src/base/promptRenderer.ts +++ b/src/base/promptRenderer.ts @@ -911,7 +911,7 @@ class PromptTreeElement { this._obj.props.name, this._obj instanceof AssistantMessage ? this._obj.props.toolCalls : undefined, this._obj instanceof ToolMessage ? this._obj.props.toolCallId : undefined, - this._obj.props.priority ?? 0, + this._obj.props.priority ?? Number.MAX_SAFE_INTEGER, this._metadata, this._children.map(child => child.materialize()) ); @@ -924,7 +924,7 @@ class PromptTreeElement { return new MaterializedContainer( this.id, this._obj?.constructor.name, - this._obj?.props.priority || 0, + this._obj?.props.priority ?? Number.MAX_SAFE_INTEGER, this._children.map(child => child.materialize()), this._metadata, flags diff --git a/src/base/test/renderer.test.tsx b/src/base/test/renderer.test.tsx index ec63ca4..2692866 100644 --- a/src/base/test/renderer.test.tsx +++ b/src/base/test/renderer.test.tsx @@ -914,9 +914,8 @@ suite('PromptRenderer', () => { '```', ].join('\n'), }, - { role: 'user', content: 'What is your name?' }, ]); - assert.equal(res2.tokenCount, 120 - BaseTokensPerCompletion); + assert.equal(res2.tokenCount, 108); }); });