n8cha commited on
Commit
d1c97dc
·
1 Parent(s): e29a008

add workaround for lack of request object in MCP runtime

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -57,7 +57,9 @@ def generate_prompt(request: gr.Request):
57
  The new system prompt.
58
  """
59
  try:
60
- session_id = request.session_hash
 
 
61
 
62
  # Read the system prompt from file
63
  system_prompt = os.environ.get("SYSTEM_PROMPT")
 
57
  The new system prompt.
58
  """
59
  try:
60
+ # Currently, gradio doesn't offer session/user tracking for MCP usage.
61
+ # https://www.gradio.app/guides/building-mcp-server-with-gradio#limitations
62
+ session_id = request.session_hash or "(unknown ID)"
63
 
64
  # Read the system prompt from file
65
  system_prompt = os.environ.get("SYSTEM_PROMPT")