Skip to content

Commit

Permalink
fix: containers without priority set should have max priority (#109)
Browse files Browse the repository at this point in the history
* fix: containers without priority set should have max priority

Closes microsoft/vscode-copilot#9289

* run validation on pr

* 0.3.0-alpha.6
  • Loading branch information
connor4312 authored Oct 16, 2024
1 parent d5371d8 commit ca6e0e9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion build/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ trigger:
branches:
include:
- main
pr: none

resources:
repositories:
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/base/promptRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
);
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/base/test/renderer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand Down

0 comments on commit ca6e0e9

Please sign in to comment.