agi-med-common 5.1.2__py3-none-any.whl → 5.1.3__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 +1 -1
- agi_med_common/models/chat.py +27 -1
- {agi_med_common-5.1.2.dist-info → agi_med_common-5.1.3.dist-info}/METADATA +1 -1
- {agi_med_common-5.1.2.dist-info → agi_med_common-5.1.3.dist-info}/RECORD +6 -6
- {agi_med_common-5.1.2.dist-info → agi_med_common-5.1.3.dist-info}/WHEEL +0 -0
- {agi_med_common-5.1.2.dist-info → agi_med_common-5.1.3.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
agi_med_common/models/chat.py
CHANGED
@@ -112,7 +112,7 @@ def _get_widget(obj: Content) -> Widget | None:
|
|
112
112
|
return None
|
113
113
|
|
114
114
|
|
115
|
-
# todo fix: generalize functions
|
115
|
+
# todo fix: generalize functions _get_field
|
116
116
|
|
117
117
|
|
118
118
|
class BaseMessage(_Base):
|
@@ -214,7 +214,33 @@ class Chat(_Base):
|
|
214
214
|
return default
|
215
215
|
|
216
216
|
|
217
|
+
def make_content(
|
218
|
+
text: str | None = None,
|
219
|
+
*,
|
220
|
+
resource_id: str | None = None,
|
221
|
+
command: dict | None = None,
|
222
|
+
widget: Widget | None = None,
|
223
|
+
) -> Content:
|
224
|
+
resource_id = (resource_id or None) and {"type": "resource_id", "resource_id": resource_id}
|
225
|
+
command = (command or None) and {"type": "command", "command": command}
|
226
|
+
|
227
|
+
content = list(filter(None, [text, resource_id, command, widget]))
|
228
|
+
if len(content) == 0:
|
229
|
+
content = ""
|
230
|
+
elif len(content) == 1:
|
231
|
+
content = content[0]
|
232
|
+
|
233
|
+
return content
|
234
|
+
|
235
|
+
|
217
236
|
def convert_replica_item_to_message(replica: ReplicaItem) -> ChatMessage:
|
237
|
+
date_time = replica.date_time
|
238
|
+
content = make_content(
|
239
|
+
text=replica.body,
|
240
|
+
resource_id=replica.resource_id,
|
241
|
+
command=replica.command,
|
242
|
+
widget=replica.widget,
|
243
|
+
)
|
218
244
|
# legacy: eliminate after migration
|
219
245
|
resource_id = (replica.resource_id or None) and {"type": "resource_id", "resource_id": replica.resource_id}
|
220
246
|
body = replica.body
|
@@ -1,4 +1,4 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=
|
1
|
+
agi_med_common/__init__.py,sha256=E6mljKp3mSDWOYfFE1tPlPL-DrkuGH5TcEHIavj-N60,739
|
2
2
|
agi_med_common/api.py,sha256=gj6BPEAOvpT6GHWeE7bzmKIR-pvq0yORZ3L0ADvI8ps,1828
|
3
3
|
agi_med_common/file_storage.py,sha256=T0Hbs4W-pWO6HdWcmlVqABrQHYdq7lLZH4_Vu-YNVbw,1802
|
4
4
|
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
@@ -8,14 +8,14 @@ agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,
|
|
8
8
|
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
9
9
|
agi_med_common/models/__init__.py,sha256=dqr2kP-RuxFfAZhCr103PQzTVZFKIcdxyzTYiHhdTsE,375
|
10
10
|
agi_med_common/models/_base.py,sha256=qNdH8x3x3mYbo5XgWtR9VpEarxsEvXvzynadUlDvHmU,149
|
11
|
-
agi_med_common/models/chat.py,sha256=
|
11
|
+
agi_med_common/models/chat.py,sha256=fYG79Niemwc9NF9tIl3P4agmZIT-apEG4dlZtd_FmGI,11536
|
12
12
|
agi_med_common/models/chat_item.py,sha256=QlJ5Q40eX7lEeH9YBmdTH71ugrEtsU-4thkhD8cJhu0,5548
|
13
13
|
agi_med_common/models/enums.py,sha256=J-GNpql9MCnKnWiV9aJRQGI-pAybvV86923RZs99grA,1006
|
14
14
|
agi_med_common/models/tracks.py,sha256=UP-jeWqDiCK6dyoMDfs7hemgl_xsJKee_DApjBf-XYc,311
|
15
15
|
agi_med_common/models/widget.py,sha256=aJZ2vWx_PTFN02Wz16eokz9IIVrxqNuZYVDqLG36toE,710
|
16
16
|
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
17
17
|
agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
|
18
|
-
agi_med_common-5.1.
|
19
|
-
agi_med_common-5.1.
|
20
|
-
agi_med_common-5.1.
|
21
|
-
agi_med_common-5.1.
|
18
|
+
agi_med_common-5.1.3.dist-info/METADATA,sha256=XNJpGPJzRJQHdD-ZGvkB4FL19Zw-Q-KBk7b4TRNktQM,517
|
19
|
+
agi_med_common-5.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
20
|
+
agi_med_common-5.1.3.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
21
|
+
agi_med_common-5.1.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|