Skip to content

Commit 85645de

Browse files
committed
Updated Chatbot
1 parent d655207 commit 85645de

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

safe_infer_chatbot_app/safe_infer_chatbot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from typing import Dict, Any
66
import time
77

8+
9+
810
# Page configuration
911
st.set_page_config(
1012
page_title="SafeInfer LLM Chatbot",
@@ -98,8 +100,7 @@ def call_safe_infer_api(message: str, model: str, api_key: str = "") -> Dict[str
98100

99101
payload = {
100102
"model": model,
101-
"input": message,
102-
"app": "chatbot",
103+
"input": message
103104
}
104105

105106
try:

safe_infer_chatbot_app/utils.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,16 @@
22

33
import requests
44

5-
def get_proxima_cookie():
6-
try:
7-
proxima_url = f"{os.environ.get('PROXIMA_HOST')}/api/auth/login"
8-
headers = {
9-
'accept': 'application/json',
10-
'Content-Type': 'application/x-www-form-urlencoded'
11-
}
12-
data = {
13-
"username": os.environ.get("PROXIMA_USER_USERNAME"),
14-
"password": os.environ.get("PROXIMA_USER_PASSWORD")
15-
}
16-
response = requests.post(proxima_url, headers=headers, data=data)
17-
18-
response.raise_for_status()
19-
20-
token = response.headers['set-cookie'].split(';')[0]
21-
return token
22-
except Exception as e:
23-
print(f"Error getting proxima cookie: {e}")
24-
raise e
25-
26-
275

286
def get_available_models():
297
try:
30-
proxima_cookie = get_proxima_cookie()
318
headers = {
329
'accept': 'application/json',
10+
'Authorization': f"Bearer {os.environ.get('PEBBLO_API_KEY')}",
3311
'Content-Type': 'application/x-www-form-urlencoded',
34-
'Cookie': f"fastapiusersauth={proxima_cookie}"
3512
}
36-
response = requests.get(f"{os.environ.get('PROXIMA_HOST')}/api/llm/provider", headers=headers)
13+
url = f"{os.environ.get('PROXIMA_HOST')}/safe_infer/llm/provider/list"
14+
response = requests.get(url, headers=headers)
3715
response.raise_for_status()
3816
models = response.json()
3917
if len(models) == 0:

0 commit comments

Comments
 (0)