@@ -322,7 +322,9 @@ export class XtabProvider implements IStatelessNextEditProvider {
322322
323323 const userPrompt = getUserPrompt ( promptPieces ) ;
324324
325- const prediction = this . getPredictedOutput ( editWindowLines , promptOptions . promptingStrategy ) ;
325+ const responseFormat = xtabPromptOptions . ResponseFormat . fromPromptingStrategy ( promptOptions . promptingStrategy ) ;
326+
327+ const prediction = this . getPredictedOutput ( editWindowLines , responseFormat ) ;
326328
327329 const messages = constructMessages ( {
328330 systemMsg : this . pickSystemPrompt ( promptOptions . promptingStrategy ) ,
@@ -361,7 +363,7 @@ export class XtabProvider implements IStatelessNextEditProvider {
361363 {
362364 showLabel : opts . showLabel ,
363365 shouldRemoveCursorTagFromResponse,
364- promptingStrategy : promptOptions . promptingStrategy ,
366+ responseFormat ,
365367 retryState,
366368 } ,
367369 delaySession ,
@@ -563,7 +565,7 @@ export class XtabProvider implements IStatelessNextEditProvider {
563565 prediction : Prediction | undefined ,
564566 opts : {
565567 showLabel : boolean ;
566- promptingStrategy : xtabPromptOptions . PromptingStrategy | undefined ;
568+ responseFormat : xtabPromptOptions . ResponseFormat ;
567569 shouldRemoveCursorTagFromResponse : boolean ;
568570 retryState : RetryState ;
569571 } ,
@@ -687,13 +689,9 @@ export class XtabProvider implements IStatelessNextEditProvider {
687689
688690 let cleanedLinesStream : AsyncIterableObject < string > ;
689691
690- if ( opts . promptingStrategy === xtabPromptOptions . PromptingStrategy . Xtab275 ) {
692+ if ( opts . responseFormat === xtabPromptOptions . ResponseFormat . EditWindowOnly ) {
691693 cleanedLinesStream = linesStream ;
692- } else if (
693- opts . promptingStrategy === xtabPromptOptions . PromptingStrategy . UnifiedModel ||
694- opts . promptingStrategy === xtabPromptOptions . PromptingStrategy . Codexv21NesUnified ||
695- opts . promptingStrategy === xtabPromptOptions . PromptingStrategy . Nes41Miniv3
696- ) {
694+ } else if ( opts . responseFormat === xtabPromptOptions . ResponseFormat . UnifiedWithXml ) {
697695 const linesIter = linesStream [ Symbol . asyncIterator ] ( ) ;
698696 const firstLine = await linesIter . next ( ) ;
699697
@@ -765,8 +763,10 @@ export class XtabProvider implements IStatelessNextEditProvider {
765763 pushEdit ( Result . error ( new NoNextEditReason . Unexpected ( new Error ( `unexpected tag ${ trimmedLines } ` ) ) ) ) ;
766764 return ;
767765 }
768- } else {
766+ } else if ( opts . responseFormat === xtabPromptOptions . ResponseFormat . CodeBlock ) {
769767 cleanedLinesStream = linesWithBackticksRemoved ( linesStream ) ;
768+ } else {
769+ assertNever ( opts . responseFormat ) ;
770770 }
771771
772772 const diffOptions : ResponseProcessor . DiffParams = {
@@ -1316,25 +1316,24 @@ export class XtabProvider implements IStatelessNextEditProvider {
13161316 return createProxyXtabEndpoint ( this . instaService , configuredModelName ) ;
13171317 }
13181318
1319- private getPredictedOutput ( editWindowLines : string [ ] , promptingStrategy : xtabPromptOptions . PromptingStrategy | undefined ) : Prediction | undefined {
1319+ private getPredictedOutput ( editWindowLines : string [ ] , responseFormat : xtabPromptOptions . ResponseFormat ) : Prediction | undefined {
13201320 return this . configService . getConfig ( ConfigKey . Internal . InlineEditsXtabProviderUsePrediction )
13211321 ? {
13221322 type : 'content' ,
1323- content : XtabProvider . getPredictionContents ( editWindowLines , promptingStrategy )
1323+ content : XtabProvider . getPredictionContents ( editWindowLines , responseFormat )
13241324 }
13251325 : undefined ;
13261326 }
13271327
1328- private static getPredictionContents ( editWindowLines : readonly string [ ] , promptingStrategy : xtabPromptOptions . PromptingStrategy | undefined ) : string {
1329- if ( promptingStrategy === xtabPromptOptions . PromptingStrategy . UnifiedModel ||
1330- promptingStrategy === xtabPromptOptions . PromptingStrategy . Codexv21NesUnified ||
1331- promptingStrategy === xtabPromptOptions . PromptingStrategy . Nes41Miniv3
1332- ) {
1328+ private static getPredictionContents ( editWindowLines : readonly string [ ] , responseFormat : xtabPromptOptions . ResponseFormat ) : string {
1329+ if ( responseFormat === xtabPromptOptions . ResponseFormat . UnifiedWithXml ) {
13331330 return [ '<EDIT>' , ...editWindowLines , '</EDIT>' ] . join ( '\n' ) ;
1334- } else if ( promptingStrategy === xtabPromptOptions . PromptingStrategy . Xtab275 ) {
1331+ } else if ( responseFormat === xtabPromptOptions . ResponseFormat . EditWindowOnly ) {
13351332 return editWindowLines . join ( '\n' ) ;
1336- } else {
1333+ } else if ( responseFormat === xtabPromptOptions . ResponseFormat . CodeBlock ) {
13371334 return [ '```' , ...editWindowLines , '```' ] . join ( '\n' ) ;
1335+ } else {
1336+ assertNever ( responseFormat ) ;
13381337 }
13391338 }
13401339
0 commit comments