MCPcopy Create free account
hub / github.com/bigcode-project/jupytercoder / cleanUpBigcodeOutput

Function cleanUpBigcodeOutput

src/api.js:7–22  ·  view source on GitHub ↗
(suggestion, isLastLine)

Source from the content-addressed store, hash-verified

5
6
7const cleanUpBigcodeOutput = (suggestion, isLastLine) => {
8 suggestion = suggestion.replace("# -*- coding: utf-8 -*-\n\n", "")
9 let outPutIndex = suggestion.indexOf('<jupyter_output>')
10
11 if (outPutIndex != -1){
12 suggestion = suggestion.slice(0, outPutIndex)
13 }
14
15 const unnecessaryTag = '<|endoftext|>'
16 const unnecessaryTagIndex = suggestion.indexOf(unnecessaryTag)
17
18
19 suggestion = unnecessaryTagIndex == -1 ? suggestion : suggestion.slice(0, unnecessaryTagIndex)
20
21 return isLastLine ? suggestion : suggestion.replace("\n","")
22}
23
24
25const cleanUpOpenaiOutput = (suggestion, isLastLine) => {

Callers 1

api.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected