From 30288c75522ad72c3ee0125d3b21827112a339ce Mon Sep 17 00:00:00 2001 From: Adamsmith6300 Date: Fri, 11 Apr 2025 16:51:44 -0700 Subject: [PATCH 1/4] add hot reloading to backend, small readme updates --- README.md | 6 +++--- surfsense_backend/main.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8b09551..4925bc9 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Make sure pgvector extension is installed on your machine. Setup Guide https://g For File uploading you need Unstructured.io API key. You can get it at http://platform.unstructured.io/ #### Auth -SurfSense now only works with Google OAuth. Make sure to set your OAuth Client at https://developers.google.com/identity/protocols/oauth2 . We need client id and client secret for backend. +SurfSense now only works with Google OAuth. Make sure to set your OAuth Client at https://developers.google.com/identity/protocols/oauth2 . We need client id and client secret for backend. Make sure to enable people api and add the required scopes under data access (openid, userinfo.email, userinfo.profile) ![gauth](https://github.com/user-attachments/assets/80d60fe5-889b-48a6-b947-200fdaf544c1) @@ -145,8 +145,8 @@ For local frontend setup just fill out the `.env` file of frontend. |--|--| | NEXT_PUBLIC_FASTAPI_BACKEND_URL | Give hosted backend url here. Eg. `http://localhost:8000`| -1. Now install dependencies using `pnpm install` -2. Run it using `pnpm run dev` +1. Now install dependencies using `npm install` +2. Run it using `npm run dev` You should see your Next.js frontend running at `localhost:3000` diff --git a/surfsense_backend/main.py b/surfsense_backend/main.py index 78a33d4..76d478b 100644 --- a/surfsense_backend/main.py +++ b/surfsense_backend/main.py @@ -1,4 +1,15 @@ import uvicorn +import argparse if __name__ == "__main__": - uvicorn.run("app.app:app", host="0.0.0.0", log_level="info", loop="asyncio") + parser = argparse.ArgumentParser(description='Run the SurfSense application') + parser.add_argument('--reload', action='store_true', help='Enable hot reloading') + args = parser.parse_args() + + uvicorn.run( + "app.app:app", + host="0.0.0.0", + log_level="info", + reload=args.reload, + reload_dirs=["app"] + ) From 61ff1582da0567d62080bac4dce97f5bee592e2b Mon Sep 17 00:00:00 2001 From: Adamsmith6300 Date: Fri, 11 Apr 2025 16:54:25 -0700 Subject: [PATCH 2/4] search card ux updates --- surfsense_web/app/dashboard/page.tsx | 73 +++++++++++++--------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/surfsense_web/app/dashboard/page.tsx b/surfsense_web/app/dashboard/page.tsx index 4e19545..1418b80 100644 --- a/surfsense_web/app/dashboard/page.tsx +++ b/surfsense_web/app/dashboard/page.tsx @@ -211,6 +211,7 @@ const DashboardPage = () => {
{searchSpaces && searchSpaces.map((space) => ( + { alt={space.name} className="h-full w-full object-cover grayscale duration-700 group-hover:grayscale-0" /> -
-
- - - - - -
+
- - - - - - - Delete Search Space - - Are you sure you want to delete "{space.name}"? This action cannot be undone. - All documents, chats, and podcasts in this search space will be permanently deleted. - - - - Cancel - handleDeleteSearchSpace(space.id)} - className="bg-destructive hover:bg-destructive/90" - > - Delete - - - - +
e.preventDefault()}> + + + + + + + Delete Search Space + + Are you sure you want to delete "{space.name}"? This action cannot be undone. + All documents, chats, and podcasts in this search space will be permanently deleted. + + + + Cancel + handleDeleteSearchSpace(space.id)} + className="bg-destructive hover:bg-destructive/90" + > + Delete + + + + +
@@ -298,6 +294,7 @@ const DashboardPage = () => { + ))} {searchSpaces.length === 0 && ( @@ -350,4 +347,4 @@ const DashboardPage = () => { ) } -export default DashboardPage \ No newline at end of file +export default DashboardPage From cb0c65b15e7ec1448dde7812b576a47c8029c561 Mon Sep 17 00:00:00 2001 From: Adamsmith6300 Date: Fri, 11 Apr 2025 16:59:24 -0700 Subject: [PATCH 3/4] hot reloading detail in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4925bc9..91fb52c 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ You can also integrate any LLM just follow this https://docs.litellm.ai/docs/pro Now once you have everything let's proceed to run SurfSense. 1. Install `uv` : https://docs.astral.sh/uv/getting-started/installation/ 2. Now just run this command to install dependencies i.e `uv sync` -3. That's it. Now just run the `main.py` file using `uv run main.py`. +3. That's it. Now just run the `main.py` file using `uv run main.py`. You can also optionally pass `--reload` as an argument to enable hot reloading. 4. If everything worked fine you should see screen like this. ![backend](https://i.ibb.co/542Vhqw/backendrunning.png) From 9867dbd536e3bd93012fcbe11ea32930cab42b7b Mon Sep 17 00:00:00 2001 From: Adamsmith6300 Date: Fri, 11 Apr 2025 17:08:30 -0700 Subject: [PATCH 4/4] revert readme change about pnpm...didnt know that actually existed haha --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91fb52c..c890b2d 100644 --- a/README.md +++ b/README.md @@ -145,8 +145,8 @@ For local frontend setup just fill out the `.env` file of frontend. |--|--| | NEXT_PUBLIC_FASTAPI_BACKEND_URL | Give hosted backend url here. Eg. `http://localhost:8000`| -1. Now install dependencies using `npm install` -2. Run it using `npm run dev` +1. Now install dependencies using `pnpm install` +2. Run it using `pnpm run dev` You should see your Next.js frontend running at `localhost:3000`