agi-med-common 4.2.7__py3-none-any.whl → 4.2.9__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.
- agi_med_common/__init__.py +3 -3
- agi_med_common/models/chat_item/replica_item.py +1 -1
- agi_med_common/utils.py +19 -0
- {agi_med_common-4.2.7.dist-info → agi_med_common-4.2.9.dist-info}/METADATA +1 -1
- {agi_med_common-4.2.7.dist-info → agi_med_common-4.2.9.dist-info}/RECORD +7 -7
- {agi_med_common-4.2.7.dist-info → agi_med_common-4.2.9.dist-info}/WHEEL +0 -0
- {agi_med_common-4.2.7.dist-info → agi_med_common-4.2.9.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.2.
|
1
|
+
__version__ = "4.2.9"
|
2
2
|
|
3
3
|
from .logger import LogLevelEnum, logger_init, log_llm_error
|
4
4
|
from .models import (
|
@@ -13,9 +13,9 @@ from .models import (
|
|
13
13
|
ReplicaItemPair,
|
14
14
|
)
|
15
15
|
from .models.widget import Widget
|
16
|
-
from .file_storage import FileStorage
|
16
|
+
from .file_storage import FileStorage, ResourceId
|
17
17
|
from .models import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
18
|
-
from .utils import make_session_id, read_json
|
18
|
+
from .utils import make_session_id, read_json, try_parse_json, try_parse_int
|
19
19
|
from .validators import ExistingPath, ExistingFile, ExistingDir, StrNotEmpty, SecretStrNotEmpty, Prompt, Message
|
20
20
|
from .xml_parser import XMLParser
|
21
21
|
from .parallel_map import parallel_map
|
@@ -16,7 +16,7 @@ class ReplicaItem(_Base):
|
|
16
16
|
body: str = Field("", alias="Body", examples=["Привет"])
|
17
17
|
resource_id: str | None = Field(None, alias="ResourceId", examples=["<link-id>"])
|
18
18
|
widget: Widget | None = Field(None, alias="Widget", examples=[None])
|
19
|
-
command:
|
19
|
+
command: dict | None = Field(None, alias="Command", examples=[None])
|
20
20
|
role: bool = Field(False, alias="Role", description="True = ai, False = client", examples=[False])
|
21
21
|
date_time: str = Field(
|
22
22
|
_EXAMPLE_DATETIME,
|
agi_med_common/utils.py
CHANGED
@@ -12,3 +12,22 @@ def make_session_id() -> str:
|
|
12
12
|
def read_json(path: Path | os.PathLike[str] | str) -> list | dict:
|
13
13
|
with codecs.open(path, "r", encoding="utf8") as file:
|
14
14
|
return json.load(file)
|
15
|
+
|
16
|
+
|
17
|
+
def try_parse_json(text: str | None) -> str | None:
|
18
|
+
if not text:
|
19
|
+
return None
|
20
|
+
if not text.startswith('{'):
|
21
|
+
return None
|
22
|
+
if not text.endswith('}'):
|
23
|
+
return None
|
24
|
+
try:
|
25
|
+
return json.loads(text)
|
26
|
+
except Exception:
|
27
|
+
return None
|
28
|
+
|
29
|
+
def try_parse_int(text: str) -> int | None:
|
30
|
+
try:
|
31
|
+
return int(text)
|
32
|
+
except ValueError:
|
33
|
+
return None
|
@@ -1,7 +1,7 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=
|
1
|
+
agi_med_common/__init__.py,sha256=5KSML4nPmtbPIbePp_Cdjp0hPgVoRzVtQDMp8SnYHrM,708
|
2
2
|
agi_med_common/file_storage.py,sha256=4GW0CU0YtVzWmxV6vGjZg0DfyEgjlrgLRsZ7cEP-6Qk,1659
|
3
3
|
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
4
|
-
agi_med_common/utils.py,sha256=
|
4
|
+
agi_med_common/utils.py,sha256=42okDsaCIkxcBlBojyTOqPH1QUGkginjvgyPhSnRq9w,725
|
5
5
|
agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,2824
|
6
6
|
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
7
7
|
agi_med_common/logger/__init__.py,sha256=RW_0VZtbeJ4RsLqUXZUQWl5CtV9g840rU7qRlf5u49E,96
|
@@ -17,8 +17,8 @@ agi_med_common/models/chat_item/__init__.py,sha256=NG1optUYwjnxfpTXntUfTDOA0eKTg
|
|
17
17
|
agi_med_common/models/chat_item/chat_item.py,sha256=xP_uP14qK-u8z0ZUs2HFhhea-IP230UgOmjeqeC_N6Q,1180
|
18
18
|
agi_med_common/models/chat_item/inner_context_item.py,sha256=2wIwDtZwicwhSyXeuOqH8-xONcskeEiw6QhjSnEEwZs,329
|
19
19
|
agi_med_common/models/chat_item/outer_context_item.py,sha256=P2ulGbKnEXBJ50Ou-_p_qKCdO1lB4SUvdSu1ZG1yRdo,1213
|
20
|
-
agi_med_common/models/chat_item/replica_item.py,sha256=
|
21
|
-
agi_med_common-4.2.
|
22
|
-
agi_med_common-4.2.
|
23
|
-
agi_med_common-4.2.
|
24
|
-
agi_med_common-4.2.
|
20
|
+
agi_med_common/models/chat_item/replica_item.py,sha256=cGnAyUxNM50004EWKc8q4nYvy9cqZ8fxPdTilja6fBU,2013
|
21
|
+
agi_med_common-4.2.9.dist-info/METADATA,sha256=axCVcE7uged5BEl3_h_GSzNTlplY1Ed20rPr_vfC1fs,546
|
22
|
+
agi_med_common-4.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
agi_med_common-4.2.9.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
24
|
+
agi_med_common-4.2.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|