changes
Browse files
app.py
CHANGED
@@ -112,13 +112,12 @@ def get_or_create_session_state(session_id: str) -> Dict:
|
|
112 |
"step_continue_event": threading.Event(),
|
113 |
"api_keys": {
|
114 |
"mistral": None,
|
115 |
-
"sambanova": None
|
116 |
-
"huggingface": None
|
117 |
}
|
118 |
}
|
119 |
return user_sessions[session_id]
|
120 |
|
121 |
-
def update_session_api_keys(mistral_key, sambanova_key,
|
122 |
"""Update API keys for THIS SESSION ONLY"""
|
123 |
session_id = get_session_id(request) if not session_id_state else session_id_state
|
124 |
session = get_or_create_session_state(session_id)
|
@@ -191,8 +190,7 @@ class VisualConsensusEngine:
|
|
191 |
# Store session keys for API calls
|
192 |
self.session_keys = {
|
193 |
'mistral': mistral_key,
|
194 |
-
'sambanova': sambanova_key
|
195 |
-
'huggingface': hf_token
|
196 |
}
|
197 |
|
198 |
# Role definitions
|
@@ -989,7 +987,7 @@ with gr.Blocks(title="🎭 Consilium: Visual AI Consensus Platform", theme=gr.th
|
|
989 |
# Connect the save button
|
990 |
save_keys_btn.click(
|
991 |
update_session_api_keys,
|
992 |
-
inputs=[mistral_key_input, sambanova_key_input,
|
993 |
outputs=[keys_status, session_state]
|
994 |
)
|
995 |
|
|
|
112 |
"step_continue_event": threading.Event(),
|
113 |
"api_keys": {
|
114 |
"mistral": None,
|
115 |
+
"sambanova": None
|
|
|
116 |
}
|
117 |
}
|
118 |
return user_sessions[session_id]
|
119 |
|
120 |
+
def update_session_api_keys(mistral_key, sambanova_key, session_id_state, request: gr.Request = None):
|
121 |
"""Update API keys for THIS SESSION ONLY"""
|
122 |
session_id = get_session_id(request) if not session_id_state else session_id_state
|
123 |
session = get_or_create_session_state(session_id)
|
|
|
190 |
# Store session keys for API calls
|
191 |
self.session_keys = {
|
192 |
'mistral': mistral_key,
|
193 |
+
'sambanova': sambanova_key
|
|
|
194 |
}
|
195 |
|
196 |
# Role definitions
|
|
|
987 |
# Connect the save button
|
988 |
save_keys_btn.click(
|
989 |
update_session_api_keys,
|
990 |
+
inputs=[mistral_key_input, sambanova_key_input, session_state],
|
991 |
outputs=[keys_status, session_state]
|
992 |
)
|
993 |
|