seawolf2357 commited on
Commit
f5d6d1c
Β·
verified Β·
1 Parent(s): 3541d20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +141 -41
app.py CHANGED
@@ -2674,88 +2674,188 @@ async def index():
2674
  """Serve the HTML page"""
2675
  rtc_config = get_twilio_turn_credentials() if get_space() else None
2676
 
2677
- # 디버깅을 μœ„ν•œ κ°„λ‹¨ν•œ HTML
2678
  test_html = """<!DOCTYPE html>
2679
  <html lang="ko">
2680
  <head>
2681
  <meta charset="UTF-8">
2682
  <title>MOUSE Extended</title>
2683
  <style>
2684
- body { background: #121212; color: white; font-family: Arial; }
2685
- .tab-button { padding: 10px; margin: 5px; cursor: pointer; background: #333; border: none; color: white; }
2686
- .tab-button.active { background: #666; }
2687
- .tab-content { display: none; padding: 20px; }
2688
- .tab-content.active { display: block; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2689
  </style>
2690
  </head>
2691
  <body>
2692
- <h1>MOUSE Extended - Debug Version</h1>
2693
 
2694
- <div>
2695
- <button class="tab-button active" onclick="switchTab('tab1')">Tab 1</button>
2696
- <button class="tab-button" onclick="switchTab('tab2')">Tab 2</button>
2697
- <button class="tab-button" onclick="switchTab('tab3')">Tab 3</button>
2698
  </div>
2699
 
2700
- <div id="tab1" class="tab-content active">
2701
  <h2>Voice Chat Tab</h2>
2702
- <button onclick="testFunction()">Test Button</button>
2703
- <div id="search-toggle" style="width:50px;height:30px;background:#666;cursor:pointer;">Search Toggle</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
2704
  </div>
2705
 
2706
- <div id="tab2" class="tab-content">
2707
- <h2>Tab 2 Content</h2>
 
2708
  </div>
2709
 
2710
- <div id="tab3" class="tab-content">
2711
- <h2>Tab 3 Content</h2>
 
 
 
2712
  </div>
2713
-
2714
  <script>
2715
- console.log('Script started');
 
 
 
 
2716
 
 
2717
  function switchTab(tabName) {
2718
  console.log('Switching to:', tabName);
2719
 
2720
- // Hide all tabs
2721
  document.querySelectorAll('.tab-content').forEach(tab => {
2722
  tab.style.display = 'none';
2723
  tab.classList.remove('active');
2724
  });
2725
 
2726
- // Show selected tab
 
 
 
2727
  const selectedTab = document.getElementById(tabName);
2728
  if (selectedTab) {
2729
  selectedTab.style.display = 'block';
2730
  selectedTab.classList.add('active');
2731
  }
2732
 
2733
- // Update buttons
2734
- document.querySelectorAll('.tab-button').forEach(btn => {
2735
- btn.classList.remove('active');
2736
- });
2737
  event.target.classList.add('active');
2738
  }
2739
 
2740
- function testFunction() {
2741
- alert('Test function works!');
 
 
 
 
 
2742
  }
2743
 
2744
- // Initialize after DOM loaded
2745
- document.addEventListener('DOMContentLoaded', function() {
2746
- console.log('DOM loaded');
 
 
 
 
 
 
 
 
 
2747
 
2748
- // Search toggle test
2749
- const searchToggle = document.getElementById('search-toggle');
2750
- if (searchToggle) {
2751
- searchToggle.onclick = function() {
2752
- console.log('Search toggle clicked');
2753
- this.style.background = this.style.background === 'red' ? '#666' : 'red';
2754
- };
2755
- }
2756
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2757
 
2758
- console.log('Script finished');
2759
  </script>
2760
  </body>
2761
  </html>"""
 
2674
  """Serve the HTML page"""
2675
  rtc_config = get_twilio_turn_credentials() if get_space() else None
2676
 
2677
+ # Step 1: μ›λž˜ HTML의 κΈ°λ³Έ ꡬ쑰둜 μ‹œμž‘
2678
  test_html = """<!DOCTYPE html>
2679
  <html lang="ko">
2680
  <head>
2681
  <meta charset="UTF-8">
2682
  <title>MOUSE Extended</title>
2683
  <style>
2684
+ :root {
2685
+ --primary-color: #6f42c1;
2686
+ --secondary-color: #563d7c;
2687
+ --dark-bg: #121212;
2688
+ --card-bg: #1e1e1e;
2689
+ --text-color: #f8f9fa;
2690
+ --border-color: #333;
2691
+ }
2692
+ body {
2693
+ background-color: var(--dark-bg);
2694
+ color: var(--text-color);
2695
+ font-family: Arial, sans-serif;
2696
+ margin: 0;
2697
+ padding: 20px;
2698
+ }
2699
+ .tab-button {
2700
+ padding: 10px 20px;
2701
+ margin: 5px;
2702
+ cursor: pointer;
2703
+ background: var(--card-bg);
2704
+ border: 1px solid var(--border-color);
2705
+ color: var(--text-color);
2706
+ }
2707
+ .tab-button.active {
2708
+ background: var(--primary-color);
2709
+ }
2710
+ .tab-content {
2711
+ display: none;
2712
+ padding: 20px;
2713
+ background: var(--card-bg);
2714
+ margin-top: 20px;
2715
+ }
2716
+ .tab-content.active {
2717
+ display: block;
2718
+ }
2719
+ .toggle-switch {
2720
+ width: 50px;
2721
+ height: 26px;
2722
+ background: #ccc;
2723
+ cursor: pointer;
2724
+ display: inline-block;
2725
+ }
2726
+ .toggle-switch.active {
2727
+ background: var(--primary-color);
2728
+ }
2729
  </style>
2730
  </head>
2731
  <body>
2732
+ <h1>MOUSE Extended - Step 1</h1>
2733
 
2734
+ <div class="tabs-container">
2735
+ <button class="tab-button active" onclick="switchTab('voice-chat')">μŒμ„± μ±„νŒ…</button>
2736
+ <button class="tab-button" onclick="switchTab('mic-whisper')">마이크 전사</button>
2737
+ <button class="tab-button" onclick="switchTab('audio-whisper')">μ˜€λ””μ˜€ 파일</button>
2738
  </div>
2739
 
2740
+ <div id="voice-chat" class="tab-content active">
2741
  <h2>Voice Chat Tab</h2>
2742
+ <div>
2743
+ <label>μ›Ή 검색:</label>
2744
+ <div id="search-toggle" class="toggle-switch"></div>
2745
+ </div>
2746
+ <div>
2747
+ <label>μ–Έμ–΄ 선택:</label>
2748
+ <select id="language-select">
2749
+ <option value="">λΉ„ν™œμ„±ν™”</option>
2750
+ <option value="ko">ν•œκ΅­μ–΄</option>
2751
+ <option value="en">English</option>
2752
+ </select>
2753
+ </div>
2754
+ <button id="start-button">λŒ€ν™” μ‹œμž‘</button>
2755
+ <input type="text" id="text-input" placeholder="λ©”μ‹œμ§€ μž…λ ₯...">
2756
+ <button id="send-button">전솑</button>
2757
  </div>
2758
 
2759
+ <div id="mic-whisper" class="tab-content">
2760
+ <h2>마이크 전사</h2>
2761
+ <button onclick="toggleMicRecording()">λ…ΉμŒ μ‹œμž‘</button>
2762
  </div>
2763
 
2764
+ <div id="audio-whisper" class="tab-content">
2765
+ <h2>μ˜€λ””μ˜€ 파일</h2>
2766
+ <div id="audio-upload-area" style="border: 2px dashed #666; padding: 20px; cursor: pointer;">
2767
+ ν΄λ¦­ν•˜μ—¬ μ—…λ‘œλ“œ
2768
+ </div>
2769
  </div>
2770
+
2771
  <script>
2772
+ console.log('=== Script Start ===');
2773
+
2774
+ // Global variables
2775
+ let webSearchEnabled = false;
2776
+ let selectedLanguage = "";
2777
 
2778
+ // Tab switching
2779
  function switchTab(tabName) {
2780
  console.log('Switching to:', tabName);
2781
 
 
2782
  document.querySelectorAll('.tab-content').forEach(tab => {
2783
  tab.style.display = 'none';
2784
  tab.classList.remove('active');
2785
  });
2786
 
2787
+ document.querySelectorAll('.tab-button').forEach(btn => {
2788
+ btn.classList.remove('active');
2789
+ });
2790
+
2791
  const selectedTab = document.getElementById(tabName);
2792
  if (selectedTab) {
2793
  selectedTab.style.display = 'block';
2794
  selectedTab.classList.add('active');
2795
  }
2796
 
 
 
 
 
2797
  event.target.classList.add('active');
2798
  }
2799
 
2800
+ // Mock functions
2801
+ function toggleMicRecording() {
2802
+ alert('Mic recording toggle');
2803
+ }
2804
+
2805
+ function setupWebRTC() {
2806
+ alert('WebRTC setup');
2807
  }
2808
 
2809
+ function stop() {
2810
+ alert('Stop');
2811
+ }
2812
+
2813
+ function sendTextMessage() {
2814
+ const input = document.getElementById('text-input');
2815
+ alert('Send: ' + input.value);
2816
+ }
2817
+
2818
+ // Initialize
2819
+ window.onload = function() {
2820
+ console.log('=== Window loaded ===');
2821
 
2822
+ // Search toggle
2823
+ document.getElementById('search-toggle').onclick = function() {
2824
+ webSearchEnabled = !webSearchEnabled;
2825
+ this.classList.toggle('active');
2826
+ console.log('Search enabled:', webSearchEnabled);
2827
+ };
2828
+
2829
+ // Language select
2830
+ document.getElementById('language-select').onchange = function() {
2831
+ selectedLanguage = this.value;
2832
+ console.log('Language:', selectedLanguage);
2833
+ };
2834
+
2835
+ // Start button
2836
+ document.getElementById('start-button').onclick = function() {
2837
+ setupWebRTC();
2838
+ };
2839
+
2840
+ // Send button
2841
+ document.getElementById('send-button').onclick = sendTextMessage;
2842
+
2843
+ // Text input
2844
+ document.getElementById('text-input').onkeypress = function(e) {
2845
+ if (e.key === 'Enter') {
2846
+ sendTextMessage();
2847
+ }
2848
+ };
2849
+
2850
+ // File upload
2851
+ document.getElementById('audio-upload-area').onclick = function() {
2852
+ alert('Audio upload clicked');
2853
+ };
2854
+
2855
+ console.log('=== All initialized ===');
2856
+ };
2857
 
2858
+ console.log('=== Script End ===');
2859
  </script>
2860
  </body>
2861
  </html>"""