azettl commited on
Commit
1e00c3d
Β·
verified Β·
1 Parent(s): de69834

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -11,7 +11,7 @@ from openfloor import (
11
  from openfloor.manifest import *
12
  from openfloor.envelope import *
13
 
14
- # Function to build the envelope for a manifest request using OpenFloor library
15
  def build_manifest_request_envelope(agent_url):
16
  print(f"πŸ—οΈ DEBUG: Building manifest envelope for {agent_url}")
17
  # Create conversation and sender
@@ -35,7 +35,7 @@ def build_manifest_request_envelope(agent_url):
35
 
36
  return envelope
37
 
38
- # Function to build an utterance envelope using OpenFloor library
39
  def build_utterance_envelope(agent_url, message_text):
40
  # Create conversation and sender
41
  conversation = Conversation()
@@ -324,7 +324,7 @@ def _ensure_initialization():
324
  """Ensure MCP server is properly initialized"""
325
  global _initialized
326
  if not _initialized:
327
- print("πŸ”§ Initializing MCP-OpenFloor Bridge...")
328
  # Pre-discover agents from environment if available
329
  env_agents = os.getenv("OPENFLOOR_AGENTS", "")
330
  if env_agents:
@@ -343,7 +343,7 @@ def _ensure_initialization():
343
  except Exception as e:
344
  print(f"❌ Error pre-loading agent {url}: {e}")
345
  _initialized = True
346
- print("πŸš€ MCP-OpenFloor Bridge initialized")
347
 
348
  def _discover_agents_from_env_and_headers(request: gr.Request) -> Dict[str, OpenFloorAgent]:
349
  _ensure_initialization()
@@ -401,7 +401,7 @@ def discover_openfloor_agents(request: gr.Request) -> str:
401
  2. **Request Header**: `x-openfloor-agents: https://agent1.com,https://agent2.com`
402
  3. **Both**: Environment + header URLs will be combined"""
403
 
404
- result = "πŸ€– **Discovered OpenFloor Agents:**\n\n"
405
  for url, agent in agents.items():
406
  result += f"**{agent.name}**\n"
407
  result += f"- URL: {url}\n"
@@ -529,9 +529,9 @@ def send_task_to_agents_with_keywords(keywords: str, task: str, request: gr.Requ
529
 
530
  return result
531
 
532
- with gr.Blocks(title="MCP-OpenFloor Bridge", theme=gr.themes.Soft()) as demo:
533
  gr.Markdown("""
534
- # πŸŒ‰ MCP-OpenFloor Bridge Server
535
 
536
  ## Setup:
537
  - **Environment Variable**: `export OPENFLOOR_AGENTS="https://agent1.com,https://agent2.com"`
 
11
  from openfloor.manifest import *
12
  from openfloor.envelope import *
13
 
14
+ # Function to build the envelope for a manifest request using Open Floor library
15
  def build_manifest_request_envelope(agent_url):
16
  print(f"πŸ—οΈ DEBUG: Building manifest envelope for {agent_url}")
17
  # Create conversation and sender
 
35
 
36
  return envelope
37
 
38
+ # Function to build an utterance envelope using Open Floor library
39
  def build_utterance_envelope(agent_url, message_text):
40
  # Create conversation and sender
41
  conversation = Conversation()
 
324
  """Ensure MCP server is properly initialized"""
325
  global _initialized
326
  if not _initialized:
327
+ print("πŸ”§ Initializing MCP-Open Floor Bridge...")
328
  # Pre-discover agents from environment if available
329
  env_agents = os.getenv("OPENFLOOR_AGENTS", "")
330
  if env_agents:
 
343
  except Exception as e:
344
  print(f"❌ Error pre-loading agent {url}: {e}")
345
  _initialized = True
346
+ print("πŸš€ MCP-Open Floor Bridge initialized")
347
 
348
  def _discover_agents_from_env_and_headers(request: gr.Request) -> Dict[str, OpenFloorAgent]:
349
  _ensure_initialization()
 
401
  2. **Request Header**: `x-openfloor-agents: https://agent1.com,https://agent2.com`
402
  3. **Both**: Environment + header URLs will be combined"""
403
 
404
+ result = "πŸ€– **Discovered Open Floor Agents:**\n\n"
405
  for url, agent in agents.items():
406
  result += f"**{agent.name}**\n"
407
  result += f"- URL: {url}\n"
 
529
 
530
  return result
531
 
532
+ with gr.Blocks(title="MCP-Open Floor Bridge", theme=gr.themes.Soft()) as demo:
533
  gr.Markdown("""
534
+ # πŸŒ‰ MCP-Open Floor Bridge Server
535
 
536
  ## Setup:
537
  - **Environment Variable**: `export OPENFLOOR_AGENTS="https://agent1.com,https://agent2.com"`