edi-core 0.4.0__py3-none-any.whl → 0.5.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 edi-core might be problematic. Click here for more details.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dataclasses
|
|
1
2
|
import os
|
|
2
3
|
from dataclasses import dataclass, field
|
|
3
4
|
from typing import List
|
|
@@ -29,7 +30,7 @@ class ChatSonicConfig:
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
@dataclass
|
|
32
|
-
class
|
|
33
|
+
class ChatSonicRequest:
|
|
33
34
|
@dataclass
|
|
34
35
|
class Message:
|
|
35
36
|
is_sent: bool
|
|
@@ -51,6 +52,9 @@ class ChatSonicPayload:
|
|
|
51
52
|
self.enable_memory = config.enable_memory
|
|
52
53
|
self.enable_google_results = config.enable_google_results
|
|
53
54
|
|
|
55
|
+
def to_dict(self):
|
|
56
|
+
return dataclasses.asdict(self)
|
|
57
|
+
|
|
54
58
|
|
|
55
59
|
@dataclass
|
|
56
60
|
class ChatSonicResponse:
|
|
@@ -72,14 +76,15 @@ class ChatSonic:
|
|
|
72
76
|
def __init__(self, config: ChatSonicConfig):
|
|
73
77
|
self._config = config
|
|
74
78
|
|
|
75
|
-
def call(self, payload:
|
|
79
|
+
def call(self, payload: ChatSonicRequest) -> (ChatSonicResponse, ChatSonicRequest):
|
|
76
80
|
url = self._config.get_request_url()
|
|
81
|
+
payload.set_config(self._config)
|
|
77
82
|
|
|
78
83
|
raw_response = self._session.post(
|
|
79
84
|
url=url,
|
|
80
85
|
headers=self.get_request_headers(),
|
|
81
86
|
params=self.get_request_params(),
|
|
82
|
-
json=payload.
|
|
87
|
+
json=payload.to_dict(),
|
|
83
88
|
timeout=60
|
|
84
89
|
)
|
|
85
90
|
|
|
@@ -90,9 +95,9 @@ class ChatSonic:
|
|
|
90
95
|
|
|
91
96
|
return response, payload
|
|
92
97
|
|
|
93
|
-
def chat(self, message: str) -> (
|
|
94
|
-
|
|
95
|
-
payload
|
|
98
|
+
def chat(self, message: str, history_data: List[ChatSonicRequest.Message] = []) -> (
|
|
99
|
+
ChatSonicResponse, ChatSonicRequest):
|
|
100
|
+
payload = ChatSonicRequest(input_text=message, history_data=history_data)
|
|
96
101
|
return self.call(payload)
|
|
97
102
|
|
|
98
103
|
def get_request_headers(self):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
edi_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
edi_core/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
edi_core/ai/writesonic/__init__.py,sha256=QCibWjBh4QqvUeJUscjByC-zHd__21J6jfTPJcWJxO8,412
|
|
4
|
-
edi_core/ai/writesonic/chatsonic.py,sha256=
|
|
4
|
+
edi_core/ai/writesonic/chatsonic.py,sha256=RHzmE2W_Oiomcn0YEo0v9t-F5SVQ-9bEOtk5tykBFHA,3239
|
|
5
5
|
edi_core/algo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
edi_core/algo/silder_puzzle.py,sha256=lyPvnL32VAsTghrz2WBsPMPJqnMeFxbBgSt4khfPNVI,586
|
|
7
7
|
edi_core/auto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -20,6 +20,6 @@ edi_core/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
20
20
|
edi_core/util/datetime.py,sha256=sctJzZw_Uruq-qp6IW_JuqZvcJq_fXDbTMpfEwkAPlg,117
|
|
21
21
|
edi_core/util/environment.py,sha256=rQmkKN5TWuhe-2NNGirQCeVW95dLz27pjeYDsB5yIII,175
|
|
22
22
|
edi_core/util/pyproject.py,sha256=3mdC-a6rqx9zlZUHeGyDIjz0EcT_TmTINRKLxYRvIac,325
|
|
23
|
-
edi_core-0.
|
|
24
|
-
edi_core-0.
|
|
25
|
-
edi_core-0.
|
|
23
|
+
edi_core-0.5.0.dist-info/METADATA,sha256=HKTLIY2IgW5tgKnUaipwL08Ez_W4IqN7pQQL5h4ESSc,918
|
|
24
|
+
edi_core-0.5.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
25
|
+
edi_core-0.5.0.dist-info/RECORD,,
|
|
File without changes
|