llama-server leaves special tokens out of content, so the NO_EDIT token arrives as an empty string. The daemon treated that as a rewrite of the region to nothing (Tab would have deleted the region). shared/nextedit.ts parseNextEditOutput() is now used by the daemon and the eval. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J39imRDT8L7xYbWzsVWd8A
This commit is contained in:
@@ -154,3 +154,12 @@ export function buildNextEditPrompt(input: NextEditInput, encode: Encode, ids: N
|
||||
export function nextEditTarget(newRegion: string | null, encode: Encode, ids: NextEditTokenIds): number[] {
|
||||
return newRegion === null ? [ids.noEdit, ids.outputEnd] : [...encode(newRegion), ids.outputEnd]
|
||||
}
|
||||
|
||||
/**
|
||||
* Model output → rewritten region, or null for "no edit". llama-server leaves special tokens out of `content`, so the
|
||||
* NO_EDIT token usually arrives as an empty string; never treat empty output as "replace the region with nothing".
|
||||
*/
|
||||
export function parseNextEditOutput(raw: string, oldText: string): string | null {
|
||||
if (raw.startsWith(NEXT_EDIT_TOKENS.noEdit) || raw.trim() === '' || raw === oldText) return null
|
||||
return raw
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user