Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -416,6 +416,7 @@ def load_session_history(selected_session):
|
|
| 416 |
conn.close()
|
| 417 |
|
| 418 |
cards_html = """
|
|
|
|
| 419 |
<style>
|
| 420 |
.prompt-grid {
|
| 421 |
display: grid;
|
|
@@ -489,7 +490,7 @@ def load_session_history(selected_session):
|
|
| 489 |
}
|
| 490 |
|
| 491 |
// Base64 인코딩
|
| 492 |
-
const encodedHtml = btoa(unescape(encodeURIComponent(code)));
|
| 493 |
const dataUri = `data:text/html;charset=utf-8;base64,${encodedHtml}`;
|
| 494 |
|
| 495 |
// iframe 업데이트
|
|
@@ -504,16 +505,31 @@ def load_session_history(selected_session):
|
|
| 504 |
drawer.style.display = 'none';
|
| 505 |
}
|
| 506 |
|
| 507 |
-
//
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
}
|
| 513 |
} catch (error) {
|
| 514 |
console.error('Error executing history item:', error);
|
| 515 |
}
|
| 516 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 517 |
</script>
|
| 518 |
<div class="code-display"></div>
|
| 519 |
"""
|
|
|
|
| 416 |
conn.close()
|
| 417 |
|
| 418 |
cards_html = """
|
| 419 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 420 |
<style>
|
| 421 |
.prompt-grid {
|
| 422 |
display: grid;
|
|
|
|
| 490 |
}
|
| 491 |
|
| 492 |
// Base64 인코딩
|
| 493 |
+
const encodedHtml = btoa(unescape(encodeURIComponent(code.trim())));
|
| 494 |
const dataUri = `data:text/html;charset=utf-8;base64,${encodedHtml}`;
|
| 495 |
|
| 496 |
// iframe 업데이트
|
|
|
|
| 505 |
drawer.style.display = 'none';
|
| 506 |
}
|
| 507 |
|
| 508 |
+
// Code 실행 버튼 클릭 시뮬레이션
|
| 509 |
+
setTimeout(() => {
|
| 510 |
+
const executeBtn = document.querySelector('button:contains("Code 실행")');
|
| 511 |
+
if (executeBtn) {
|
| 512 |
+
executeBtn.click();
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
// 렌더 탭으로 변경
|
| 516 |
+
const tabs = document.querySelectorAll('[role="tab"]');
|
| 517 |
+
const renderTab = Array.from(tabs).find(tab => tab.getAttribute('data-value') === 'render');
|
| 518 |
+
if (renderTab) {
|
| 519 |
+
renderTab.click();
|
| 520 |
+
}
|
| 521 |
+
}, 100);
|
| 522 |
}
|
| 523 |
} catch (error) {
|
| 524 |
console.error('Error executing history item:', error);
|
| 525 |
}
|
| 526 |
}
|
| 527 |
+
|
| 528 |
+
// jQuery를 사용하여 텍스트 포함 여부로 버튼 찾기
|
| 529 |
+
jQuery.expr[':'].contains = function(a, i, m) {
|
| 530 |
+
return jQuery(a).text().toUpperCase()
|
| 531 |
+
.indexOf(m[3].toUpperCase()) >= 0;
|
| 532 |
+
};
|
| 533 |
</script>
|
| 534 |
<div class="code-display"></div>
|
| 535 |
"""
|