oneliai 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of oneliai might be problematic. Click here for more details.
- oneliai/client.py +7 -4
- {oneliai-0.1.0.dist-info → oneliai-0.2.0.dist-info}/METADATA +1 -1
- oneliai-0.2.0.dist-info/RECORD +8 -0
- oneliai-0.1.0.dist-info/RECORD +0 -8
- {oneliai-0.1.0.dist-info → oneliai-0.2.0.dist-info}/WHEEL +0 -0
- {oneliai-0.1.0.dist-info → oneliai-0.2.0.dist-info}/top_level.txt +0 -0
oneliai/client.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
URL="http://localhost:8085"
|
|
3
|
+
URL="https://apis.oneli.chat"
|
|
4
|
+
# URL="http://localhost:8085"
|
|
5
5
|
class AIClient:
|
|
6
6
|
def __init__(self, client_id, client_secret, base_url=f'{URL}/v1/strategy'):
|
|
7
7
|
self.client_id = client_id
|
|
@@ -23,10 +23,11 @@ class AIClient:
|
|
|
23
23
|
else:
|
|
24
24
|
raise Exception('Failed to get access token')
|
|
25
25
|
|
|
26
|
-
def generate_response(self, template_id, variables):
|
|
26
|
+
def generate_response(self, question,template_id, variables):
|
|
27
27
|
response = requests.post(
|
|
28
28
|
f'{self.base_url}/dynamic-response',
|
|
29
29
|
json={
|
|
30
|
+
'question':question,
|
|
30
31
|
'template_id': template_id,
|
|
31
32
|
'variables': variables
|
|
32
33
|
},
|
|
@@ -66,6 +67,7 @@ class AIClient:
|
|
|
66
67
|
if response.status_code == 200:
|
|
67
68
|
return response.json()
|
|
68
69
|
else:
|
|
70
|
+
|
|
69
71
|
raise Exception('Failed to start intention query')
|
|
70
72
|
|
|
71
73
|
def voc(self,productname,text):
|
|
@@ -95,7 +97,8 @@ class AIClient:
|
|
|
95
97
|
if response.status_code == 200:
|
|
96
98
|
return response.json()
|
|
97
99
|
else:
|
|
98
|
-
|
|
100
|
+
res=response.json()
|
|
101
|
+
raise Exception(f'Failed to start voc,reason:{res["error"]}')
|
|
99
102
|
|
|
100
103
|
# def registEndpoint(self, name,endpointpath):
|
|
101
104
|
# response = requests.post(
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
oneliai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
oneliai/client.py,sha256=Q-L6Ox8cbimMKWBn-bl1ouuPrlQwGaQHty4Vpeq7Xhg,5353
|
|
3
|
+
sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
sdk/client.py,sha256=FwUhqzY2DkRTloe_XMyaaaEzg7THaIV6OxPDliMQjq0,4267
|
|
5
|
+
oneliai-0.2.0.dist-info/METADATA,sha256=v1VOZKNBXJjcC77oaE1aq9vXrUUiDrPFTCP37MgvfjM,155
|
|
6
|
+
oneliai-0.2.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
7
|
+
oneliai-0.2.0.dist-info/top_level.txt,sha256=GqjKHlaU6NsCzFm5EOy-2oJoa3YStKZAX8qonkZqB1M,8
|
|
8
|
+
oneliai-0.2.0.dist-info/RECORD,,
|
oneliai-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
oneliai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
oneliai/client.py,sha256=-e3RToSTR2T54C06v9CG-6OH4fXZCvUg3svCbZ8tXC4,5237
|
|
3
|
-
sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
sdk/client.py,sha256=FwUhqzY2DkRTloe_XMyaaaEzg7THaIV6OxPDliMQjq0,4267
|
|
5
|
-
oneliai-0.1.0.dist-info/METADATA,sha256=iKDLgkW148wBs4EdcvJS9gCKtSZzPKBmesWZFa_v914,155
|
|
6
|
-
oneliai-0.1.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
7
|
-
oneliai-0.1.0.dist-info/top_level.txt,sha256=GqjKHlaU6NsCzFm5EOy-2oJoa3YStKZAX8qonkZqB1M,8
|
|
8
|
-
oneliai-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|