Rupali Ravindra Shetye commited on
Commit
68cab3b
Β·
1 Parent(s): 72f30cd

SECURITY: Completely remove API key section from settings page

Browse files
Files changed (1) hide show
  1. app/ui/pages/settings.py +4 -53
app/ui/pages/settings.py CHANGED
@@ -76,59 +76,10 @@ def render_settings():
76
  disabled=is_demo # Disable in demo
77
  )
78
 
79
- # API Settings - Hidden completely in demo mode
80
- if not is_demo:
81
- st.subheader("πŸ”‘ API Settings")
82
-
83
- groq_api_key = st.text_input(
84
- "Groq API Key",
85
- value=settings.GROQ_API_KEY,
86
- type="password",
87
- help="Get your API key from console.groq.com"
88
- )
89
-
90
- if st.button("πŸ’Ύ Save Settings", type="primary"):
91
- # Save settings to .env
92
- env_path = ".env"
93
- env_content = []
94
-
95
- # Read existing .env
96
- if os.path.exists(env_path):
97
- with open(env_path, "r") as f:
98
- env_content = f.readlines()
99
-
100
- # Update values
101
- updates = {
102
- "CHUNK_SIZE": str(chunk_size),
103
- "CHUNK_OVERLAP": str(chunk_overlap),
104
- "TOP_K": str(top_k),
105
- "EMBEDDING_MODEL": embedding_model,
106
- "GROQ_MODEL": llm_model,
107
- "GROQ_API_KEY": groq_api_key
108
- }
109
-
110
- updated_lines = []
111
- for line in env_content:
112
- key = line.split("=")[0].strip() if "=" in line else None
113
- if key in updates:
114
- updated_lines.append(f"{key}={updates[key]}\n")
115
- del updates[key]
116
- else:
117
- updated_lines.append(line)
118
-
119
- # Add new values
120
- for key, value in updates.items():
121
- updated_lines.append(f"{key}={value}\n")
122
-
123
- # Write back
124
- with open(env_path, "w") as f:
125
- f.writelines(updated_lines)
126
-
127
- st.success("βœ… Settings saved! Restart DocIntel for changes to take effect.")
128
- else:
129
- # Show masked API status in demo
130
- st.subheader("πŸ”‘ API Status")
131
- st.success("βœ… Groq API: **Connected** (Key hidden for security)")
132
 
133
  # Database Management - Disabled in demo
134
  st.divider()
 
76
  disabled=is_demo # Disable in demo
77
  )
78
 
79
+ # Show API status instead
80
+ st.subheader("πŸ”‘ API Status")
81
+ st.success("βœ… Groq API: **Connected**")
82
+ st.caption("API keys are stored securely as Hugging Face Secrets.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  # Database Management - Disabled in demo
85
  st.divider()