Spaces:
Sleeping
Sleeping
Update ServFire.py
Browse files- ServFire.py +3 -10
ServFire.py
CHANGED
@@ -8,16 +8,9 @@ import streamlit as st
|
|
8 |
import fireworks.client
|
9 |
|
10 |
class WebSocketServer:
|
11 |
-
def __init__(self
|
12 |
-
self.host = host
|
13 |
-
self.port = port
|
14 |
self.server = None
|
15 |
|
16 |
-
db = sqlite3.connect('chat-hub.db')
|
17 |
-
cursor = db.cursor()
|
18 |
-
cursor.execute('CREATE TABLE IF NOT EXISTS messages (id INTEGER PRIMARY KEY AUTOINCREMENT, sender TEXT, message TEXT, timestamp TEXT)')
|
19 |
-
db.commit()
|
20 |
-
|
21 |
async def chatCompletion(self, question):
|
22 |
|
23 |
if "api_key" not in st.session_state:
|
@@ -113,11 +106,11 @@ class WebSocketServer:
|
|
113 |
except Exception as e:
|
114 |
print(f"Error: {e}")
|
115 |
|
116 |
-
async def start_server(self):
|
117 |
self.server = await websockets.serve(
|
118 |
self.handler,
|
119 |
self.host,
|
120 |
-
|
121 |
)
|
122 |
print(f"WebSocket server started at ws://{self.host}:{self.port}")
|
123 |
|
|
|
8 |
import fireworks.client
|
9 |
|
10 |
class WebSocketServer:
|
11 |
+
def __init__(self):
|
|
|
|
|
12 |
self.server = None
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
async def chatCompletion(self, question):
|
15 |
|
16 |
if "api_key" not in st.session_state:
|
|
|
106 |
except Exception as e:
|
107 |
print(f"Error: {e}")
|
108 |
|
109 |
+
async def start_server(self, serverPort):
|
110 |
self.server = await websockets.serve(
|
111 |
self.handler,
|
112 |
self.host,
|
113 |
+
serverPort
|
114 |
)
|
115 |
print(f"WebSocket server started at ws://{self.host}:{self.port}")
|
116 |
|