(currctJupyterModel)
| 229 | |
| 230 | |
| 231 | const getCellContentTextRequiredForOpenAI = (currctJupyterModel) => { |
| 232 | const context = getActiveContext(currctJupyterModel) |
| 233 | |
| 234 | if(context.length == 0){ |
| 235 | return [null, null] |
| 236 | } |
| 237 | |
| 238 | |
| 239 | let prompt = "" |
| 240 | let isLastLine = true |
| 241 | |
| 242 | for (let index = 0; index < context.length; index++) { |
| 243 | const lineInformation = context[index] |
| 244 | |
| 245 | if (lineInformation.isCursor) { |
| 246 | prompt += lineInformation.content |
| 247 | isLastLine = isLastLine = judgeIsTheLastLine(context, index) |
| 248 | break |
| 249 | } |
| 250 | |
| 251 | if (index == context.length - 1) { |
| 252 | prompt += lineInformation.content |
| 253 | break |
| 254 | } |
| 255 | |
| 256 | if (lineInformation.type == "code") { |
| 257 | prompt += lineInformation.content + "\n" |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | return [prompt, isLastLine] |
| 262 | } |
| 263 | |
| 264 | |
| 265 |
no test coverage detected