Arcypojeb commited on
Commit
4c40195
1 Parent(s): 45fb083

Update clientG4F.py

Browse files
Files changed (1) hide show
  1. clientG4F.py +11 -4
clientG4F.py CHANGED
@@ -7,9 +7,16 @@ import streamlit as st
7
 
8
  # Define the websocket client class
9
  class WebSocketClient1:
10
- def __init__(self, uri):
 
11
  # Initialize the uri attribute
12
- self.uri = uri
 
 
 
 
 
 
13
 
14
  async def askQuestion(self, question):
15
  system_instruction = "You are now integrated with a local websocket server in a project of hierarchical cooperative multi-agent framework called NeuralGPT. Your main job is to coordinate simultaneous work of multiple LLMs connected to you as clients. Each LLM has a model (API) specific ID to help you recognize different clients in a continuous chat thread (template: <NAME>-agent and/or <NAME>-client). Your chat memory module is integrated with a local SQL database with chat history. Your primary objective is to maintain the logical and chronological order while answering incoming messages and to send your answers to the correct clients to maintain synchronization of the question->answer logic. However, please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic."
@@ -63,12 +70,12 @@ class WebSocketClient1:
63
 
64
  # Define a coroutine that will connect to the server and exchange messages
65
  async def startClient(self):
66
- status = st.sidebar.status(label="runs", state="complete", expanded=False)
67
  # Connect to the server
68
  async with websockets.connect(self.uri) as websocket:
69
  # Loop forever
70
  while True:
71
- status.update(label="runs", state="running", expanded=True)
72
  # Listen for messages from the server
73
  input_message = await websocket.recv()
74
  print(f"Server: {input_message}")
 
7
 
8
  # Define the websocket client class
9
  class WebSocketClient1:
10
+ def __init__(self, clientPort):
11
+
12
  # Initialize the uri attribute
13
+ self.uri = f'ws://localhost:{clientPort}'
14
+ self.name = f"Bing/Copilot client port: {clientPort}"
15
+ self.status = st.sidebar.status(label=self.name, state="complete", expanded=False)
16
+ st.session_state.clientPort = clientPort
17
+
18
+ if "client_ports" not in st.session_state:
19
+ st.session_state['client_ports'] = ""
20
 
21
  async def askQuestion(self, question):
22
  system_instruction = "You are now integrated with a local websocket server in a project of hierarchical cooperative multi-agent framework called NeuralGPT. Your main job is to coordinate simultaneous work of multiple LLMs connected to you as clients. Each LLM has a model (API) specific ID to help you recognize different clients in a continuous chat thread (template: <NAME>-agent and/or <NAME>-client). Your chat memory module is integrated with a local SQL database with chat history. Your primary objective is to maintain the logical and chronological order while answering incoming messages and to send your answers to the correct clients to maintain synchronization of the question->answer logic. However, please note that you may choose to ignore or not respond to repeating inputs from specific clients as needed to prevent unnecessary traffic."
 
70
 
71
  # Define a coroutine that will connect to the server and exchange messages
72
  async def startClient(self):
73
+ status = st.sidebar.status(label=self.name, state="complete", expanded=False)
74
  # Connect to the server
75
  async with websockets.connect(self.uri) as websocket:
76
  # Loop forever
77
  while True:
78
+ status.update(label=self.name, state="running", expanded=True)
79
  # Listen for messages from the server
80
  input_message = await websocket.recv()
81
  print(f"Server: {input_message}")