diff options
| author | Dhravya <[email protected]> | 2024-05-21 22:47:33 -0500 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-05-21 22:47:33 -0500 |
| commit | a4f566aaa085ce2a871f12070f932fa7da557316 (patch) | |
| tree | e8ff7e3eb0a27ef47300f261975afdefae093b32 /apps/web/src/app | |
| parent | footer fix: Arrow color should be consistent, no need for stroke (diff) | |
| download | supermemory-a4f566aaa085ce2a871f12070f932fa7da557316.tar.xz supermemory-a4f566aaa085ce2a871f12070f932fa7da557316.zip | |
format documents
Diffstat (limited to 'apps/web/src/app')
| -rw-r--r-- | apps/web/src/app/api/chat/route.ts | 74 | ||||
| -rw-r--r-- | apps/web/src/app/globals.css | 32 |
2 files changed, 52 insertions, 54 deletions
diff --git a/apps/web/src/app/api/chat/route.ts b/apps/web/src/app/api/chat/route.ts index 374f39cd..c815070b 100644 --- a/apps/web/src/app/api/chat/route.ts +++ b/apps/web/src/app/api/chat/route.ts @@ -69,43 +69,41 @@ export async function POST(req: NextRequest) { }); } - try { - const resp = await fetch( - `https://cf-ai-backend.dhravya.workers.dev/chat?q=${query}&user=${session.user.email ?? session.user.name}&sourcesOnly=${sourcesOnly}&spaces=${spaces}`, - { - headers: { - "X-Custom-Auth-Key": env.BACKEND_SECURITY_KEY, - }, - method: "POST", - body: JSON.stringify({ - chatHistory: chatHistory.chatHistory ?? [], - }), - }, - ); - - console.log("sourcesOnly", sourcesOnly); - - if (sourcesOnly == "true") { - const data = await resp.json(); - console.log("data", data); - return new Response(JSON.stringify(data), { status: 200 }); - } - - if (resp.status !== 200 || !resp.ok) { - const errorData = await resp.json(); - console.log(errorData); - return new Response( - JSON.stringify({ message: "Error in CF function", error: errorData }), - { status: resp.status }, - ); - } - - // Stream the response back to the client - const { readable, writable } = new TransformStream(); - resp && resp.body!.pipeTo(writable); - - return new Response(readable, { status: 200 }); - } catch { - } + try { + const resp = await fetch( + `https://cf-ai-backend.dhravya.workers.dev/chat?q=${query}&user=${session.user.email ?? session.user.name}&sourcesOnly=${sourcesOnly}&spaces=${spaces}`, + { + headers: { + "X-Custom-Auth-Key": env.BACKEND_SECURITY_KEY, + }, + method: "POST", + body: JSON.stringify({ + chatHistory: chatHistory.chatHistory ?? [], + }), + }, + ); + + console.log("sourcesOnly", sourcesOnly); + + if (sourcesOnly == "true") { + const data = await resp.json(); + console.log("data", data); + return new Response(JSON.stringify(data), { status: 200 }); + } + + if (resp.status !== 200 || !resp.ok) { + const errorData = await resp.json(); + console.log(errorData); + return new Response( + JSON.stringify({ message: "Error in CF function", error: errorData }), + { status: resp.status }, + ); + } + + // Stream the response back to the client + const { readable, writable } = new TransformStream(); + resp && resp.body!.pipeTo(writable); + return new Response(readable, { status: 200 }); + } catch {} } diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css index 9a543be6..bed9278b 100644 --- a/apps/web/src/app/globals.css +++ b/apps/web/src/app/globals.css @@ -58,22 +58,22 @@ body { } .bottom-padding { - bottom: 20vh; - bottom: 20dvh; + bottom: 20vh; + bottom: 20dvh; } @media (min-width: 768px) { - .bottom-padding { - bottom: 0; - } + .bottom-padding { + bottom: 0; + } } -.chat-answer code { - @apply bg-rgray-3 text-wrap rounded-md border border-rgray-5 p-1 text-sm text-rgray-11; +.chat-answer code { + @apply bg-rgray-3 border-rgray-5 text-rgray-11 text-wrap rounded-md border p-1 text-sm; } .novel-editor pre { - @apply bg-rgray-3 rounded-md border border-rgray-5 p-4 my-5 text-sm text-rgray-11; + @apply bg-rgray-3 border-rgray-5 text-rgray-11 my-5 rounded-md border p-4 text-sm; } .chat-answer h1 { @@ -81,19 +81,19 @@ body { } .chat-answer a { - @apply underline underline-offset-1 opacity-90 hover:opacity-100; + @apply underline underline-offset-1 opacity-90 hover:opacity-100; } .chat-answer img { - @apply rounded-md font-medium my-5; + @apply my-5 rounded-md font-medium; } .tippy-box { - @apply bg-rgray-3 text-rgray-11 border border-rgray-5 rounded-md py-0; + @apply bg-rgray-3 text-rgray-11 border-rgray-5 rounded-md border py-0; } .tippy-content #slash-command { - @apply text-rgray-11 bg-transparent border-none; + @apply text-rgray-11 border-none bg-transparent; } #slash-command button { @@ -101,18 +101,18 @@ body { } #slash-command button div:first-child { - @apply text-rgray-11 bg-rgray-4 border-rgray-5 ; + @apply text-rgray-11 bg-rgray-4 border-rgray-5; } #slash-command button.novel-bg-stone-100 { @apply bg-rgray-1; } -.novel-editor [data-type=taskList] > li { +.novel-editor [data-type="taskList"] > li { @apply my-0; } -.novel-editor input[type=checkbox] { +.novel-editor input[type="checkbox"] { @apply accent-rgray-4 rounded-md; background: var(--gray-4) !important; @@ -120,7 +120,7 @@ body { } .novel-editor .is-empty::before { - content: 'Press \'/\' for commands' !important; + content: "Press '/' for commands" !important; } .novel-editor h1 { |