return the full result from the model

This commit is contained in:
Jacob Kim 2025-06-23 21:07:47 -07:00
parent 6ae1fb578e
commit 3d359476e9

View file

@ -18,9 +18,7 @@ import {
AutocompleteInput,
AutocompleteOutcome,
} from "../autocomplete/util/types.js";
import { myersDiff } from "../diff/myers.js";
import { replaceEscapedCharacters } from "../util/text.js";
import { getRenderableDiff } from "./diff/diff.js";
import {
Prompt,
renderDefaultSystemPrompt,
@ -301,19 +299,16 @@ export class NextEditProvider {
const msg: ChatMessage = await llm.chat(prompts, token);
if (typeof msg.content === "string") {
const nextCompletion = replaceEscapedCharacters(
msg.content
.split("<|editable_region_start|>\n")[1]
.slice(1)
.slice(0, -2),
msg.content.split("<|editable_region_start|>\n")[1],
);
const diffLines = myersDiff(helper.fileContents, nextCompletion);
// const diffLines = myersDiff(helper.fileContents, nextCompletion);
const diff = getRenderableDiff(diffLines);
// const diff = getRenderableDiff(diffLines);
const outcomeNext: AutocompleteOutcome = {
time: Date.now() - startTime,
completion: diff,
completion: nextCompletion,
prefix: "",
suffix: "",
prompt: "",
@ -322,7 +317,7 @@ export class NextEditProvider {
completionOptions: null,
cacheHit: false,
filepath: helper.filepath,
numLines: diff.split("\n").length,
numLines: nextCompletion.split("\n").length,
completionId: helper.input.completionId,
gitRepo: await this.ide.getRepoName(helper.filepath),
uniqueId: await this.ide.getUniqueId(),