Skip to content

Commit dfb0c05

Browse files
committed
add spaces selector with search (supermemoryai#600)
relevant files to review: \- memory-graph.tsx \- spaces-dropdown.tsx \- spaces-dropdown.css.ts
1 parent 47a2179 commit dfb0c05

48 files changed

Lines changed: 2446 additions & 1950 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { NextConfig } from "next";
1+
import type { NextConfig } from "next"
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
5-
reactCompiler: true,
6-
};
4+
/* config options here */
5+
reactCompiler: true,
6+
}
77

8-
export default nextConfig;
8+
export default nextConfig
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const config = {
2-
plugins: {
3-
"@tailwindcss/postcss": {},
4-
},
5-
};
2+
plugins: {
3+
"@tailwindcss/postcss": {},
4+
},
5+
}
66

7-
export default config;
7+
export default config
Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,55 @@
1-
import { NextResponse } from 'next/server'
1+
import { NextResponse } from "next/server"
22

33
export async function POST(request: Request) {
4-
try {
5-
const body = await request.json()
6-
const { apiKey, page = 1, limit = 500, sort = 'createdAt', order = 'desc' } = body
4+
try {
5+
const body = await request.json()
6+
const {
7+
apiKey,
8+
page = 1,
9+
limit = 500,
10+
sort = "createdAt",
11+
order = "desc",
12+
} = body
713

8-
if (!apiKey) {
9-
return NextResponse.json(
10-
{ error: 'API key is required' },
11-
{ status: 400 }
12-
)
13-
}
14+
if (!apiKey) {
15+
return NextResponse.json(
16+
{ error: "API key is required" },
17+
{ status: 400 },
18+
)
19+
}
1420

15-
const response = await fetch('https://api.supermemory.ai/v3/documents/documents', {
16-
method: 'POST',
17-
headers: {
18-
'Content-Type': 'application/json',
19-
'Authorization': `Bearer ${apiKey}`,
20-
},
21-
body: JSON.stringify({
22-
page,
23-
limit,
24-
sort,
25-
order,
26-
}),
27-
})
21+
const response = await fetch(
22+
"https://api.supermemory.ai/v3/documents/documents",
23+
{
24+
method: "POST",
25+
headers: {
26+
"Content-Type": "application/json",
27+
Authorization: `Bearer ${apiKey}`,
28+
},
29+
body: JSON.stringify({
30+
page,
31+
limit,
32+
sort,
33+
order,
34+
}),
35+
},
36+
)
2837

29-
if (!response.ok) {
30-
const errorData = await response.json().catch(() => ({}))
31-
return NextResponse.json(
32-
{ error: errorData.message || `API error: ${response.status}` },
33-
{ status: response.status }
34-
)
35-
}
38+
if (!response.ok) {
39+
const errorData = await response.json().catch(() => ({}))
40+
return NextResponse.json(
41+
{ error: errorData.message || `API error: ${response.status}` },
42+
{ status: response.status },
43+
)
44+
}
3645

37-
const data = await response.json()
38-
return NextResponse.json(data)
39-
} catch (error) {
40-
console.error('Graph API error:', error)
41-
return NextResponse.json(
42-
{ error: 'Failed to fetch documents' },
43-
{ status: 500 }
44-
)
45-
}
46+
const data = await response.json()
47+
return NextResponse.json(data)
48+
} catch (error) {
49+
console.error("Graph API error:", error)
50+
return NextResponse.json(
51+
{ error: "Failed to fetch documents" },
52+
{ status: 500 },
53+
)
54+
}
4655
}
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
@import "tailwindcss";
22

33
:root {
4-
--background: #ffffff;
5-
--foreground: #171717;
4+
--background: #ffffff;
5+
--foreground: #171717;
66
}
77

88
@theme inline {
9-
--color-background: var(--background);
10-
--color-foreground: var(--foreground);
11-
--font-sans: var(--font-geist-sans);
12-
--font-mono: var(--font-geist-mono);
9+
--color-background: var(--background);
10+
--color-foreground: var(--foreground);
11+
--font-sans: var(--font-geist-sans);
12+
--font-mono: var(--font-geist-mono);
1313
}
1414

1515
@media (prefers-color-scheme: dark) {
16-
:root {
17-
--background: #0a0a0a;
18-
--foreground: #ededed;
19-
}
16+
:root {
17+
--background: #0a0a0a;
18+
--foreground: #ededed;
19+
}
2020
}
2121

2222
body {
23-
background: var(--background);
24-
color: var(--foreground);
25-
font-family: Arial, Helvetica, sans-serif;
23+
background: var(--background);
24+
color: var(--foreground);
25+
font-family: Arial, Helvetica, sans-serif;
2626
}
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import type { Metadata } from "next";
2-
import { Geist, Geist_Mono } from "next/font/google";
3-
import "./globals.css";
1+
import type { Metadata } from "next"
2+
import { Geist, Geist_Mono } from "next/font/google"
3+
import "./globals.css"
44

55
const geistSans = Geist({
6-
variable: "--font-geist-sans",
7-
subsets: ["latin"],
8-
});
6+
variable: "--font-geist-sans",
7+
subsets: ["latin"],
8+
})
99

1010
const geistMono = Geist_Mono({
11-
variable: "--font-geist-mono",
12-
subsets: ["latin"],
13-
});
11+
variable: "--font-geist-mono",
12+
subsets: ["latin"],
13+
})
1414

1515
export const metadata: Metadata = {
16-
title: "Create Next App",
17-
description: "Generated by create next app",
18-
};
16+
title: "Create Next App",
17+
description: "Generated by create next app",
18+
}
1919

2020
export default function RootLayout({
21-
children,
21+
children,
2222
}: Readonly<{
23-
children: React.ReactNode;
23+
children: React.ReactNode
2424
}>) {
25-
return (
26-
<html lang="en">
27-
<body
28-
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
29-
>
30-
{children}
31-
</body>
32-
</html>
33-
);
25+
return (
26+
<html lang="en">
27+
<body
28+
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
29+
>
30+
{children}
31+
</body>
32+
</html>
33+
)
3434
}

0 commit comments

Comments
 (0)