- Extract redeliver_missed(tx, db, log) helper into cluster_transport.rs - heal_region now removes partition then immediately ships any missed batch-log entries to the healed follower's channel - await_convergence refactored to call the same helper (no logic change) - tidal-server: reload_text_index before search in cluster mode - tidal-server: write_signal returns Result instead of panicking on unknown signal - tidal-server: leader shows lag_events=0 (writes directly, no receiver thread) - tidal-server: fix cluster mode error propagation (ServerError::from) - docs/runbooks/cluster.md: add full cluster operations runbook - docker/: add Dockerfile for containerised cluster deployment - README.md: add tidal-server HTTP API getting-started section - Split oversized source files per CODING_GUIDELINES §9 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 lines
1009 B
TypeScript
33 lines
1009 B
TypeScript
import { getMessages } from "@/lib/synap";
|
|
import type { ChatMessage } from "@/lib/types";
|
|
|
|
export async function GET(
|
|
_req: Request,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
const { id } = await params;
|
|
|
|
try {
|
|
const data = await getMessages(id, 100);
|
|
|
|
const messages: ChatMessage[] = (data.messages ?? []).map((m) => ({
|
|
id: m.id,
|
|
role: m.user_id === "aeries" ? ("assistant" as const) : ("user" as const),
|
|
content: m.content,
|
|
timestamp: new Date(m.timestamp).getTime(),
|
|
}));
|
|
|
|
// Synap returns newest-first; reverse for chronological order
|
|
messages.reverse();
|
|
|
|
return Response.json({ messages });
|
|
} catch (err) {
|
|
const msg = err instanceof Error ? err.message : String(err);
|
|
// Log the actual error so Synap outages are visible in server logs
|
|
if (!msg.includes("404")) {
|
|
console.error(`[synap] failed to load messages for conversation ${id.slice(0, 8)}…: ${msg}`);
|
|
}
|
|
return Response.json({ messages: [] });
|
|
}
|
|
}
|