enricoros / big-AGI

Generative AI suite powered by state-of-the-art models and providing advanced AI/AGI functions. It features AI personas, AGI functions, multi-model chats, text-to-image, voice, response streaming, code highlighting and execution, PDF import, presets for developers, much more. Deploy on-prem or in the cloud.
https://big-agi.com
MIT License
5.53k stars 1.27k forks source link

Desktop client for big-AGI #338

Open younes-io opened 10 months ago

younes-io commented 10 months ago

Why This feature will enable users to get the full computational power of their machine, reduce latency, and enhance data privacy through a dedicated desktop application. It should empower users who require offline capabilities, and restricted data control.

Concise description The request is to create a desktop version of the current web-based AI application using a framework like Tauri that allows for cross-platform desktop applications with enhanced security and performance. The desktop app should maintain feature parity with the web version while taking advantage of native system capabilities.

Requirements

TBD (not yet organized in my head.. seeking help from community 🤣 )

younes-io commented 10 months ago

This could also help avoid the overhead of local install, dependencies, etc.. as in https://github.com/enricoros/big-AGI/issues/334

enricoros commented 10 months ago

Thanks! The app has currently a frontend (react) and backend (nextjs), all integrated into a single server. What would go into Tauri, Just the frontend, or both fronted and backend?

younes-io commented 10 months ago

IMHO, both.. (especially for privacy reasons)

younes-io commented 10 months ago

Maybe you can add a proxy option for those who want to go through your servers.. but in my case, I want everything on my machine, and directly connect to the LLM of my choice

enricoros commented 10 months ago

Adding to the roadmap a frontend-only big-AGI Electron build. With today's technology running a full nodejs/nextjs inside an Electron application does not seem viable.

pacoccino commented 9 months ago

Adding to the roadmap a frontend-only big-AGI Electron build. With today's technology running a full nodejs/nextjs inside an Electron application does not seem viable.

What's the issue with next + electron ?

younes-io commented 9 months ago

@enricoros : did you consider the Tauri option?

enricoros commented 9 months ago

Hi @pacoccino and @pacoccino , I don't know much about JS in desktop clients.

For a full contained build (frontend + backend) the requirement is to be able to run Next.js 14. Big-AGI has latest-and-greatest requirements usually, including using the latest libraries.

Does Electron (Nextron?) support Next 14? Is Tauri a bit option? What do you guys think?

younes-io commented 9 months ago

You can take a look at this https://tauri.app/v1/guides/getting-started/setup/next-js/

Nextron doesn't seem to have a big community, I've never used it though so I can't really tell

enricoros commented 9 months ago

Seems that Tauri is not an option then. Because it will run the front end, but not the back end (llms calls, image generation, etc.).

So the user will have the additional burden of running a nodejs server for the various backend functions (trpc calls and llm streaming in our case).

OR the backend will be needed to be rewritten in Rust which is not an option given the amount of stuff in the roadmap and the Web (mobile/desktop) version compatibility.

enricoros commented 9 months ago

After hours of research, seems to me there's no easy solution to satisfy these requirements:

Seems that either all the backend code needs to be moved to the frontend and disabling CORS, or the backend needs to be rewritten or at least heavily changed to use within-app IPC.

For both those options, Big-AGI will lose today's Web functionality.

younes-io commented 9 months ago

@enricoros : I use this app https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/ which also has a web version (https://app.nextchat.dev/) and they seem to use Next.js as well Maybe you can take a look at their repo

enricoros commented 9 months ago

Chose Electron - I'll need to run a node backend. First screenshot after 8 hours of working on it:

image

Electron Frontend is up - misses ALL the backend(s).. will take a while.

younes-io commented 9 months ago

@enricoros, that's awesome! Please take your time! I know I added a lot of workload to you 😢

pacoccino commented 9 months ago

Doubling my other (https://github.com/enricoros/big-AGI/issues/418#issuecomment-1951035069), maybe you could abstract the trpc connection to either call Next tRPC endpoint or Electron main process one using something like https://github.com/janek26/trpc-browser ?

jannesbrunner commented 2 weeks ago

I know I'm late here but a general question:

was the implementation of a Progressive Web App (PWA) considered for the desktop application, given that Electron apps typically require a lot of memory and have long startup times? Shouldn't the functionality of a PWA be sufficient?

enricoros commented 2 weeks ago

@jannesbrunner we are squeezing every inch of performance and functionality out of PWAs. The main reason to have a desktop client would be to: 1. access OS functionality, such as better filesystem or camera integration, and 2. survive the browser closure (e.g. work in background).

What's your take, Electron app or not? this is still on the table.