convoviz 0.1.3__py3-none-any.whl → 0.1.5__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.
- convoviz/models/_conversation.py +19 -11
- convoviz/models/_message.py +1 -16
- {convoviz-0.1.3.dist-info → convoviz-0.1.5.dist-info}/METADATA +1 -1
- {convoviz-0.1.3.dist-info → convoviz-0.1.5.dist-info}/RECORD +6 -6
- {convoviz-0.1.3.dist-info → convoviz-0.1.5.dist-info}/LICENSE +0 -0
- {convoviz-0.1.3.dist-info → convoviz-0.1.5.dist-info}/WHEEL +0 -0
convoviz/models/_conversation.py
CHANGED
|
@@ -5,7 +5,7 @@ object path : conversations.json -> conversation (one of the list items)
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
-
from datetime import datetime, timedelta
|
|
8
|
+
from datetime import datetime, timedelta
|
|
9
9
|
from os import utime as os_utime
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from typing import TYPE_CHECKING, Any, ClassVar
|
|
@@ -46,7 +46,7 @@ class Conversation(BaseModel):
|
|
|
46
46
|
plugin_ids: list[str] | None = None
|
|
47
47
|
conversation_id: str
|
|
48
48
|
conversation_template_id: str | None = None
|
|
49
|
-
id: str | None = None
|
|
49
|
+
id: str | None = None # noqa: A003
|
|
50
50
|
|
|
51
51
|
@classmethod
|
|
52
52
|
def update_configs(cls, configs: ConversationConfigs) -> None:
|
|
@@ -81,7 +81,7 @@ class Conversation(BaseModel):
|
|
|
81
81
|
return [
|
|
82
82
|
node
|
|
83
83
|
for node in self._all_message_nodes
|
|
84
|
-
if node.message and node.message.
|
|
84
|
+
if node.message and node.message.author.role in authors
|
|
85
85
|
]
|
|
86
86
|
|
|
87
87
|
@property
|
|
@@ -99,7 +99,7 @@ class Conversation(BaseModel):
|
|
|
99
99
|
"""List of all content types in the conversation (all branches)."""
|
|
100
100
|
return list(
|
|
101
101
|
{
|
|
102
|
-
node.message.content_type
|
|
102
|
+
node.message.content.content_type
|
|
103
103
|
for node in self._all_message_nodes
|
|
104
104
|
if node.message
|
|
105
105
|
},
|
|
@@ -123,7 +123,7 @@ class Conversation(BaseModel):
|
|
|
123
123
|
|
|
124
124
|
message = assistant_nodes[0].message
|
|
125
125
|
|
|
126
|
-
return message.
|
|
126
|
+
return message.metadata.model_slug if message else None
|
|
127
127
|
|
|
128
128
|
@property
|
|
129
129
|
def used_plugins(self) -> list[str]:
|
|
@@ -268,14 +268,22 @@ class Conversation(BaseModel):
|
|
|
268
268
|
@property
|
|
269
269
|
def month_start(self) -> datetime:
|
|
270
270
|
"""Return the first of the month the conversation was created in."""
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
return self.create_time.replace(
|
|
272
|
+
day=1,
|
|
273
|
+
hour=0,
|
|
274
|
+
minute=0,
|
|
275
|
+
second=0,
|
|
276
|
+
microsecond=0,
|
|
276
277
|
)
|
|
277
278
|
|
|
278
279
|
@property
|
|
279
280
|
def year_start(self) -> datetime:
|
|
280
281
|
"""Return the first of January of the year the conversation was created in."""
|
|
281
|
-
return
|
|
282
|
+
return self.create_time.replace(
|
|
283
|
+
month=1,
|
|
284
|
+
day=1,
|
|
285
|
+
hour=0,
|
|
286
|
+
minute=0,
|
|
287
|
+
second=0,
|
|
288
|
+
microsecond=0,
|
|
289
|
+
)
|
convoviz/models/_message.py
CHANGED
|
@@ -69,15 +69,10 @@ class Message(BaseModel):
|
|
|
69
69
|
"""Set the configuration for all messages."""
|
|
70
70
|
cls.__configs.update(configs)
|
|
71
71
|
|
|
72
|
-
@property
|
|
73
|
-
def author_role(self) -> AuthorRole:
|
|
74
|
-
"""Return the role of the author of the message."""
|
|
75
|
-
return self.author.role
|
|
76
|
-
|
|
77
72
|
@property
|
|
78
73
|
def header(self) -> str:
|
|
79
74
|
"""Get the title header of the message based on the configs."""
|
|
80
|
-
return self.__configs["author_headers"][self.
|
|
75
|
+
return self.__configs["author_headers"][self.author.role]
|
|
81
76
|
|
|
82
77
|
@property
|
|
83
78
|
def text(self) -> str:
|
|
@@ -92,13 +87,3 @@ class Message(BaseModel):
|
|
|
92
87
|
# this error caught some hidden bugs in the data. need more of these
|
|
93
88
|
err_msg = f"No valid content found in message: {self.id}"
|
|
94
89
|
raise ValueError(err_msg)
|
|
95
|
-
|
|
96
|
-
@property
|
|
97
|
-
def content_type(self) -> str:
|
|
98
|
-
"""Get the content type of the message."""
|
|
99
|
-
return self.content.content_type
|
|
100
|
-
|
|
101
|
-
@property
|
|
102
|
-
def model(self) -> str | None:
|
|
103
|
-
"""Get the model used for the message."""
|
|
104
|
-
return self.metadata.model_slug
|
|
@@ -37,13 +37,13 @@ convoviz/configuration.py,sha256=gsabIQt_oiLCGUFYaftcM55oIhgWm6O6PbUBwPu6B94,390
|
|
|
37
37
|
convoviz/data_analysis.py,sha256=OBnElm61pclK6DTFCKdrJHRoSiXTMyL7S8h_3TZ_0Ek,3551
|
|
38
38
|
convoviz/long_runs.py,sha256=lViUuD2aC-djfyzaw2iFprIiEhLaOhAcQQA1E7OD-EM,2676
|
|
39
39
|
convoviz/models/__init__.py,sha256=ui47MNe4qRhx2EFZpaeU3Qo32hFVrTOtMcUvKXbv4X0,261
|
|
40
|
-
convoviz/models/_conversation.py,sha256=
|
|
40
|
+
convoviz/models/_conversation.py,sha256=avhvc4FHex4s4jQ_A_c78MbqbtYSsUb-iLVjHvW1YtE,9015
|
|
41
41
|
convoviz/models/_conversation_set.py,sha256=0ngb3fcsy89YkYjRNIQSFpM326ZUu2u7gikPed91VC8,6600
|
|
42
|
-
convoviz/models/_message.py,sha256=
|
|
42
|
+
convoviz/models/_message.py,sha256=fqwGE4fQDvBfoFBWLK0_ITo5tOXFt7oDhvcmpQHqJag,2600
|
|
43
43
|
convoviz/models/_node.py,sha256=TEWtqIvfkTJA3uE9exwfO1ow7MeYGK8bzSTorXbigsM,2214
|
|
44
44
|
convoviz/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
45
|
convoviz/utils.py,sha256=EkEMS6y7OZEvREpzwjdq04PQm1wDEszk41gnuugCk6A,7078
|
|
46
|
-
convoviz-0.1.
|
|
47
|
-
convoviz-0.1.
|
|
48
|
-
convoviz-0.1.
|
|
49
|
-
convoviz-0.1.
|
|
46
|
+
convoviz-0.1.5.dist-info/LICENSE,sha256=LO6tqJjRNZIT4w4btugJrWzmwsxeZZcL3j7KV7qK_tM,1099
|
|
47
|
+
convoviz-0.1.5.dist-info/METADATA,sha256=mM3LFGolDM-_C2ue-0kQXV2wed15kH7AGuWggumr6_4,5458
|
|
48
|
+
convoviz-0.1.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
49
|
+
convoviz-0.1.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|