Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function POST(request: NextRequest) {
}

try {
const { ids } = (await request.json()) as { ids: number[] };
const { ids } = (await request.json()) as { ids: string[] };
if (!Array.isArray(ids) || ids.length === 0) {
return NextResponse.json({ error: "No IDs provided" }, { status: 400 });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export async function POST(request: NextRequest) {
try {
const { action, thought_id_a, thought_id_b } = (await request.json()) as {
action: "keep_a" | "keep_b" | "keep_both";
thought_id_a: number;
thought_id_b: number;
thought_id_a: string;
thought_id_b: string;
};

if (!thought_id_a || !thought_id_b) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export async function POST(request: NextRequest) {
const body = await request.json();
const { thoughtId } = body;

if (!thoughtId || typeof thoughtId !== "number") {
if (!thoughtId || typeof thoughtId !== "string") {
return NextResponse.json(
{ error: "thoughtId (number) is required" },
{ error: "thoughtId (string) is required" },
{ status: 400 }
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export async function POST(request: NextRequest) {
const body = await request.json();
const { thoughtId, status, importance, content, type } = body;

if (!thoughtId || typeof thoughtId !== "number") {
if (!thoughtId || typeof thoughtId !== "string") {
return NextResponse.json(
{ error: "thoughtId (number) is required" },
{ error: "thoughtId (string) is required" },
{ status: 400 }
);
}
Expand Down
4 changes: 2 additions & 2 deletions dashboards/open-brain-dashboard-next/app/audit/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Thought, BrowseResponse } from "@/lib/types";

export default function AuditPage() {
const [data, setData] = useState<BrowseResponse | null>(null);
const [selected, setSelected] = useState<Set<number>>(new Set());
const [selected, setSelected] = useState<Set<string>>(new Set());
const [page, setPage] = useState(1);
const [loading, setLoading] = useState(true);
const [showDelete, setShowDelete] = useState(false);
Expand All @@ -33,7 +33,7 @@ export default function AuditPage() {
load();
}, [load]);

const toggleSelect = (id: number) => {
const toggleSelect = (id: string) => {
setSelected((prev) => {
const next = new Set(prev);
if (next.has(id)) next.delete(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default async function ThoughtDetailPage({
const { apiKey } = await requireSessionOrRedirect();
const session = await getSession();
const excludeRestricted = !session.restrictedUnlocked;
const { id } = await params;
const thoughtId = parseInt(id, 10);
if (isNaN(thoughtId)) notFound();
const { id: thoughtId } = await params;

let thought;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TypeBadge } from "./ThoughtCard";
import { FormattedDate } from "./FormattedDate";

interface Connection {
id: number;
id: string;
type: string;
importance: number;
preview: string;
Expand All @@ -23,7 +23,7 @@ export function ConnectionsPanel({
thoughtId,
hasMetadata,
}: {
thoughtId: number;
thoughtId: string;
hasMetadata: boolean;
}) {
const [connections, setConnections] = useState<Connection[]>([]);
Expand Down
12 changes: 6 additions & 6 deletions dashboards/open-brain-dashboard-next/components/KanbanBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { KanbanCardModal } from "@/components/KanbanCardModal";
const AUTO_ARCHIVE_DAYS = 30;

async function apiUpdateKanban(
thoughtId: number,
thoughtId: string,
updates: Record<string, unknown>
): Promise<void> {
const res = await fetch("/api/kanban/update", {
Expand Down Expand Up @@ -112,7 +112,7 @@ export function KanbanBoard() {
const { active, over } = event;
if (!over) return;

const thoughtId = active.id as number;
const thoughtId = active.id as string;
const newStatus = over.id as string;

// Find which column the thought is currently in
Expand All @@ -138,7 +138,7 @@ export function KanbanBoard() {
});
}

async function handlePriorityChange(thoughtId: number, newImportance: number) {
async function handlePriorityChange(thoughtId: string, newImportance: number) {
previousThoughts.current = [...thoughts];
setThoughts((prev) =>
prev.map((t) =>
Expand All @@ -155,7 +155,7 @@ export function KanbanBoard() {
}
}

async function handleArchive(thoughtId: number) {
async function handleArchive(thoughtId: string) {
previousThoughts.current = [...thoughts];
setThoughts((prev) =>
prev.map((t) =>
Expand All @@ -174,7 +174,7 @@ export function KanbanBoard() {
}
}

async function handleDelete(thoughtId: number) {
async function handleDelete(thoughtId: string) {
previousThoughts.current = [...thoughts];
setThoughts((prev) => prev.filter((t) => t.id !== thoughtId));

Expand All @@ -193,7 +193,7 @@ export function KanbanBoard() {
}

async function handleModalSave(
thoughtId: number,
thoughtId: string,
updates: Record<string, unknown>
) {
previousThoughts.current = [...thoughts];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function formatAge(dateString: string): string {
interface KanbanCardProps {
thought: Thought;
onCardClick: (thought: Thought) => void;
onPriorityChange: (thoughtId: number, importance: number) => void;
onPriorityChange: (thoughtId: string, importance: number) => void;
showArchiveButton?: boolean;
onArchive?: (thoughtId: number) => void;
onArchive?: (thoughtId: string) => void;
}

export function KanbanCard({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { KANBAN_STATUSES, KANBAN_LABELS, PRIORITY_LEVELS, getPriorityLevel, THOU
interface KanbanCardModalProps {
thought: Thought;
onSave: (
thoughtId: number,
thoughtId: string,
updates: { content?: string; status?: string; importance?: number; type?: string }
) => void;
onArchive: (thoughtId: number) => void;
onDelete: (thoughtId: number) => void;
onArchive: (thoughtId: string) => void;
onDelete: (thoughtId: string) => void;
onClose: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ interface KanbanColumnProps {
status: string;
thoughts: Thought[];
onCardClick: (thought: Thought) => void;
onPriorityChange: (thoughtId: number, importance: number) => void;
onArchive: (thoughtId: number) => void;
onPriorityChange: (thoughtId: string, importance: number) => void;
onArchive: (thoughtId: string) => void;
}

export function KanbanColumn({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const emptyForm: ReflectionInput = {
reflection_type: "decision_trace",
};

export function ReflectionComposer({ thoughtId }: { thoughtId: number }) {
export function ReflectionComposer({ thoughtId }: { thoughtId: string }) {
const [open, setOpen] = useState(false);
const [form, setForm] = useState<ReflectionInput>({ ...emptyForm });
const [submitting, setSubmitting] = useState(false);
Expand Down
14 changes: 7 additions & 7 deletions dashboards/open-brain-dashboard-next/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function fetchThoughts(

export async function fetchThought(
apiKey: string,
id: number,
id: string,
excludeRestricted: boolean = true
): Promise<Thought> {
const qs = excludeRestricted ? "" : "?exclude_restricted=false";
Expand All @@ -82,10 +82,10 @@ export async function fetchThought(

export async function updateThought(
apiKey: string,
id: number,
id: string,
data: { content?: string; type?: string; importance?: number; status?: string | null }
): Promise<{ id: number; action: string; message: string }> {
return apiFetch<{ id: number; action: string; message: string }>(
): Promise<{ id: string; action: string; message: string }> {
return apiFetch<{ id: string; action: string; message: string }>(
apiKey,
`/thought/${id}`,
{
Expand Down Expand Up @@ -136,7 +136,7 @@ export async function fetchDuplicates(

export async function deleteThought(
apiKey: string,
id: number
id: string
): Promise<void> {
const url = `${API_URL}/thought/${id}`;
const res = await fetch(url, {
Expand Down Expand Up @@ -186,7 +186,7 @@ export async function fetchStats(
}

export interface CaptureResult {
thought_id: number;
thought_id: string;
action: string;
type: string;
sensitivity_tier: string;
Expand All @@ -206,7 +206,7 @@ export async function captureThought(

export async function fetchReflections(
apiKey: string,
thoughtId: number
thoughtId: string
): Promise<Reflection[]> {
const data = await apiFetch<{ reflections: Reflection[] }>(
apiKey,
Expand Down
10 changes: 5 additions & 5 deletions dashboards/open-brain-dashboard-next/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Thought {
id: number;
id: string;
uuid?: string;
content: string;
type: string;
Expand Down Expand Up @@ -65,7 +65,7 @@ export function getPriorityLevel(importance: number) {

export interface Reflection {
id: number;
thought_id: number;
thought_id: string;
trigger_context: string;
options: unknown[];
factors: unknown[];
Expand Down Expand Up @@ -104,8 +104,8 @@ export interface StatsResponse {
}

export interface DuplicatePair {
thought_id_a: number;
thought_id_b: number;
thought_id_a: string;
thought_id_b: string;
similarity: number;
content_a: string;
content_b: string;
Expand Down Expand Up @@ -163,7 +163,7 @@ export type AddToBrainMode = "auto" | "single" | "extract";

export interface AddToBrainResult {
path: "single" | "extract";
thought_id?: number;
thought_id?: string;
job_id?: number;
type?: string;
status?: string;
Expand Down
Loading