kshitijthakkar commited on
Commit
57ce3bd
·
1 Parent(s): fedc47d

feat: Add Gemini attribution header to all AI-generated insights

Browse files

- Created get_gemini_header() helper function with Gemini logo and branding
- Added header to leaderboard insights (generate_insights)
- Added header to trace debugging Q&A (ask_about_trace)
- Added header to run comparison insights (generate_ai_comparison)
- Added header to run analysis insights (generate_run_ai_insights)
- Added header to MCP cost estimation (estimate_job_cost_with_mcp_fallback)

All AI-powered insights now display:
"Analyzed by Gemini-2.5-flash" with Google Gemini logo

Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -71,6 +71,18 @@ from screens.mcp_helpers import (
71
  from utils.navigation import Navigator, Screen
72
 
73
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
  # Trace Detail handlers and helpers
76
 
@@ -735,7 +747,7 @@ def generate_insights():
735
  top_n=5
736
  )
737
 
738
- return insights
739
 
740
  except Exception as e:
741
  print(f"[ERROR] generate_insights: {e}")
@@ -776,7 +788,7 @@ def ask_about_trace(question: str) -> str:
776
  question=question
777
  )
778
 
779
- return answer
780
 
781
  except Exception as e:
782
  print(f"[ERROR] ask_about_trace: {e}")
@@ -848,7 +860,7 @@ def generate_ai_comparison(comparison_focus: str) -> str:
848
  comparison_focus=comparison_focus
849
  )
850
 
851
- return insights
852
 
853
  except Exception as e:
854
  print(f"[ERROR] generate_ai_comparison: {e}")
@@ -887,7 +899,7 @@ def generate_run_ai_insights(focus_area: str, max_rows: int) -> str:
887
  max_rows=max_rows
888
  )
889
 
890
- return insights
891
 
892
  except Exception as e:
893
  print(f"[ERROR] generate_run_ai_insights: {e}")
@@ -2676,6 +2688,8 @@ No historical data available for **{model}**.
2676
 
2677
  **🤖 Powered by MCP Server + Gemini 2.5 Pro**
2678
 
 
 
2679
  *This estimate was generated by AI analysis since no historical data is available for this model.*
2680
  {hardware_note}
2681
  ---
 
71
  from utils.navigation import Navigator, Screen
72
 
73
 
74
+ # Helper function for AI insights header
75
+ def get_gemini_header() -> str:
76
+ """
77
+ Returns HTML header showing Gemini attribution for AI-generated insights
78
+ """
79
+ return """<div style="font-family: sans-serif; font-size: 0.8rem; color: #6B7280; border-bottom: 1px solid #E5E7EB; padding-bottom: 8px; margin-bottom: 8px;">
80
+ Analyzed by <strong style="color: #111827;">Gemini-2.5-flash</strong>
81
+ <br><span style="font-size: 0.7rem;">Provider: Gemini <img src='https://upload.wikimedia.org/wikipedia/commons/d/d9/Google_Gemini_logo_2025.svg' alt='logo' width='220' style='vertical-align: middle;'></span>
82
+ </div>
83
+
84
+ """
85
+
86
 
87
  # Trace Detail handlers and helpers
88
 
 
747
  top_n=5
748
  )
749
 
750
+ return get_gemini_header() + insights
751
 
752
  except Exception as e:
753
  print(f"[ERROR] generate_insights: {e}")
 
788
  question=question
789
  )
790
 
791
+ return get_gemini_header() + answer
792
 
793
  except Exception as e:
794
  print(f"[ERROR] ask_about_trace: {e}")
 
860
  comparison_focus=comparison_focus
861
  )
862
 
863
+ return get_gemini_header() + insights
864
 
865
  except Exception as e:
866
  print(f"[ERROR] generate_ai_comparison: {e}")
 
899
  max_rows=max_rows
900
  )
901
 
902
+ return get_gemini_header() + insights
903
 
904
  except Exception as e:
905
  print(f"[ERROR] generate_run_ai_insights: {e}")
 
2688
 
2689
  **🤖 Powered by MCP Server + Gemini 2.5 Pro**
2690
 
2691
+ {get_gemini_header()}
2692
+
2693
  *This estimate was generated by AI analysis since no historical data is available for this model.*
2694
  {hardware_note}
2695
  ---