🐛 fix /edit for anthropic

This commit is contained in:
Nate Sesti 2024-03-19 10:26:51 -07:00
parent 535b5afffd
commit bc1bbab3b7
5 changed files with 22 additions and 5 deletions

View file

@ -22,11 +22,11 @@ import {
codellamaEditPrompt,
deepseekEditPrompt,
gemmaEditPrompt,
gptEditPrompt,
mistralEditPrompt,
neuralChatEditPrompt,
openchatEditPrompt,
phindEditPrompt,
simplestEditPrompt,
simplifiedEditPrompt,
xWinCoderEditPrompt,
zephyrEditPrompt,
@ -256,7 +256,7 @@ function autodetectPromptTemplates(
} else if (templateType === "gemma") {
editTemplate = gemmaEditPrompt;
} else if (templateType) {
editTemplate = simplestEditPrompt;
editTemplate = gptEditPrompt;
}
if (editTemplate !== null) {

View file

@ -5,6 +5,7 @@ import {
LLMOptions,
ModelProvider,
} from "../..";
import { stripImages } from "../countTokens";
import { streamSse } from "../stream";
class Anthropic extends BaseLLM {
@ -65,6 +66,16 @@ class Anthropic extends BaseLLM {
return messages;
}
protected async *_streamComplete(
prompt: string,
options: CompletionOptions,
): AsyncGenerator<string> {
const messages = [{ role: "user" as const, content: prompt }];
for await (const update of this._streamChat(messages, options)) {
yield stripImages(update.content);
}
}
protected async *_streamChat(
messages: ChatMessage[],
options: CompletionOptions,

View file

@ -86,7 +86,7 @@
},
"../../core": {
"name": "@continuedev/core",
"version": "1.0.0",
"version": "1.0.1",
"license": "Apache-2.0",
"dependencies": {
"@mozilla/readability": "^0.5.0",

View file

@ -691,6 +691,11 @@
resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz"
integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==
"@lancedb/vectordb-darwin-arm64@*":
version "0.4.13"
resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.13.tgz"
integrity sha512-JfroNCG8yKIU931Y+x8d0Fp8C9DHUSC5j+CjI+e5err7rTWtie4j3JbsXlWAnPFaFEOg0Xk3BWkSikCvhPGJGg==
"@lancedb/vectordb-darwin-arm64@0.4.12":
version "0.4.12"
resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.12.tgz"
@ -2348,7 +2353,7 @@ core-util-is@1.0.2:
integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==
"core@file:../../core":
version "1.0.0"
version "1.0.1"
resolved "file:../../core"
dependencies:
"@mozilla/readability" "^0.5.0"

3
gui/package-lock.json generated
View file

@ -73,7 +73,8 @@
}
},
"../core": {
"version": "1.0.0",
"name": "@continuedev/core",
"version": "1.0.1",
"license": "Apache-2.0",
"dependencies": {
"@mozilla/readability": "^0.5.0",