Spaces:
Sleeping
Sleeping
Rajan Sharma
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -228,7 +228,7 @@ def chat_fn(message, history, user_tz):
|
|
| 228 |
try:
|
| 229 |
# Identity override → return ONLY the brand line
|
| 230 |
if is_identity_query(message, history):
|
| 231 |
-
return "I am ClarityOps, your strategic decision making AI partner."
|
| 232 |
|
| 233 |
if USE_HOSTED_COHERE:
|
| 234 |
return cohere_chat(message, history)
|
|
@@ -276,14 +276,14 @@ def check_connection(user_tz=None):
|
|
| 276 |
# UI
|
| 277 |
# -------------------
|
| 278 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 279 |
-
# Hidden textbox to hold browser timezone (Gradio expects components
|
| 280 |
tz_box = gr.Textbox(visible=False)
|
| 281 |
|
| 282 |
-
# On load, capture browser timezone via JS and
|
| 283 |
demo.load(
|
| 284 |
-
fn=lambda tz: tz, # echo the JS value
|
| 285 |
-
inputs=
|
| 286 |
-
outputs=[tz_box], #
|
| 287 |
js="() => Intl.DateTimeFormat().resolvedOptions().timeZone"
|
| 288 |
)
|
| 289 |
|
|
@@ -310,8 +310,7 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 310 |
["What are common drug interactions with aspirin?", ""],
|
| 311 |
["What are the warning signs of diabetes?", ""],
|
| 312 |
],
|
| 313 |
-
cache_examples=True, #
|
| 314 |
-
examples_per_page=3,
|
| 315 |
)
|
| 316 |
|
| 317 |
# Wire timezone into the connection check as well
|
|
@@ -319,3 +318,4 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 319 |
|
| 320 |
if __name__ == "__main__":
|
| 321 |
demo.launch()
|
|
|
|
|
|
| 228 |
try:
|
| 229 |
# Identity override → return ONLY the brand line
|
| 230 |
if is_identity_query(message, history):
|
| 231 |
+
return "I am ClarityOps, your strategic decision making AI partner. How can I assist you?"
|
| 232 |
|
| 233 |
if USE_HOSTED_COHERE:
|
| 234 |
return cohere_chat(message, history)
|
|
|
|
| 276 |
# UI
|
| 277 |
# -------------------
|
| 278 |
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 279 |
+
# Hidden textbox to hold browser timezone (Gradio expects components for outputs)
|
| 280 |
tz_box = gr.Textbox(visible=False)
|
| 281 |
|
| 282 |
+
# On load, capture browser timezone via JS and write it into tz_box
|
| 283 |
demo.load(
|
| 284 |
+
fn=lambda tz: tz, # echo the JS value back to Python
|
| 285 |
+
inputs=[tz_box], # must provide 1 input for the lambda
|
| 286 |
+
outputs=[tz_box], # write result into the same hidden box
|
| 287 |
js="() => Intl.DateTimeFormat().resolvedOptions().timeZone"
|
| 288 |
)
|
| 289 |
|
|
|
|
| 310 |
["What are common drug interactions with aspirin?", ""],
|
| 311 |
["What are the warning signs of diabetes?", ""],
|
| 312 |
],
|
| 313 |
+
cache_examples=True, # show example chips on load
|
|
|
|
| 314 |
)
|
| 315 |
|
| 316 |
# Wire timezone into the connection check as well
|
|
|
|
| 318 |
|
| 319 |
if __name__ == "__main__":
|
| 320 |
demo.launch()
|
| 321 |
+
|