Skip to content

Commit

Permalink
Merge pull request #52 from microsoft/joh/suitable-egret
Browse files Browse the repository at this point in the history
remove validate that just prints to the console
  • Loading branch information
jrieken authored Jun 3, 2024
2 parents 4cb2f5b + 58dee3e commit b32fad9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 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.1.11-alpha",
"version": "0.1.12-alpha",
"description": "Declare LLM prompts with TSX",
"main": "./dist/base/index.js",
"types": "./dist/base/index.d.ts",
Expand Down
12 changes: 1 addition & 11 deletions src/base/promptRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,7 @@ export class PromptRenderer<P extends BasePromptElementProps> {
return acc;
}, { references: [], names: new Set<string>() });

return { messages: this._validate(messageResult), hasIgnoredFiles: this._ignoredFiles.length > 0, tokenCount, references: coalesce(references) };
}

private _validate(chatMessages: ChatMessage[]) {
const lastMessage = chatMessages[chatMessages.length - 1];
if (lastMessage && lastMessage.role !== ChatRole.User) {
// User message was dropped, which will result in a 400 error from the server
console.error('Sorry, this message is too long. Please try a shorter question.');
}

return chatMessages;
return { messages: messageResult, hasIgnoredFiles: this._ignoredFiles.length > 0, tokenCount, references: coalesce(references) };
}

private _handlePromptChildren(element: QueueItem<PromptElementCtor<P, any>, P>, pieces: ProcessedPromptPiece[], sizing: PromptSizingContext, progress: Progress<ChatResponsePart> | undefined, token: CancellationToken | undefined) {
Expand Down

0 comments on commit b32fad9

Please sign in to comment.