Paulhayes commited on
Commit
c47a5c8
·
verified ·
1 Parent(s): 372d356

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -2,6 +2,19 @@
2
  import os, sys, subprocess, importlib.util, importlib.machinery, types
3
  import sys # make sure this import is near the top of your file
4
  # near the other imports
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  try:
6
  import gradio as gr
7
  except Exception as e:
 
2
  import os, sys, subprocess, importlib.util, importlib.machinery, types
3
  import sys # make sure this import is near the top of your file
4
  # near the other imports
5
+ import os
6
+
7
+ # Defaults that work for both CLI and UI; can be overridden via env if you want
8
+ DEFAULT_EFFECTIVE_ROLE = os.getenv("EFFECTIVE_ROLE", "user")
9
+ DEFAULT_CALLER_ID_CLI = os.getenv("CALLER_ID_CLI", "cli")
10
+ DEFAULT_CALLER_ID_UI = os.getenv("CALLER_ID_UI", "ui")
11
+
12
+ def chat_once(hive: "Hive", text: str, *, role: str = DEFAULT_EFFECTIVE_ROLE, caller_id: str = DEFAULT_CALLER_ID_CLI):
13
+ """
14
+ Thin wrapper so all calls to Hive.chat() include the required args.
15
+ """
16
+ return hive.chat(text, effective_role=role, caller_id=caller_id)
17
+
18
  try:
19
  import gradio as gr
20
  except Exception as e: