legion-llm 0.6.30 → 0.6.31
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/legion/llm/conversation_store.rb +23 -3
- data/lib/legion/llm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a2032854701a258fc788e3b3ef4cd495a2f031765c29775ed1486dd5eb8f35f
|
|
4
|
+
data.tar.gz: 62cd0ed1943b0730be9adb30c6c1b77308f10f9e223cfaea47f13d90b9794b6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e7a3f1e28c2af1d5cc3489a4bbe2592e7e019511920ad0c7c82943a0f444f36500d9707f6cda52f342a9af79922178bb5df249b1f53b477b52a9920ed856e9d
|
|
7
|
+
data.tar.gz: 69d8dc01c5c43a4fa7acfde15e81986e757670127fae2140b22ca77c4d8938ff0d1fa91a61d4c6664269ae147b26416c066ef57ab4fecbc86b605d8541c047c2
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.6.31] - 2026-04-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- `ConversationStore#db_append_message` — coerce multi-part content blocks (arrays of `{type:, text:}` hashes) to plain string before Sequel insert, preventing `PG::UndefinedColumn` errors
|
|
9
|
+
- `ConversationStore#next_seq` — fall back to DB max seq when in-memory message list is empty, preventing seq collisions after eviction or restart
|
|
10
|
+
|
|
5
11
|
## [0.6.30] - 2026-04-10
|
|
6
12
|
|
|
7
13
|
### Added
|
|
@@ -182,6 +182,16 @@ module Legion
|
|
|
182
182
|
|
|
183
183
|
def next_seq(conversation_id)
|
|
184
184
|
msgs = conversations[conversation_id][:messages]
|
|
185
|
+
if msgs.empty? && db_available?
|
|
186
|
+
begin
|
|
187
|
+
max = Legion::Data.connection[:conversation_messages]
|
|
188
|
+
.where(conversation_id: conversation_id)
|
|
189
|
+
.max(:seq)
|
|
190
|
+
return (max || 0) + 1
|
|
191
|
+
rescue StandardError
|
|
192
|
+
# fall through to default
|
|
193
|
+
end
|
|
194
|
+
end
|
|
185
195
|
msgs.empty? ? 1 : msgs.last[:seq] + 1
|
|
186
196
|
end
|
|
187
197
|
|
|
@@ -373,13 +383,23 @@ module Legion
|
|
|
373
383
|
end
|
|
374
384
|
|
|
375
385
|
def db_append_message(conversation_id, msg)
|
|
376
|
-
content
|
|
377
|
-
|
|
386
|
+
# Coerce content to plain string — content may arrive as an array of
|
|
387
|
+
# multi-part blocks (e.g. [{type: "text", text: "..."}]) which Sequel
|
|
388
|
+
# would misinterpret as a filter expression, causing PG::UndefinedColumn.
|
|
389
|
+
raw_content = msg[:content]
|
|
390
|
+
coerced_content = if raw_content.is_a?(Array)
|
|
391
|
+
raw_content.filter_map do |b|
|
|
392
|
+
b.is_a?(Hash) ? (b[:text] || b['text']) : b.to_s
|
|
393
|
+
end.join
|
|
394
|
+
else
|
|
395
|
+
raw_content.to_s
|
|
396
|
+
end
|
|
397
|
+
|
|
378
398
|
row = {
|
|
379
399
|
conversation_id: conversation_id,
|
|
380
400
|
seq: msg[:seq],
|
|
381
401
|
role: msg[:role].to_s,
|
|
382
|
-
content:
|
|
402
|
+
content: coerced_content,
|
|
383
403
|
provider: msg[:provider]&.to_s,
|
|
384
404
|
model: msg[:model]&.to_s,
|
|
385
405
|
input_tokens: msg[:input_tokens],
|
data/lib/legion/llm/version.rb
CHANGED