feat(ai): persist raw tool execution results in postgres to enable fine-tuning dataset extraction

This commit is contained in:
2026-05-16 11:59:46 -07:00
parent dfd799f046
commit f0d7548fe1
2 changed files with 38 additions and 6 deletions

View File

@@ -77,15 +77,23 @@ export default function SessionViewer() {
session_id: sessionId,
title: thread.title,
created_at: thread.createdAt,
messages: messages.map((m) => ({
messages: messages.map((m: any) => ({
role: m.role,
content:
m.content || (m.textSegments ? m.textSegments.join("\n\n") : ""),
tool_calls: m.toolCalls
? m.toolCalls.map((tc) => ({
name: tc.name,
arguments: tc.args,
}))
? m.toolCalls.map((tc: any) => {
const rawResult = m._rawToolResults?.find(
(tr: any) =>
tr.name === tc.name &&
JSON.stringify(tr.args) === JSON.stringify(tc.args),
)?.result;
return {
name: tc.name,
arguments: tc.args,
result: rawResult,
};
})
: undefined,
})),
};