Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,24 @@ function getCellContentTextRequiredForBigCode(activeCell) {
// in active cell, LeftContext refers to the left side of the pointer, and vice versa, If both are null, it is determined that the pointer is not at the far right
const [leftContext, rightContext] = getActiveCellPointerCode(activeCell)

if(!leftContext && !rightContext){
if(!leftContext){
return null
}

TODO: "The following code needs to add 'leftContext' and 'rightContext'"
TODO: "The following code needs to add 'rightContext'"
// Iterate through the last 3 cells before the active cell
const startIndex = activeCellIndex - 3 < 0 ? 0 : activeCellIndex - 3;

for (let i = startIndex; i <= activeCellIndex; i++) {
if(i == activeCellIndex){
combinedContent += `<jupyter_code>${leftContext}`;
continue
}

const cellElement = cellElements[i];

if (cellElement.classList.contains('code_cell')) {
const code = extractTextFromCell(cellElement);

combinedContent += `<jupyter_code>${code}`;
const outputElement = cellElement.querySelector('.output_subarea');
if (outputElement) {
Expand Down Expand Up @@ -303,13 +307,11 @@ function extractTextFromCell(cell) {
codeMirrorLines.forEach((line) => {
content.push(line.textContent);
});
const content_str = content.join('\n');

return content_str;
return content.join('\n');
}



// 开始等待动画,有30s等待时间,如果等待时间过了,出现“error”字体,返回两个值如下,接收:"const [animationInterval, animationElement] = startWaitingAnimation(activeCall)"
// 1. animationInterval(interval, 动画计时器),可使用clearInterval(animationInterval)消除动画, 每次请求完毕必须要关掉
// 2. animationElement (dom, 动画字体节点), animationElement.innerHTML = xxx 来赋值
Expand Down