Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -269,30 +269,32 @@ with gr.Blocks(css=css) as demo:
|
|
269 |
|
270 |
|
271 |
def authorize_and_proceed(user, api_key):
|
272 |
-
|
273 |
-
gr.Info("Loading, please wait.")
|
274 |
-
messages_html, history = load_conversation(api_key)
|
275 |
|
|
|
276 |
return (
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
)
|
282 |
-
elif
|
|
|
|
|
283 |
return (
|
284 |
gr.update(visible=False),
|
285 |
-
gr.update(visible=
|
286 |
-
|
|
|
287 |
)
|
288 |
else:
|
289 |
-
gr.Warning("Incorrect userid/token")
|
290 |
return (
|
291 |
gr.update(visible=True),
|
292 |
-
gr.update(visible=False),
|
293 |
-
|
294 |
)
|
295 |
|
|
|
296 |
def save_custom_instructions(api_key, custom_instructions):
|
297 |
if api_key in sessions:
|
298 |
gr.Info("Instructions updated, we recommend to start the new conversation to make it more efficient.")
|
|
|
269 |
|
270 |
|
271 |
def authorize_and_proceed(user, api_key):
|
272 |
+
auth_result = authorize(user, api_key, PRIMARY_SYSTEM_INSTRUCTIONS)
|
|
|
|
|
273 |
|
274 |
+
if auth_result == 403:
|
275 |
return (
|
276 |
+
gr.update(visible=False),
|
277 |
+
gr.update(visible=False),
|
278 |
+
gr.update(visible=False),
|
279 |
+
gr.update(visible=True),
|
280 |
)
|
281 |
+
elif auth_result:
|
282 |
+
gr.Info("Loading, please wait.")
|
283 |
+
messages_html, history = load_conversation(api_key)
|
284 |
return (
|
285 |
gr.update(visible=False),
|
286 |
+
gr.update(visible=True),
|
287 |
+
messages_html,
|
288 |
+
history
|
289 |
)
|
290 |
else:
|
|
|
291 |
return (
|
292 |
gr.update(visible=True),
|
293 |
+
gr.update(visible=False),
|
294 |
+
gr.update(value="Invalid userid/token"),
|
295 |
)
|
296 |
|
297 |
+
|
298 |
def save_custom_instructions(api_key, custom_instructions):
|
299 |
if api_key in sessions:
|
300 |
gr.Info("Instructions updated, we recommend to start the new conversation to make it more efficient.")
|