Skip to content

Commit af0eabe

Browse files
committed
usem profile
1 parent e3caf8b commit af0eabe

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

app/(chat)/api/chat/delete-all/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export async function DELETE(request: Request) {
4040
};
4141
console.log('[Delete All] Request body:', JSON.stringify(requestBody));
4242

43+
const baseUrl = process.env.SUPERMEMORY_BASE_URL || 'https://api.supermemory.ai';
4344
const deleteMemoriesResponse = await fetch(
44-
'https://api.supermemory.ai/v3/documents/bulk',
45+
`${baseUrl}/v3/documents/bulk`,
4546
{
4647
method: 'DELETE',
4748
headers: {

app/(chat)/api/chat/route.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,18 @@ export async function POST(request: Request) {
154154
'[Chat API] Checking for existing memories for user:',
155155
containerTag,
156156
);
157-
const profileResponse = await fetch(
158-
'https://api.supermemory.ai/v4/profile',
159-
{
160-
method: 'POST',
161-
headers: {
162-
'Content-Type': 'application/json',
163-
Authorization: `Bearer ${supermemoryApiKey}`,
164-
},
165-
body: JSON.stringify({
166-
containerTag: containerTag,
167-
}),
157+
const baseUrl =
158+
process.env.SUPERMEMORY_BASE_URL || 'https://api.supermemory.ai';
159+
const profileResponse = await fetch(`${baseUrl}/v4/profile`, {
160+
method: 'POST',
161+
headers: {
162+
'Content-Type': 'application/json',
163+
Authorization: `Bearer ${supermemoryApiKey}`,
168164
},
169-
);
165+
body: JSON.stringify({
166+
containerTag: containerTag,
167+
}),
168+
});
170169

171170
if (profileResponse.ok) {
172171
const profileData = await profileResponse.json();

app/(chat)/api/documents/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ export async function POST(request: Request) {
3434

3535
try {
3636
// Fetch documents from Supermemory API
37+
const baseUrl = process.env.SUPERMEMORY_BASE_URL || 'https://api.supermemory.ai';
3738
const response = await fetch(
38-
'https://api.supermemory.ai/v3/documents/documents',
39+
`${baseUrl}/v3/documents/documents`,
3940
{
4041
method: 'POST',
4142
headers: {

app/(chat)/api/profile/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export async function GET(request: Request) {
2929
'[Profile API] Fetching profile from Supermemory with containerTag:',
3030
containerTag,
3131
);
32-
const response = await fetch('https://api.supermemory.ai/v4/profile', {
32+
const baseUrl = process.env.SUPERMEMORY_BASE_URL || 'https://api.supermemory.ai';
33+
const response = await fetch(`${baseUrl}/v4/profile`, {
3334
method: 'POST',
3435
headers: {
3536
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)