feat(agent): add experimental option: strip auto-closing chars in prompt suffix. (#651)
* feat(agent): add experimental option: strip auto-closing chars in prompt suffix. * fix: rename settings adding experimental prefix.release-notes-05
parent
b47bdd5d77
commit
238d81ad4f
|
|
@ -8,6 +8,7 @@ export type AgentConfig = {
|
|||
};
|
||||
completion: {
|
||||
prompt: {
|
||||
experimentalStripAutoClosingCharacters: boolean;
|
||||
maxPrefixLines: number;
|
||||
maxSuffixLines: number;
|
||||
};
|
||||
|
|
@ -46,6 +47,7 @@ export const defaultAgentConfig: AgentConfig = {
|
|||
},
|
||||
completion: {
|
||||
prompt: {
|
||||
experimentalStripAutoClosingCharacters: false,
|
||||
maxPrefixLines: 20,
|
||||
maxSuffixLines: 20,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -264,10 +264,14 @@ export class TabbyAgent extends EventEmitter implements Agent {
|
|||
const maxPrefixLines = this.config.completion.prompt.maxPrefixLines;
|
||||
const maxSuffixLines = this.config.completion.prompt.maxSuffixLines;
|
||||
const { prefixLines, suffixLines } = context;
|
||||
return {
|
||||
prefix: prefixLines.slice(Math.max(prefixLines.length - maxPrefixLines, 0)).join(""),
|
||||
suffix: suffixLines.slice(0, maxSuffixLines).join(""),
|
||||
};
|
||||
const prefix = prefixLines.slice(Math.max(prefixLines.length - maxPrefixLines, 0)).join("");
|
||||
let suffix;
|
||||
if (this.config.completion.prompt.experimentalStripAutoClosingCharacters && context.mode !== "fill-in-line") {
|
||||
suffix = "\n" + suffixLines.slice(1, maxSuffixLines).join("");
|
||||
} else {
|
||||
suffix = suffixLines.slice(0, maxSuffixLines).join("");
|
||||
}
|
||||
return { prefix, suffix };
|
||||
}
|
||||
|
||||
private calculateReplaceRange(response: CompletionResponse, context: CompletionContext): CompletionResponse {
|
||||
|
|
|
|||
Loading…
Reference in New Issue