feat: final schema pass — sync 9 schema changes from main repo
- Rename nodes.content → nodes.notes across all services, tools, API routes, and UI - Add dimensions.icon column support (GET/POST routes, types) - Add nodes.event_date column (create/update flows, types) - Drop nodes.type and nodes.is_pinned references - Drop edges.user_feedback references - Drop chat_memory_state table (replaced with DROP IF EXISTS in migration) - Update schema guide files (system/schema.md) - Add runtime migration block in sqlite-client.ts for existing databases - Fix MCP tool schemas (external API keeps 'content' param, maps to 'notes' internally) - Update standalone MCP server (nodeService.js, sqlite-client.js, index.js) - Update HTTP MCP server (server.js, stdio-server.js) - Update all extraction tools (paper, website, youtube) - Update all UI components (FocusPanel, ThreePanelLayout, GridView, ListView, FolderViewOverlay) - TypeScript: 0 errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
1d323de11a
commit
86f43c9975
@@ -19,6 +19,7 @@ export async function GET() {
|
||||
SELECT
|
||||
d.name AS dimension,
|
||||
d.description,
|
||||
d.icon,
|
||||
d.is_priority AS isPriority,
|
||||
COALESCE(dc.count, 0) AS count
|
||||
FROM dimensions d
|
||||
@@ -31,6 +32,7 @@ export async function GET() {
|
||||
data: result.rows.map((row: any) => ({
|
||||
dimension: row.dimension,
|
||||
description: row.description,
|
||||
icon: row.icon || null,
|
||||
isPriority: Boolean(row.isPriority),
|
||||
count: Number(row.count)
|
||||
}))
|
||||
@@ -49,6 +51,7 @@ export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
const rawName = typeof body?.name === 'string' ? body.name.trim() : '';
|
||||
const description = typeof body?.description === 'string' ? body.description.trim() : null;
|
||||
const icon = typeof body?.icon === 'string' ? body.icon.trim() : null;
|
||||
const isPriority = typeof body?.isPriority === 'boolean' ? body.isPriority : false;
|
||||
|
||||
if (!rawName) {
|
||||
@@ -67,14 +70,15 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
const sqlite = getSQLiteClient();
|
||||
const result = sqlite.query(`
|
||||
INSERT INTO dimensions(name, description, is_priority, updated_at)
|
||||
VALUES (?, ?, ?, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT(name) DO UPDATE SET
|
||||
INSERT INTO dimensions(name, description, icon, is_priority, updated_at)
|
||||
VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP)
|
||||
ON CONFLICT(name) DO UPDATE SET
|
||||
description = COALESCE(?, description),
|
||||
icon = COALESCE(?, icon),
|
||||
is_priority = COALESCE(?, is_priority),
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
RETURNING name, description, is_priority
|
||||
`, [rawName, description, isPriority ? 1 : 0, description, isPriority ? 1 : 0]);
|
||||
RETURNING name, description, icon, is_priority
|
||||
`, [rawName, description, icon, isPriority ? 1 : 0, description, icon, isPriority ? 1 : 0]);
|
||||
|
||||
if (result.rows.length === 0) {
|
||||
throw new Error('Failed to create dimension');
|
||||
|
||||
@@ -134,7 +134,7 @@ function createRAHServer(): McpServer {
|
||||
id: node.id,
|
||||
title: node.title,
|
||||
description: node.description ?? null,
|
||||
content: node.content ?? null,
|
||||
notes: node.notes ?? null,
|
||||
link: node.link ?? null,
|
||||
dimensions: node.dimensions || [],
|
||||
metadata: node.metadata || {},
|
||||
|
||||
@@ -85,10 +85,10 @@ export async function POST(
|
||||
// Generate new description using the description service
|
||||
const newDescription = await generateDescription({
|
||||
title: node.title,
|
||||
content: node.content || undefined,
|
||||
notes: node.notes || undefined,
|
||||
link: node.link || undefined,
|
||||
metadata: enrichedMetadata,
|
||||
type: enrichedMetadata?.type,
|
||||
|
||||
dimensions: node.dimensions || []
|
||||
});
|
||||
|
||||
|
||||
@@ -68,16 +68,11 @@ export async function PUT(
|
||||
}, { status: 404 });
|
||||
}
|
||||
|
||||
if (body && Object.prototype.hasOwnProperty.call(body, 'is_pinned')) {
|
||||
console.warn(`[nodes/${nodeId}] Ignoring legacy is_pinned payload`);
|
||||
delete body.is_pinned;
|
||||
}
|
||||
|
||||
const updates: Record<string, unknown> = { ...body };
|
||||
let shouldQueueEmbed = false;
|
||||
|
||||
const incomingChunk = typeof body.chunk === 'string' ? body.chunk : undefined;
|
||||
const incomingContent = typeof body.content === 'string' ? body.content : undefined;
|
||||
const incomingNotes = typeof body.notes === 'string' ? body.notes : undefined;
|
||||
const existingChunk = existingNode.chunk ?? '';
|
||||
|
||||
if (incomingChunk !== undefined) {
|
||||
@@ -92,8 +87,8 @@ export async function PUT(
|
||||
} else {
|
||||
delete updates.chunk_status;
|
||||
}
|
||||
} else if (!existingChunk.trim() && hasSufficientContent(incomingContent)) {
|
||||
updates.chunk = incomingContent;
|
||||
} else if (!existingChunk.trim() && hasSufficientContent(incomingNotes)) {
|
||||
updates.chunk = incomingNotes;
|
||||
updates.chunk_status = 'not_chunked';
|
||||
shouldQueueEmbed = true;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export async function POST(request: NextRequest) {
|
||||
}, { status: 400 });
|
||||
}
|
||||
|
||||
const rawContent = typeof body.content === 'string' ? body.content : null;
|
||||
const rawNotes = typeof body.notes === 'string' ? body.notes : null;
|
||||
|
||||
// Process provided dimensions first (needed for description generation)
|
||||
const providedDimensions = Array.isArray(body.dimensions) ? body.dimensions : [];
|
||||
@@ -74,10 +74,9 @@ export async function POST(request: NextRequest) {
|
||||
try {
|
||||
nodeDescription = await generateDescription({
|
||||
title: body.title,
|
||||
content: rawContent || undefined,
|
||||
notes: rawNotes || undefined,
|
||||
link: body.link || undefined,
|
||||
metadata: body.metadata,
|
||||
type: body.type,
|
||||
dimensions: trimmedProvidedDimensions
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -88,7 +87,7 @@ export async function POST(request: NextRequest) {
|
||||
// Auto-assign locked dimensions + keyword dimensions for all new nodes
|
||||
const { locked, keywords } = await DimensionService.assignDimensions({
|
||||
title: body.title,
|
||||
content: rawContent || undefined,
|
||||
notes: rawNotes || undefined,
|
||||
link: body.link,
|
||||
description: nodeDescription
|
||||
});
|
||||
@@ -107,15 +106,15 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
if (chunkToStore && chunkToStore.trim().length > 0) {
|
||||
chunkStatus = 'not_chunked';
|
||||
} else if (!chunkToStore && hasSufficientContent(rawContent)) {
|
||||
chunkToStore = rawContent;
|
||||
} else if (!chunkToStore && hasSufficientContent(rawNotes)) {
|
||||
chunkToStore = rawNotes;
|
||||
chunkStatus = 'not_chunked';
|
||||
}
|
||||
|
||||
const node = await nodeService.createNode({
|
||||
title: body.title,
|
||||
description: nodeDescription,
|
||||
content: rawContent ?? undefined,
|
||||
notes: rawNotes ?? undefined,
|
||||
link: body.link,
|
||||
dimensions: finalDimensions,
|
||||
chunk: chunkToStore ?? undefined,
|
||||
|
||||
Reference in New Issue
Block a user