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