macadeliccc commited on
Commit
2aae303
·
1 Parent(s): 0e4adfe
Files changed (1) hide show
  1. app.py +1 -14
app.py CHANGED
@@ -24,17 +24,8 @@ def start_ochat_server():
24
  except Exception as e:
25
  return f"Failed to start ochat server: {e}"
26
 
27
- start_ochat_server()
28
-
29
-
30
 
31
- # Function to check if the server is up
32
- def is_server_up(url):
33
- try:
34
- response = requests.get(url)
35
- return response.status_code == 200
36
- except requests.RequestException:
37
- return False
38
 
39
  # Function to send a message to the ochat server and get a response
40
  def chat_with_ochat(message):
@@ -46,10 +37,6 @@ def chat_with_ochat(message):
46
  "messages": [{"role": "user", "content": message}]
47
  }
48
 
49
- # Check if server is up
50
- if not is_server_up(base_url):
51
- return "Error: oChat server is not running."
52
-
53
  try:
54
  response = requests.post(chat_url, json=data, headers=headers)
55
  if response.status_code == 200:
 
24
  except Exception as e:
25
  return f"Failed to start ochat server: {e}"
26
 
 
 
 
27
 
28
+ start_ochat_server()
 
 
 
 
 
 
29
 
30
  # Function to send a message to the ochat server and get a response
31
  def chat_with_ochat(message):
 
37
  "messages": [{"role": "user", "content": message}]
38
  }
39
 
 
 
 
 
40
  try:
41
  response = requests.post(chat_url, json=data, headers=headers)
42
  if response.status_code == 200: