37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
|
|
import requests
|
|
|
|
|
|
class AIHandler(object):
|
|
def __init__(self):
|
|
pass
|
|
|
|
def __call__(self, text):
|
|
resp = requests.post("https://fast-pia.avemio.technology/chat-completion",
|
|
json={
|
|
"session-id": "chatcmpl",
|
|
"user-location": "Zweibrücken",
|
|
"wheel-of-life": [
|
|
{
|
|
"personal_growth": 10,
|
|
"health_exercise": 5,
|
|
"familiy_friends": 5,
|
|
"romance_relationship": 5,
|
|
"career_work": 5,
|
|
"finances": 5,
|
|
"recreation_fun": 5,
|
|
"living_situation": 5}
|
|
],
|
|
"messages": [
|
|
{
|
|
"role": "user",
|
|
"content": text
|
|
}
|
|
]
|
|
})
|
|
resp = resp.json()
|
|
return {
|
|
"text": resp[0]['text'],
|
|
"emotion": resp[0]['emotion']
|
|
}
|