fix(vault,conversations): the envelope diff drops query blocks and frontmatter, history hands the envelope apart from the user's words
This commit is contained in:
1 parent
1d1285de46
commit
65564d8541
5 files changed
+139
-10
No files matched your search
@@ -164,9 +164,9 @@ def build_entries(
|
||||
|
||||
|
||||
def messages_from_entries(
|
||||
entries: Iterable[Mapping[str, Any]], *, with_ts: bool = False
|
||||
entries: Iterable[Mapping[str, Any]], *, stamped: bool = False
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Messages as the model saw them; ``with_ts`` adds when each one was written."""
|
||||
"""Messages as the model saw them; ``stamped`` adds each one's entry id and time."""
|
||||
out: list[dict[str, Any]] = []
|
||||
last_message_id: str | None = None
|
||||
for entry in entries:
|
||||
@@ -189,7 +189,8 @@ def messages_from_entries(
|
||||
"role": "user",
|
||||
"content": _user_content(content),
|
||||
}
|
||||
if with_ts:
|
||||
if stamped:
|
||||
message_out["id"] = entry.get("uuid")
|
||||
message_out["ts"] = entry.get("timestamp")
|
||||
out.append(message_out)
|
||||
last_message_id = None
|
||||
@@ -205,7 +206,8 @@ def messages_from_entries(
|
||||
out[-1]["content"].extend(blocks)
|
||||
else:
|
||||
message_out: dict[str, Any] = {"role": "assistant", "content": blocks}
|
||||
if with_ts:
|
||||
if stamped:
|
||||
message_out["id"] = entry.get("uuid")
|
||||
message_out["ts"] = entry.get("timestamp")
|
||||
out.append(message_out)
|
||||
last_message_id = message_id
|
||||
|
||||
Reference in new issue
Block a user