edi-core 0.4.0__tar.gz → 0.6.0__tar.gz

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.

Files changed (26) hide show
  1. {edi_core-0.4.0 → edi_core-0.6.0}/PKG-INFO +2 -2
  2. edi_core-0.6.0/README.md +3 -0
  3. {edi_core-0.4.0 → edi_core-0.6.0}/pyproject.toml +1 -1
  4. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/ai/writesonic/__init__.py +2 -2
  5. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/ai/writesonic/chatsonic.py +11 -6
  6. edi_core-0.4.0/README.md +0 -2
  7. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/__init__.py +0 -0
  8. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/ai/__init__.py +0 -0
  9. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/algo/__init__.py +0 -0
  10. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/algo/silder_puzzle.py +0 -0
  11. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/auto/__init__.py +0 -0
  12. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/auto/control.py +0 -0
  13. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/cloud/__init__.py +0 -0
  14. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/cloud/aliyun.py +0 -0
  15. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/db/__init__.py +0 -0
  16. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/db/tinydb.py +0 -0
  17. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/file/__init__.py +0 -0
  18. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/file/file.py +0 -0
  19. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/file/filetype.py +0 -0
  20. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/file/hash.py +0 -0
  21. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/parser/__init__.py +0 -0
  22. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/parser/toml_parser.py +0 -0
  23. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/util/__init__.py +0 -0
  24. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/util/datetime.py +0 -0
  25. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/util/environment.py +0 -0
  26. {edi_core-0.4.0 → edi_core-0.6.0}/src/edi_core/util/pyproject.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edi-core
3
- Version: 0.4.0
3
+ Version: 0.6.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/)
@@ -0,0 +1,3 @@
1
+ # EDI
2
+
3
+ [PYPI](https://pypi.org/project/edi-core/)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "edi-core"
3
- version = "0.4.0"
3
+ version = "0.6.0"
4
4
  description = ""
5
5
  authors = ["LtttAZ <louis_zhang_1303@126.com>"]
6
6
  license = "MIT"
@@ -1,8 +1,8 @@
1
1
  WRITESONIC_BASE_URL = 'https://api.writesonic.com'
2
2
  CHATSONIC_URL_PATH = '/v2/business/content/chatsonic'
3
3
  WRITESONIC_ENGINE_PREMIUM = 'premium'
4
- WRITESONIC_ENGINE_SUPERIUM = 'superium'
5
- WRITESONIC_ENGINES = (WRITESONIC_ENGINE_PREMIUM, WRITESONIC_ENGINE_SUPERIUM)
4
+ WRITESONIC_ENGINE_SUPERIOR = 'superior'
5
+ WRITESONIC_ENGINES = (WRITESONIC_ENGINE_PREMIUM, WRITESONIC_ENGINE_SUPERIOR)
6
6
  WRITESONIC_LANGUAGE_ENGLISH = 'en'
7
7
  WRITESONIC_LANGUAGE_CHINESE = 'zh'
8
8
  WRITESONIC_LANGUAGES = (WRITESONIC_LANGUAGE_ENGLISH, WRITESONIC_LANGUAGE_CHINESE)
@@ -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 ChatSonicPayload:
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: ChatSonicPayload) -> (ChatSonicResponse, ChatSonicPayload):
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.__dict__,
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) -> (ChatSonicResponse, ChatSonicPayload):
94
- payload = ChatSonicPayload(input_text=message);
95
- 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)
96
101
  return self.call(payload)
97
102
 
98
103
  def get_request_headers(self):
edi_core-0.4.0/README.md DELETED
@@ -1,2 +0,0 @@
1
- # EDI
2
-