banao-tech commited on
Commit
5120f53
Β·
verified Β·
1 Parent(s): 58f63fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +240 -240
app.py CHANGED
@@ -468,245 +468,6 @@ def render_admin_dashboard():
468
 
469
  # Session info
470
  col1, col2 = st.columns(2)
471
- with col1:
472
- # Comprehensive list of programming languages, frameworks, and databases
473
- tech_options = [
474
- # Programming Languages
475
- "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "C", "Go", "Rust", "Swift",
476
- "Kotlin", "Scala", "Ruby", "PHP", "Perl", "R", "MATLAB", "Dart", "Objective-C", "Assembly",
477
- "Haskell", "Erlang", "Elixir", "F#", "Clojure", "Lua", "Julia", "Groovy", "VB.NET", "COBOL",
478
- "Fortran", "Pascal", "Delphi", "Ada", "Prolog", "Lisp", "Scheme", "OCaml", "ML",
479
-
480
- # Web Technologies
481
- "HTML", "CSS", "SASS", "LESS", "Bootstrap", "Tailwind CSS", "Material-UI",
482
-
483
- # Frontend Frameworks/Libraries
484
- "React", "Vue.js", "Angular", "Svelte", "Next.js", "Nuxt.js", "Gatsby", "Ember.js",
485
- "Backbone.js", "jQuery", "Alpine.js", "Lit", "Stencil", "Ionic", "React Native",
486
- "Flutter", "Xamarin", "Cordova", "PhoneGap",
487
-
488
- # Backend Frameworks
489
- "Node.js", "Express.js", "Nest.js", "Django", "Flask", "FastAPI", "Pyramid", "Tornado",
490
- "Spring Boot", "Spring MVC", "Struts", "Hibernate", "ASP.NET", "ASP.NET Core",
491
- "Ruby on Rails", "Sinatra", "Laravel", "Symfony", "CodeIgniter", "CakePHP", "Zend",
492
- "Gin", "Echo", "Fiber", "Actix", "Rocket", "Warp", "Axum",
493
-
494
- # Mobile Development
495
- "Android (Java)", "Android (Kotlin)", "iOS (Swift)", "iOS (Objective-C)",
496
-
497
- # Game Development
498
- "Unity", "Unreal Engine", "Godot", "GameMaker Studio", "Construct", "Phaser",
499
-
500
- # Database Technologies
501
- "MySQL", "PostgreSQL", "SQLite", "Microsoft SQL Server", "Oracle Database",
502
- "MongoDB", "Redis", "Cassandra", "DynamoDB", "Firebase", "Supabase",
503
- "CouchDB", "Neo4j", "InfluxDB", "TimescaleDB", "ClickHouse", "Apache Spark",
504
- "Elasticsearch", "Apache Solr", "Amazon RDS", "Google Cloud SQL",
505
-
506
- # Cloud & DevOps
507
- "AWS", "Google Cloud Platform", "Microsoft Azure", "Digital Ocean", "Heroku",
508
- "Docker", "Kubernetes", "Terraform", "Ansible", "Jenkins", "GitLab CI", "GitHub Actions",
509
- "Nginx", "Apache", "Linux", "Ubuntu", "CentOS", "Red Hat",
510
-
511
- # Data Science & AI/ML
512
- "TensorFlow", "PyTorch", "Scikit-learn", "Pandas", "NumPy", "Matplotlib", "Seaborn",
513
- "Jupyter", "Apache Airflow", "Apache Kafka", "Apache Flink", "Hadoop", "Spark",
514
- "Tableau", "Power BI", "D3.js", "Plotly", "OpenCV", "Keras", "XGBoost",
515
-
516
- # Testing Frameworks
517
- "Jest", "Mocha", "Chai", "Cypress", "Selenium", "Playwright", "Puppeteer",
518
- "JUnit", "TestNG", "Mockito", "PyTest", "unittest", "RSpec", "PHPUnit",
519
-
520
- # Other Technologies
521
- "GraphQL", "REST API", "gRPC", "WebSocket", "Apache Kafka", "RabbitMQ",
522
- "Blockchain", "Solidity", "Web3", "Ethereum", "Bitcoin", "Smart Contracts",
523
- "Microservices", "Serverless", "Lambda Functions", "API Gateway"
524
- ]
525
-
526
- # Sort the options alphabetically
527
- tech_options.sort()
528
-
529
- programming_language = st.selectbox(
530
- "Programming Language / Technology",
531
- tech_options,
532
- index=tech_options.index("Python") if "Python" in tech_options else 0,
533
- help="Select the primary programming language, framework, or technology for examples"
534
- )
535
- with col2:
536
- st.markdown("<br>", unsafe_allow_html=True) # Add spacing
537
- toggle_hinglish = st.toggle("Enable Hinglish", value=True, help="Enable mixing of Hindi and English")
538
-
539
- # Submit button
540
- st.markdown("<br>", unsafe_allow_html=True)
541
- col1, col2, col3 = st.columns([1, 2, 1])
542
- with col2:
543
- submitted = st.form_submit_button("πŸš€ Generate Course", use_container_width=True)
544
-
545
- # Handle submission
546
- if submitted:
547
- # Use the topics from session state directly
548
- topics_to_process = st.session_state.topics_list
549
-
550
- # Get course configuration
551
- course_config = COURSE_CONFIGS[selected_course]
552
- course_id = course_config["course_id"]
553
- chapter_id = course_config["chapter_id"]
554
-
555
- # Validate inputs
556
- valid_topics = []
557
- for topic in topics_to_process:
558
- if topic["topic_title"].strip() and topic["chapter_title"].strip():
559
- valid_topics.append(topic)
560
-
561
- if not valid_topics:
562
- st.error("❌ Please enter at least one topic with both topic title and chapter title")
563
- else:
564
- # Show loading state with better animation
565
- with st.spinner(f"🎬 Generating your {selected_course} course... This may take a few moments."):
566
- progress_bar = st.progress(0)
567
- for i in range(100):
568
- time.sleep(0.02) # Simulating progress
569
- progress_bar.progress(i + 1)
570
-
571
- # Hardcoded values
572
- user_id = DEFAULT_USER_ID
573
- personalization_id = DEFAULT_PERSONALIZATION_ID
574
-
575
- # Create user profile (hardcoded)
576
- user_profile = {
577
- "personalized": True,
578
- "user_name": "System User",
579
- "user_age": 25,
580
- "user_gender": "male",
581
- "user_tech_knowledge": "beginner",
582
- "user_preferred_activity": "coding, learning, technology",
583
- "user_food": "healthy food, vegetarian",
584
- "user_physical_activities": "walking, yoga",
585
- "learning_style": "visual",
586
- "target_language": target_language,
587
- "tts_gender": tts_gender,
588
- "tts_voice": tts_voice,
589
- "toggle_hinglish": toggle_hinglish,
590
- "run_visualization": False,
591
- "subtitle": "",
592
- "age_group": "18-25"
593
- }
594
-
595
- # Create settings
596
- settings = {
597
- "target_language": target_language,
598
- "tts_gender": tts_gender,
599
- "tts_voice": tts_voice,
600
- "toggle_hinglish": toggle_hinglish,
601
- "run_visualization": False,
602
- "subtitle": "",
603
- "programming_language": programming_language,
604
- "slide_colour": "blue",
605
- "video_type": "base_video"
606
- }
607
-
608
- # Generate topics data with user input for titles and course-specific values
609
- topics_data = []
610
- for i, topic in enumerate(valid_topics):
611
- topics_data.append({
612
- "topic_id": 10834 + i, # Hardcoded with increment
613
- "topic_title": topic["topic_title"].strip(),
614
- "chapter_id": chapter_id, # From selected course
615
- "chapter_title": topic["chapter_title"].strip(), # User input
616
- "course_id": course_id, # From selected course
617
- "course_name": selected_course, # Add course name to each topic
618
- "video_url": f"https://techlearn-dev.s3.ap-south-1.amazonaws.com/course_videos/{course_id}/{chapter_id}/172906{4365+i*50}.mp4", # Course-specific
619
- "video_duration": 462 + i*20, # Hardcoded with variation
620
- "sequence_number": i + 1,
621
- })
622
-
623
- # Create payload (always multiple topics structure) - NOW INCLUDING COURSE_NAME
624
- payload = {
625
- "personalization_id": personalization_id,
626
- "user_id": user_id,
627
- "course_id": course_id,
628
- "course_name": selected_course,
629
- "total_videos": len(topics_data),
630
- "created_at": datetime.utcnow().isoformat(),
631
- "user_profile": user_profile,
632
- "topics": topics_data,
633
- "settings": settings
634
- }
635
-
636
- # Make API call
637
- try:
638
- headers = {
639
- 'Content-Type': 'application/json'
640
- }
641
-
642
- response = requests.post(API_ENDPOINT, json=payload, headers=headers, timeout=API_TIMEOUT)
643
-
644
- if response.status_code == 200:
645
- response_data = response.json()
646
- session_ids = response_data.get("session_ids", [])
647
-
648
- st.success(f"πŸŽ‰ {selected_course} generation started successfully!")
649
-
650
- # Store session IDs in session state
651
- st.session_state.session_ids.extend(session_ids)
652
-
653
- # Display results in a clean format
654
- st.markdown("### πŸ“Š Generation Summary")
655
-
656
- col1, col2 = st.columns(2)
657
- with col1:
658
- st.markdown(f"""
659
- **Course**: {selected_course}
660
- **Course ID**: {course_id}
661
- **Programming Language**: {programming_language.capitalize()}
662
- **Target Language**: {target_language.capitalize()}
663
- """)
664
- with col2:
665
- st.markdown(f"""
666
- **Voice**: {tts_voice.capitalize()} ({tts_gender.capitalize()})
667
- **Topics Count**: {len(valid_topics)}
668
- **Hinglish**: {"Enabled" if toggle_hinglish else "Disabled"}
669
- **Chapter ID**: {chapter_id}
670
- """)
671
-
672
- # Display session IDs
673
- if session_ids:
674
- st.markdown("### πŸ” Session Tracking IDs")
675
- for i, session_id in enumerate(session_ids, 1):
676
- st.markdown(f'<div class="session-info">πŸ“ <strong>Session {i}:</strong> <code>{session_id}</code></div>', unsafe_allow_html=True)
677
-
678
- # Display API response
679
- with st.expander("πŸ“Š View Full API Response", expanded=False):
680
- st.markdown('<div class="api-response">', unsafe_allow_html=True)
681
- st.json(response_data)
682
- st.markdown('</div>', unsafe_allow_html=True)
683
-
684
- # Information about tracking
685
- st.info(f"""
686
- πŸ’‘ **Tracking Information**
687
- You can track the progress of your {selected_course} course generation using the session IDs above.
688
- The processing status will be updated in DynamoDB table: {SESSION_TABLE}
689
- Region: {DYNAMODB_REGION}
690
-
691
- πŸ‘‰ **Next Steps**: Switch to the "Admin Dashboard" to monitor your session progress in real-time!
692
- """)
693
-
694
- else:
695
- st.error(f"❌ API Error: {response.status_code}")
696
- if response.text:
697
- st.error(f"**Error Details**: {response.text}")
698
-
699
- except requests.exceptions.Timeout:
700
- st.error("⏰ Request timed out. Please try again later.")
701
- except requests.exceptions.ConnectionError:
702
- st.error("🌐 Connection error. Please check your internet connection.")
703
- except Exception as e:
704
- st.error(f"❌ API call failed: {str(e)}")
705
-
706
- # Show payload for debugging
707
- with st.expander("πŸ› Debug Information", expanded=False):
708
- st.warning("Request payload for debugging:")
709
- st.json(payload)
710
  with col1:
711
  st.markdown(f"""
712
  **Node**: {session_data['node']}
@@ -970,4 +731,243 @@ else:
970
  # Technical Settings Section
971
  st.markdown('<div class="section-header">πŸ’» Technical Settings</div>', unsafe_allow_html=True)
972
 
973
- col1, col2 = st.columns(2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
 
469
  # Session info
470
  col1, col2 = st.columns(2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  with col1:
472
  st.markdown(f"""
473
  **Node**: {session_data['node']}
 
731
  # Technical Settings Section
732
  st.markdown('<div class="section-header">πŸ’» Technical Settings</div>', unsafe_allow_html=True)
733
 
734
+ col1, col2 = st.columns(2)
735
+ with col1:
736
+ # Comprehensive list of programming languages, frameworks, and databases
737
+ tech_options = [
738
+ # Programming Languages
739
+ "Python", "Java", "JavaScript", "TypeScript", "C++", "C#", "C", "Go", "Rust", "Swift",
740
+ "Kotlin", "Scala", "Ruby", "PHP", "Perl", "R", "MATLAB", "Dart", "Objective-C", "Assembly",
741
+ "Haskell", "Erlang", "Elixir", "F#", "Clojure", "Lua", "Julia", "Groovy", "VB.NET", "COBOL",
742
+ "Fortran", "Pascal", "Delphi", "Ada", "Prolog", "Lisp", "Scheme", "OCaml", "ML",
743
+
744
+ # Web Technologies
745
+ "HTML", "CSS", "SASS", "LESS", "Bootstrap", "Tailwind CSS", "Material-UI",
746
+
747
+ # Frontend Frameworks/Libraries
748
+ "React", "Vue.js", "Angular", "Svelte", "Next.js", "Nuxt.js", "Gatsby", "Ember.js",
749
+ "Backbone.js", "jQuery", "Alpine.js", "Lit", "Stencil", "Ionic", "React Native",
750
+ "Flutter", "Xamarin", "Cordova", "PhoneGap",
751
+
752
+ # Backend Frameworks
753
+ "Node.js", "Express.js", "Nest.js", "Django", "Flask", "FastAPI", "Pyramid", "Tornado",
754
+ "Spring Boot", "Spring MVC", "Struts", "Hibernate", "ASP.NET", "ASP.NET Core",
755
+ "Ruby on Rails", "Sinatra", "Laravel", "Symfony", "CodeIgniter", "CakePHP", "Zend",
756
+ "Gin", "Echo", "Fiber", "Actix", "Rocket", "Warp", "Axum",
757
+
758
+ # Mobile Development
759
+ "Android (Java)", "Android (Kotlin)", "iOS (Swift)", "iOS (Objective-C)",
760
+
761
+ # Game Development
762
+ "Unity", "Unreal Engine", "Godot", "GameMaker Studio", "Construct", "Phaser",
763
+
764
+ # Database Technologies
765
+ "MySQL", "PostgreSQL", "SQLite", "Microsoft SQL Server", "Oracle Database",
766
+ "MongoDB", "Redis", "Cassandra", "DynamoDB", "Firebase", "Supabase",
767
+ "CouchDB", "Neo4j", "InfluxDB", "TimescaleDB", "ClickHouse", "Apache Spark",
768
+ "Elasticsearch", "Apache Solr", "Amazon RDS", "Google Cloud SQL",
769
+
770
+ # Cloud & DevOps
771
+ "AWS", "Google Cloud Platform", "Microsoft Azure", "Digital Ocean", "Heroku",
772
+ "Docker", "Kubernetes", "Terraform", "Ansible", "Jenkins", "GitLab CI", "GitHub Actions",
773
+ "Nginx", "Apache", "Linux", "Ubuntu", "CentOS", "Red Hat",
774
+
775
+ # Data Science & AI/ML
776
+ "TensorFlow", "PyTorch", "Scikit-learn", "Pandas", "NumPy", "Matplotlib", "Seaborn",
777
+ "Jupyter", "Apache Airflow", "Apache Kafka", "Apache Flink", "Hadoop", "Spark",
778
+ "Tableau", "Power BI", "D3.js", "Plotly", "OpenCV", "Keras", "XGBoost",
779
+
780
+ # Testing Frameworks
781
+ "Jest", "Mocha", "Chai", "Cypress", "Selenium", "Playwright", "Puppeteer",
782
+ "JUnit", "TestNG", "Mockito", "PyTest", "unittest", "RSpec", "PHPUnit",
783
+
784
+ # Other Technologies
785
+ "GraphQL", "REST API", "gRPC", "WebSocket", "Apache Kafka", "RabbitMQ",
786
+ "Blockchain", "Solidity", "Web3", "Ethereum", "Bitcoin", "Smart Contracts",
787
+ "Microservices", "Serverless", "Lambda Functions", "API Gateway"
788
+ ]
789
+
790
+ # Sort the options alphabetically
791
+ tech_options.sort()
792
+
793
+ programming_language = st.selectbox(
794
+ "Programming Language / Technology",
795
+ tech_options,
796
+ index=tech_options.index("Python") if "Python" in tech_options else 0,
797
+ help="Select the primary programming language, framework, or technology for examples"
798
+ )
799
+ with col2:
800
+ st.markdown("<br>", unsafe_allow_html=True) # Add spacing
801
+ toggle_hinglish = st.toggle("Enable Hinglish", value=True, help="Enable mixing of Hindi and English")
802
+
803
+ # Submit button
804
+ st.markdown("<br>", unsafe_allow_html=True)
805
+ col1, col2, col3 = st.columns([1, 2, 1])
806
+ with col2:
807
+ submitted = st.form_submit_button("πŸš€ Generate Course", use_container_width=True)
808
+
809
+ # Handle submission
810
+ if submitted:
811
+ # Use the topics from session state directly
812
+ topics_to_process = st.session_state.topics_list
813
+
814
+ # Get course configuration
815
+ course_config = COURSE_CONFIGS[selected_course]
816
+ course_id = course_config["course_id"]
817
+ chapter_id = course_config["chapter_id"]
818
+
819
+ # Validate inputs
820
+ valid_topics = []
821
+ for topic in topics_to_process:
822
+ if topic["topic_title"].strip() and topic["chapter_title"].strip():
823
+ valid_topics.append(topic)
824
+
825
+ if not valid_topics:
826
+ st.error("❌ Please enter at least one topic with both topic title and chapter title")
827
+ else:
828
+ # Show loading state with better animation
829
+ with st.spinner(f"🎬 Generating your {selected_course} course... This may take a few moments."):
830
+ progress_bar = st.progress(0)
831
+ for i in range(100):
832
+ time.sleep(0.02) # Simulating progress
833
+ progress_bar.progress(i + 1)
834
+
835
+ # Hardcoded values
836
+ user_id = DEFAULT_USER_ID
837
+ personalization_id = DEFAULT_PERSONALIZATION_ID
838
+
839
+ # Create user profile (hardcoded)
840
+ user_profile = {
841
+ "personalized": True,
842
+ "user_name": "System User",
843
+ "user_age": 25,
844
+ "user_gender": "male",
845
+ "user_tech_knowledge": "beginner",
846
+ "user_preferred_activity": "coding, learning, technology",
847
+ "user_food": "healthy food, vegetarian",
848
+ "user_physical_activities": "walking, yoga",
849
+ "learning_style": "visual",
850
+ "target_language": target_language,
851
+ "tts_gender": tts_gender,
852
+ "tts_voice": tts_voice,
853
+ "toggle_hinglish": toggle_hinglish,
854
+ "run_visualization": False,
855
+ "subtitle": "",
856
+ "age_group": "18-25"
857
+ }
858
+
859
+ # Create settings
860
+ settings = {
861
+ "target_language": target_language,
862
+ "tts_gender": tts_gender,
863
+ "tts_voice": tts_voice,
864
+ "toggle_hinglish": toggle_hinglish,
865
+ "run_visualization": False,
866
+ "subtitle": "",
867
+ "programming_language": programming_language,
868
+ "slide_colour": "blue",
869
+ "video_type": "base_video"
870
+ }
871
+
872
+ # Generate topics data with user input for titles and course-specific values
873
+ topics_data = []
874
+ for i, topic in enumerate(valid_topics):
875
+ topics_data.append({
876
+ "topic_id": 10834 + i, # Hardcoded with increment
877
+ "topic_title": topic["topic_title"].strip(),
878
+ "chapter_id": chapter_id, # From selected course
879
+ "chapter_title": topic["chapter_title"].strip(), # User input
880
+ "course_id": course_id, # From selected course
881
+ "course_name": selected_course, # Add course name to each topic
882
+ "video_url": f"https://techlearn-dev.s3.ap-south-1.amazonaws.com/course_videos/{course_id}/{chapter_id}/172906{4365+i*50}.mp4", # Course-specific
883
+ "video_duration": 462 + i*20, # Hardcoded with variation
884
+ "sequence_number": i + 1,
885
+ })
886
+
887
+ # Create payload (always multiple topics structure) - NOW INCLUDING COURSE_NAME
888
+ payload = {
889
+ "personalization_id": personalization_id,
890
+ "user_id": user_id,
891
+ "course_id": course_id,
892
+ "course_name": selected_course,
893
+ "total_videos": len(topics_data),
894
+ "created_at": datetime.utcnow().isoformat(),
895
+ "user_profile": user_profile,
896
+ "topics": topics_data,
897
+ "settings": settings
898
+ }
899
+
900
+ # Make API call
901
+ try:
902
+ headers = {
903
+ 'Content-Type': 'application/json'
904
+ }
905
+
906
+ response = requests.post(API_ENDPOINT, json=payload, headers=headers, timeout=API_TIMEOUT)
907
+
908
+ if response.status_code == 200:
909
+ response_data = response.json()
910
+ session_ids = response_data.get("session_ids", [])
911
+
912
+ st.success(f"πŸŽ‰ {selected_course} generation started successfully!")
913
+
914
+ # Store session IDs in session state
915
+ st.session_state.session_ids.extend(session_ids)
916
+
917
+ # Display results in a clean format
918
+ st.markdown("### πŸ“Š Generation Summary")
919
+
920
+ col1, col2 = st.columns(2)
921
+ with col1:
922
+ st.markdown(f"""
923
+ **Course**: {selected_course}
924
+ **Course ID**: {course_id}
925
+ **Programming Language**: {programming_language.capitalize()}
926
+ **Target Language**: {target_language.capitalize()}
927
+ """)
928
+ with col2:
929
+ st.markdown(f"""
930
+ **Voice**: {tts_voice.capitalize()} ({tts_gender.capitalize()})
931
+ **Topics Count**: {len(valid_topics)}
932
+ **Hinglish**: {"Enabled" if toggle_hinglish else "Disabled"}
933
+ **Chapter ID**: {chapter_id}
934
+ """)
935
+
936
+ # Display session IDs
937
+ if session_ids:
938
+ st.markdown("### πŸ” Session Tracking IDs")
939
+ for i, session_id in enumerate(session_ids, 1):
940
+ st.markdown(f'<div class="session-info">πŸ“ <strong>Session {i}:</strong> <code>{session_id}</code></div>', unsafe_allow_html=True)
941
+
942
+ # Display API response
943
+ with st.expander("πŸ“Š View Full API Response", expanded=False):
944
+ st.markdown('<div class="api-response">', unsafe_allow_html=True)
945
+ st.json(response_data)
946
+ st.markdown('</div>', unsafe_allow_html=True)
947
+
948
+ # Information about tracking
949
+ st.info(f"""
950
+ πŸ’‘ **Tracking Information**
951
+ You can track the progress of your {selected_course} course generation using the session IDs above.
952
+ The processing status will be updated in DynamoDB table: {SESSION_TABLE}
953
+ Region: {DYNAMODB_REGION}
954
+
955
+ πŸ‘‰ **Next Steps**: Switch to the "Admin Dashboard" to monitor your session progress in real-time!
956
+ """)
957
+
958
+ else:
959
+ st.error(f"❌ API Error: {response.status_code}")
960
+ if response.text:
961
+ st.error(f"**Error Details**: {response.text}")
962
+
963
+ except requests.exceptions.Timeout:
964
+ st.error("⏰ Request timed out. Please try again later.")
965
+ except requests.exceptions.ConnectionError:
966
+ st.error("🌐 Connection error. Please check your internet connection.")
967
+ except Exception as e:
968
+ st.error(f"❌ API call failed: {str(e)}")
969
+
970
+ # Show payload for debugging
971
+ with st.expander("πŸ› Debug Information", expanded=False):
972
+ st.warning("Request payload for debugging:")
973
+ st.json(payload)