feat(mcp): expose ai_summary in dbn_get_document response
LEFT JOIN doc_summaries so the document object includes ai_summary and summary_model alongside id/title. Returns null for docs not yet backfilled.
This commit is contained in:
+13
-2
@@ -18,7 +18,13 @@ try {
|
||||
|
||||
$ragDb = dbnToolsRagDb();
|
||||
|
||||
$docStmt = $ragDb->prepare("SELECT id, title FROM documents WHERE id = ? LIMIT 1");
|
||||
$docStmt = $ragDb->prepare("
|
||||
SELECT d.id, d.title, ds.summary AS ai_summary, ds.summary_model
|
||||
FROM documents d
|
||||
LEFT JOIN doc_summaries ds ON ds.document_id = d.id
|
||||
WHERE d.id = ?
|
||||
LIMIT 1
|
||||
");
|
||||
$docStmt->execute([$documentId]);
|
||||
$doc = $docStmt->fetch(PDO::FETCH_ASSOC);
|
||||
if (!$doc) {
|
||||
@@ -44,7 +50,12 @@ try {
|
||||
|
||||
echo json_encode([
|
||||
'ok' => true,
|
||||
'document' => ['id' => (int)$doc['id'], 'title' => (string)$doc['title']],
|
||||
'document' => [
|
||||
'id' => (int)$doc['id'],
|
||||
'title' => (string)$doc['title'],
|
||||
'ai_summary' => $doc['ai_summary'] ?? null,
|
||||
'summary_model' => $doc['summary_model'] ?? null,
|
||||
],
|
||||
'chunks' => $chunks,
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user