edi-core 0.3.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,4 +1,4 @@
1
- import json
1
+ import dataclasses
2
2
  import os
3
3
  from dataclasses import dataclass, field
4
4
  from typing import List
@@ -30,7 +30,7 @@ class ChatSonicConfig:
30
30
 
31
31
 
32
32
  @dataclass
33
- class ChatSonicPayload:
33
+ class ChatSonicRequest:
34
34
  @dataclass
35
35
  class Message:
36
36
  is_sent: bool
@@ -52,8 +52,8 @@ class ChatSonicPayload:
52
52
  self.enable_memory = config.enable_memory
53
53
  self.enable_google_results = config.enable_google_results
54
54
 
55
- def to_json(self):
56
- return json.dumps(self.__dict__)
55
+ def to_dict(self):
56
+ return dataclasses.asdict(self)
57
57
 
58
58
 
59
59
  @dataclass
@@ -76,14 +76,16 @@ class ChatSonic:
76
76
  def __init__(self, config: ChatSonicConfig):
77
77
  self._config = config
78
78
 
79
- def call(self, payload: ChatSonicPayload) -> (ChatSonicResponse, ChatSonicPayload):
79
+ def call(self, payload: ChatSonicRequest) -> (ChatSonicResponse, ChatSonicRequest):
80
80
  url = self._config.get_request_url()
81
+ payload.set_config(self._config)
81
82
 
82
83
  raw_response = self._session.post(
83
84
  url=url,
84
85
  headers=self.get_request_headers(),
85
86
  params=self.get_request_params(),
86
- data=payload.to_json()
87
+ json=payload.to_dict(),
88
+ timeout=60
87
89
  )
88
90
 
89
91
  raw_response.raise_for_status()
@@ -93,9 +95,9 @@ class ChatSonic:
93
95
 
94
96
  return response, payload
95
97
 
96
- def chat(self, message: str) -> ChatSonicPayload:
97
- payload = ChatSonicPayload(input_text=message);
98
- payload.set_config(self._config)
98
+ def chat(self, message: str, history_data: List[ChatSonicRequest.Message] = []) -> (
99
+ ChatSonicResponse, ChatSonicRequest):
100
+ payload = ChatSonicRequest(input_text=message, history_data=history_data)
99
101
  return self.call(payload)
100
102
 
101
103
  def get_request_headers(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edi-core
3
- Version: 0.3.0
3
+ Version: 0.5.0
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: LtttAZ
@@ -25,4 +25,4 @@ Description-Content-Type: text/markdown
25
25
 
26
26
  # EDI
27
27
 
28
-
28
+ [PYPI](https://pypi.org/project/edi-core/)
@@ -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=cmV1445v6cnvxY3kSkU5uLyLcPCHjWhvpEQ6zbfR9ug,3098
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.3.0.dist-info/METADATA,sha256=8vjVJGMonLuydRI4BB26XNrfgfVkDwRBDvPLnAQ4IH0,876
24
- edi_core-0.3.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
25
- edi_core-0.3.0.dist-info/RECORD,,
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,,