Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ app = FastAPI()
|
|
36 |
async def read_root():
|
37 |
return {"Hello": "World!"}
|
38 |
|
39 |
-
def modelResp1(cookie,
|
40 |
messages = [
|
41 |
{"role": "system", "content": "You are a helpful assistant, Sia, developed by Sushma. You will response in polity and brief."},
|
42 |
{"role": "user", "content": "Who are you?"},
|
@@ -56,7 +56,7 @@ def modelResp1(cookie, id, token, prompt):
|
|
56 |
response = output['choices'][0]['text']
|
57 |
headers['Cookie'] = f"{cookie}"
|
58 |
payload['token'] = f"{token}"
|
59 |
-
payload['target'] = f"{
|
60 |
payload['content'] = response
|
61 |
requests.post(privateurl, headers=headers, data=payload)
|
62 |
|
@@ -103,11 +103,12 @@ def modelResp3(prompt):
|
|
103 |
|
104 |
@app.post("/modelapi1")
|
105 |
async def modelApi(data: dict):
|
106 |
-
|
107 |
cookie = data.get("Cookie")
|
108 |
token = data.get("token")
|
109 |
prompt = data.get("prompt")
|
110 |
-
modelResp1(cookie,
|
|
|
111 |
|
112 |
@app.post("/modelapi2")
|
113 |
async def modelApi(data: dict):
|
|
|
36 |
async def read_root():
|
37 |
return {"Hello": "World!"}
|
38 |
|
39 |
+
def modelResp1(cookie, target, token, prompt):
|
40 |
messages = [
|
41 |
{"role": "system", "content": "You are a helpful assistant, Sia, developed by Sushma. You will response in polity and brief."},
|
42 |
{"role": "user", "content": "Who are you?"},
|
|
|
56 |
response = output['choices'][0]['text']
|
57 |
headers['Cookie'] = f"{cookie}"
|
58 |
payload['token'] = f"{token}"
|
59 |
+
payload['target'] = f"{target}"
|
60 |
payload['content'] = response
|
61 |
requests.post(privateurl, headers=headers, data=payload)
|
62 |
|
|
|
103 |
|
104 |
@app.post("/modelapi1")
|
105 |
async def modelApi(data: dict):
|
106 |
+
target = data.get("target_id")
|
107 |
cookie = data.get("Cookie")
|
108 |
token = data.get("token")
|
109 |
prompt = data.get("prompt")
|
110 |
+
modelResp1(cookie, target, token, prompt)
|
111 |
+
return {"Hello": "World!"}
|
112 |
|
113 |
@app.post("/modelapi2")
|
114 |
async def modelApi(data: dict):
|