Arcypojeb commited on
Commit
45fb083
1 Parent(s): 415cd06

Update clientG4F2.py

Browse files
Files changed (1) hide show
  1. clientG4F2.py +11 -4
clientG4F2.py CHANGED
@@ -7,9 +7,16 @@ import streamlit as st
7
 
8
  # Define the websocket client class
9
  class WebSocketClient3:
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,8 +70,8 @@ class WebSocketClient3:
63
 
64
  # Define a coroutine that will connect to the server and exchange messages
65
  async def startClient(self):
66
- # Connect to the server
67
- status = st.sidebar.status(label="runs", state="complete", expanded=False)
68
  async with websockets.connect(self.uri) as websocket:
69
  # Loop forever
70
  while True:
 
7
 
8
  # Define the websocket client class
9
  class WebSocketClient3:
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
+
74
+ status = st.sidebar.status(label=self.name, state="complete", expanded=False)
75
  async with websockets.connect(self.uri) as websocket:
76
  # Loop forever
77
  while True: