From 58dee3e1220c135adc13b39a0aaa8089b6d80d96 Mon Sep 17 00:00:00 2001 From: Johannes Date: Mon, 3 Jun 2024 19:57:32 +0200 Subject: [PATCH] remove validate that just prints to the console re https://github.com/microsoft/vscode-copilot/issues/6046 --- package-lock.json | 4 ++-- package.json | 2 +- src/base/promptRenderer.ts | 12 +----------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f00424..7c4b6bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@vscode/prompt-tsx", - "version": "0.1.11-alpha", + "version": "0.1.12-alpha", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@vscode/prompt-tsx", - "version": "0.1.11-alpha", + "version": "0.1.12-alpha", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@microsoft/tiktokenizer": "^1.0.6" diff --git a/package.json b/package.json index 9ee712f..12422e1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/base/promptRenderer.ts b/src/base/promptRenderer.ts index 85ecc3e..03bbcde 100644 --- a/src/base/promptRenderer.ts +++ b/src/base/promptRenderer.ts @@ -305,17 +305,7 @@ export class PromptRenderer

{ return acc; }, { references: [], names: new Set() }); - 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, P>, pieces: ProcessedPromptPiece[], sizing: PromptSizingContext, progress: Progress | undefined, token: CancellationToken | undefined) {