feat(ai): persist raw tool execution results in postgres to enable fine-tuning dataset extraction
This commit is contained in:
@@ -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,
|
||||
})),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user