mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-12-03 03:29:51 +00:00
perf(devin): read only the metadata fields the parser uses (#1726)
The sessions.db query returned each message's whole metadata blob and parsed it in JS (617 MB on a real store) to use five fields. The query now builds an object of just those fields; a missing or non-object metadata still comes back NULL.
This commit is contained in:
parent
02dff282a8
commit
e7c67a6695
1 changed files with 7 additions and 1 deletions
|
|
@ -649,7 +649,13 @@ class DevinDbSessionParser implements SessionParser {
|
|||
const rows = db.query<MessageNodeRow>(
|
||||
`SELECT node_id, parent_node_id,
|
||||
json_extract(chat_message, '$.role') AS role,
|
||||
json_extract(chat_message, '$.metadata') AS metadata,
|
||||
CASE WHEN json_type(chat_message, '$.metadata') = 'object'
|
||||
THEN json_object(
|
||||
'created_at', chat_message -> '$.metadata.created_at',
|
||||
'generation_model', chat_message -> '$.metadata.generation_model',
|
||||
'is_user_input', chat_message -> '$.metadata.is_user_input',
|
||||
'request_id', chat_message -> '$.metadata.request_id',
|
||||
'metrics', chat_message -> '$.metadata.metrics') END AS metadata,
|
||||
(SELECT json_group_array(json_extract(value, '$.name'))
|
||||
FROM json_each(chat_message, '$.tool_calls')) AS tool_names,
|
||||
CASE WHEN json_extract(chat_message, '$.role') = 'user'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue