Merge pull request #34 from Adamsmith6300/add-hot-reloading

Add hot reloading + minor UX updates
This commit is contained in:
Rohan Verma 2025-04-11 18:40:41 -07:00 committed by GitHub
commit 02fc295812
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 41 deletions

View file

@ -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/ For File uploading you need Unstructured.io API key. You can get it at http://platform.unstructured.io/
#### Auth #### 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) ![gauth](https://github.com/user-attachments/assets/80d60fe5-889b-48a6-b947-200fdaf544c1)
@ -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. Now once you have everything let's proceed to run SurfSense.
1. Install `uv` : https://docs.astral.sh/uv/getting-started/installation/ 1. Install `uv` : https://docs.astral.sh/uv/getting-started/installation/
2. Now just run this command to install dependencies i.e `uv sync` 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. 4. If everything worked fine you should see screen like this.
![backend](https://i.ibb.co/542Vhqw/backendrunning.png) ![backend](https://i.ibb.co/542Vhqw/backendrunning.png)

View file

@ -1,4 +1,15 @@
import uvicorn import uvicorn
import argparse
if __name__ == "__main__": 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"]
)

View file

@ -211,6 +211,7 @@ const DashboardPage = () => {
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{searchSpaces && searchSpaces.map((space) => ( {searchSpaces && searchSpaces.map((space) => (
<Link href={`/dashboard/${space.id}/documents`}>
<motion.div <motion.div
key={space.id} key={space.id}
variants={itemVariants} variants={itemVariants}
@ -244,20 +245,14 @@ const DashboardPage = () => {
className="h-full w-full object-cover grayscale duration-700 group-hover:grayscale-0" className="h-full w-full object-cover grayscale duration-700 group-hover:grayscale-0"
/> />
<div className="absolute inset-0 bg-gradient-to-t from-background/80 to-transparent" /> <div className="absolute inset-0 bg-gradient-to-t from-background/80 to-transparent" />
<div className="absolute bottom-2 left-3 flex items-center gap-2">
<Link href={`/dashboard/${space.id}/documents`}>
<span className="flex h-8 w-8 items-center justify-center rounded-full bg-blue-100/80 dark:bg-blue-950/80">
<Search className="h-4 w-4 text-blue-500" />
</span>
</Link>
</div>
<div className="absolute top-2 right-2"> <div className="absolute top-2 right-2">
<div onClick={(e) => e.preventDefault()}>
<AlertDialog> <AlertDialog>
<AlertDialogTrigger asChild> <AlertDialogTrigger asChild>
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
className="h-8 w-8 rounded-full bg-background/50 backdrop-blur-sm hover:bg-destructive/90 hover:text-destructive-foreground" className="h-8 w-8 rounded-full bg-background/50 backdrop-blur-sm hover:bg-destructive/90 cursor-pointer"
> >
<Trash2 className="h-4 w-4" /> <Trash2 className="h-4 w-4" />
</Button> </Button>
@ -266,7 +261,7 @@ const DashboardPage = () => {
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>Delete Search Space</AlertDialogTitle> <AlertDialogTitle>Delete Search Space</AlertDialogTitle>
<AlertDialogDescription> <AlertDialogDescription>
Are you sure you want to delete "{space.name}"? This action cannot be undone. Are you sure you want to delete &quot;{space.name}&quot;? This action cannot be undone.
All documents, chats, and podcasts in this search space will be permanently deleted. All documents, chats, and podcasts in this search space will be permanently deleted.
</AlertDialogDescription> </AlertDialogDescription>
</AlertDialogHeader> </AlertDialogHeader>
@ -283,6 +278,7 @@ const DashboardPage = () => {
</AlertDialog> </AlertDialog>
</div> </div>
</div> </div>
</div>
<div className="flex flex-1 flex-col justify-between p-4"> <div className="flex flex-1 flex-col justify-between p-4">
<div> <div>
@ -298,6 +294,7 @@ const DashboardPage = () => {
</Tilt> </Tilt>
</motion.div> </motion.div>
</Link>
))} ))}
{searchSpaces.length === 0 && ( {searchSpaces.length === 0 && (