Star/favorite an output log. Args: log_index: Index of the output log to star custom_name: Optional custom name for the starred output Returns: bool: True if output was starred successfully, False otherwise
(log_index: int, custom_name: str = "")
| 680 | |
| 681 | |
| 682 | def star_output(log_index: int, custom_name: str = "") -> bool: |
| 683 | """Star/favorite an output log. |
| 684 | |
| 685 | Args: |
| 686 | log_index: Index of the output log to star |
| 687 | custom_name: Optional custom name for the starred output |
| 688 | |
| 689 | Returns: |
| 690 | bool: True if output was starred successfully, False otherwise |
| 691 | """ |
| 692 | try: |
| 693 | if 0 <= log_index < len(st.session_state.output_logs): |
| 694 | log_entry = st.session_state.output_logs[log_index].copy() |
| 695 | log_entry["is_starred"] = True |
| 696 | log_entry["custom_name"] = ( |
| 697 | custom_name |
| 698 | or f"Starred Output #{len(st.session_state.starred_outputs) + 1}" |
| 699 | ) |
| 700 | |
| 701 | # Check if this output is already starred (by timestamp) |
| 702 | if not any( |
| 703 | s["timestamp"] == log_entry["timestamp"] |
| 704 | for s in st.session_state.starred_outputs |
| 705 | ): |
| 706 | st.session_state.starred_outputs.append(log_entry) |
| 707 | save_outputs() # Save after starring |
| 708 | return True |
| 709 | |
| 710 | return False |
| 711 | except Exception as e: |
| 712 | logger.error(f"Error starring output: {str(e)}") |
| 713 | return False |
| 714 | |
| 715 | |
| 716 | def unstar_output(log_index: int): |
no test coverage detected