ktutak1337 / Stellar-Chat

A versatile multi-modal chat application that enables users to develop custom agents, create images, leverage visual recognition, and engage in voice interactions. It integrates seamlessly with local LLMs and commercial models like OpenAI, Gemini, Perplexity, and Claude, and allows to converse with uploaded documents and websites.
https://docs.stellar-chat.com/
GNU Affero General Public License v3.0
106 stars 6 forks source link

[Request] User authentication #15

Open mikkelly-mi opened 1 month ago

mikkelly-mi commented 1 month ago

πŸš€ Feature Description

Hi, First of all, congratulations for the development of this project so far. A very good job done @ktutak1337 ! I really like the architecture, I have never encountered such a well-readable code.

Are you planning to add authentication? How would you implement it?

Thanks for the reply, best regards. Mikkelly

🧐 Proposed Solution

Maybe password based authentication would be enough to start with, so that social sign-in authentication can be added later.

πŸ“ Additional Information

No response

ktutak1337 commented 1 month ago

Hi Mikkelly,

Thanks for the kind words! Originally, I didn't plan on adding user accounts. However, I'm now considering it for future releases. Currently, my focus is on adding more providers with LLM models, as well as image vision and generation features.

For authentication, I'm thinking about token-based auth using JWT or possibly a federated auth system (e.g., Google, Meta, OAuth, Azure AD). This would be especially useful as we plan to expose the app to the wider internet. Another option could be using access codes with expiration dates for chat access instead of user accounts.

If you're interested, I'd love to see a PR with your proposed feature!

mikkelly-mi commented 1 month ago

@ktutak1337 ,

Adding more providers with LLM models adds importance to this app. When you have time, I would like you to write what is the vision behind the Stellar-Chat app that you are developing. JWT is a good choice for auth.

I would like to try to join the development of this project, so it would be good if you could give me some guidelines so that we can develop an auth system.

Would the development of this functionality use the same API and mongo base or could we create a new API with a SQL base and use Identity models and EF?

Thanks for the answers, I believe I will have a PR in the next couple of weeks :)

ktutak1337 commented 1 month ago

@mikkelly-mi

Answering your question about the vision for the project:

My goal is to create a cross-platform application that allows users to interact with various LLMs from different providers. This will enable multimodal capabilities, including processing text, images, audio, etc. The app will also support easy integrations with various services via APIs, which can already be done using remote actions.

I'm still learning frontend development, and this is my first project where I'm experimenting with it. I'm considering rewriting the frontend using a JS framework like Svelte/Svelte Kit or React/Next.js. For the desktop app, based on my research, Tauri seems to be the main candidate, and I'll likely go in that direction.

Regarding the auth feature, I prefer to stick with MongoDB. However, if we switch to SQL and EF, I'd go with SQLite, keeping in mind that this is a self-hosted project, and I don't want to add more containers with another database for the user. I'd rather avoid creating a new API for similar reasons. In .NET 8, it's easy to add endpoints with Identity, but unfortunately, it's not JWT-based. Still, it seems suitable for this project. Unless there's something I'm missing. What do you think about this approach?

This feature impacts many areas of the project. We'll need to ensure the creation and management of assistants, actions, and chat history per user.

If you have any suggestions or thoughts on this feature, I'd be happy to hear them.

mikkelly-mi commented 2 weeks ago

@ktutak1337 ,

It's much easier for me to work in Blazor because I'm more .Net oriented, so it seems simpler to me.

As for the Auth feature, the first PR is ready :) I followed your instructions and added identity entities over the mongodb existing database. The "user" endpoint group was created: register, login, profile. JWT based authentication is used. Added seeder for identity entities. You can see that I named this feature "User Management", and in the structure FeatureΕ‘/Identitj/User you will also see functions that I have not developed yet, but I have put them for consideration and inclusion in the development plan.

I suggest that we create a global APIResponse class, in order to unify all API responses.

If something is not right, and I doubt that everything is ok the first time, feel free to correct me, I would be grateful for that.

Of course I will need permission to push to the repo. You can create a new branch to follow the development of this feature.

When you look at this first PR, we'll talk about what to develop next.

ktutak1337 commented 2 weeks ago

@mikkelly-mi,

Thank you so much for your contribution to the project! πŸ™

To make the collaboration smoother, please fork the project and enable the upstream. This way, you can easily stay up to date with the latest changes in the main repository. You can follow this guide on how to sync your fork with the upstream. For the feature you've already written, create a new branch based on the develop branch, push your changes there, and then submit a pull request on GitHub using the PR template.

I'll review and test the code you submit through the pull request. 😊

In the coming days, I'll add some issues with features and bugs that need attention. Feel free to choose any that interest you, though there are two bugs that should be prioritized.

Looking forward to your contributions!