Skip to content

Commit

Permalink
fix indentation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hitesh-1997 committed Nov 9, 2024
1 parent 5711fc8 commit f3f897c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
9 changes: 1 addition & 8 deletions vscode/src/autoedits/adapters/cody-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { autoeditsLogger } from '../logger'
import type { AutoeditsModelAdapter, ChatPrompt, PromptResponseData } from '../prompt-provider'
import { getModelResponse } from '../prompt-provider'
import { type CodeToReplaceData, SYSTEM_PROMPT, getBaseUserPrompt } from '../prompt-utils'
import * as utils from '../utils'

export class CodyGatewayAdapter implements AutoeditsModelAdapter {
getPrompt(
Expand Down Expand Up @@ -39,13 +38,7 @@ export class CodyGatewayAdapter implements AutoeditsModelAdapter {
}

postProcessResponse(codeToReplace: CodeToReplaceData, response: string): string {
// TODO(hitesh): The finetuned model is messing up the indentation of the first line. [Issue](https://linear.app/sourcegraph/issue/CODY-4266/fix-the-indentation-issue-with-the-fine-tuned-models)
// Correct it manually for now, by checking the first line of the code to rewrite and adding the same indentation to the first line of the completion
const fixedIndentationResponse = utils.fixFirstLineIndentation(
codeToReplace.codeToRewrite,
response
)
return fixedIndentationResponse
return response
}

async getModelResponse(
Expand Down
9 changes: 1 addition & 8 deletions vscode/src/autoedits/adapters/fireworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { autoeditsLogger } from '../logger'
import type { AutoeditsModelAdapter, ChatPrompt, PromptResponseData } from '../prompt-provider'
import { getModelResponse } from '../prompt-provider'
import { type CodeToReplaceData, SYSTEM_PROMPT, getBaseUserPrompt } from '../prompt-utils'
import * as utils from '../utils'

export class FireworksAdapter implements AutoeditsModelAdapter {
getPrompt(
Expand Down Expand Up @@ -42,13 +41,7 @@ export class FireworksAdapter implements AutoeditsModelAdapter {
}

postProcessResponse(codeToReplace: CodeToReplaceData, response: string): string {
// TODO(hitesh): The finetuned model is messing up the indentation of the first line. [Issue](https://linear.app/sourcegraph/issue/CODY-4266/fix-the-indentation-issue-with-the-fine-tuned-models)
// Correct it manually for now, by checking the first line of the code to rewrite and adding the same indentation to the first line of the completion
const fixedIndentationResponse = utils.fixFirstLineIndentation(
codeToReplace.codeToRewrite,
response
)
return fixedIndentationResponse
return response
}

async getModelResponse(
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/autoedits/autoedits-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class AutoeditsProvider implements vscode.InlineCompletionItemProvider, v
autoeditsLogger.logDebug(
'Autoedits',
'========================== Response:\n',
JSON.stringify(prediction, null, 2),
prediction.prediction,
'\n',
'========================== Time Taken For LLM (Msec): ',
(Date.now() - start).toString(),
Expand Down

0 comments on commit f3f897c

Please sign in to comment.