Giter Club home page Giter Club logo

unsaged's Introduction

unsaged logo

Join our Discord

πŸŽ‰ Welcome to unsaged

unsaged is a cutting-edge chat kit engineered for seamless interaction with AI models. It allows you to easily have conversations with different AI models from a variety of providers, all in one place. It also allows you to manage multiple users and conversations, and synchronize them across different devices. Leveraging the power of Next.js and Supabase, it offers a user-friendly and robust interface for engaging with AI models from a variety of providers.

You can use it live at app.unsaged.com. Just make sure not to put in personal information as your conversations will be stored in Postgres (Supabase) until you delete them.

🚧 Installation

Follow the installation instructions in the Getting Started section of the documentation.

🌟 Key Features

  • Multi-Model Support: Switch between different AI models from a variety of providers with ease.
  • Multi-User Support: Easily switch between users and manage their respective conversations.
  • Cloud Sync: Synchronize your conversations across different devices seamlessly with Supabase.
  • System Prompts: Personalize your conversation context and the AI's personality with system prompts.
  • Message Templates: Speed up message generation with support for variable templates.

πŸ€– Supported AI Models

  • OpenAI
    • GPT-3.5-Turbo, GPT-3.5-Turbo-16k
    • GPT-4, GPT-4-32k, GPT-4-Turbo
  • Anthropic
    • Claude Instant 1 (100k)
    • Claude 2 (100k)
  • Google PaLM 2
    • Chat Bison (Bard)
  • Azure OpenAI
    • GPT-3.5-Turbo, GPT-3.5-Turbo-16k
    • GPT-4, GPT-4-32k
  • Ollama
    • Llama2-7b, Llama2-13b, Llama2-70b, goliath, llama2-uncensored
    • Codellama-7b, Codellama-13b, Codellama-70b
    • Wizard-7b, Wizard-13b, Wizard-34b
    • Phind-Codellama
    • Mistral, Mistral-OpenOrca, neural-chat
    • openchat
    • orca-mini
    • vicuna
    • deepseek-coder-1b, deepseek-coder-6.7b, deepseek-coder-33b

πŸš€ Upgrading unsaged

  • On November 13th, 2023, we released a major update to unsaged, which introduced more settings to the conversation. It requires that you update some database table columns. If you are upgrading from a version of unsaged released before this date, you will need to run the Upgrade Script in the Supabase SQL editor.
  • On November 16th, 2023, we released a major update to unsaged, which converts this repo into monorepo to support the documentation website. It requires that you change a setting in your Vercel project, if you have one. If you do have one, you need to set apps/web as the Root Directory in your Vercel project's settings.

πŸ“ License

unsaged is licensed under the Apache 2.0 License. For more information, please refer to the LICENSE file in the repository.

🀝 How to Contribute

We welcome contributions to the unsaged project! If you're interested in contributing, please take a look at our CONTRIBUTING.md file for guidelines and details on the process.

Alt

πŸ“Έ Screenshots

Screenshot-1

Screenshot-2

Screenshot-4

Screenshot-5

πŸ“š Built With

unsaged was built using the following technologies:

  • Next.js: A React framework for production - it makes building static and dynamic React apps a breeze.
  • Supabase: An open-source Firebase alternative. We use it for its awesome database and authentication capabilities.
  • Chatbot UI: A customizable and easy-to-use chat UI for web applications.

We are grateful to the developers and communities behind these projects for their work that helped make unsaged possible.

unsaged's People

Contributors

bortus-ai avatar daniel-farina avatar dependabot[bot] avatar diegosc78 avatar jairodriguez avatar johnnymo87 avatar jorge-menjivar avatar kabe2007 avatar sebiweise avatar skydiver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unsaged's Issues

[BUG] Models not loading

Describe the bug
Models not loading after merge of #106 and #107

Screenshots
image

Additional context
Vercel isΒ΄nt showing any errors in the log, Browser Console is showing this:
Section personalization not found

Importing conversation history not working

I recently switched from https://github.com/mckaywrigley/chatbot-ui to this repo and tried to import my old conversation history but this only loops the most recent user question and totally misses the answers coming from the assistant. Here is an example:

JSON input:

...
"messages": [
        {
          "role": "user",
          "content": "QUESTION 1"
        },
        {
          "role": "assistant",
          "content": "ANSWER 1"
        },
        {
          "role": "user",
          "content": "QUESTION 2"
        },
        {
          "role": "assistant",
          "content": "ANSWER 2"
        },
...

UI output:

...
QUESTION 2
QUESTION 2
...

Edit:
Streamlined and simplified the example.

[BUG] DB Migration - jsonb NOT NULL DEFAULT

Describe the bug
When running the migration script (Generation Script) on supabase I'm seeing this error:

ERROR:  42601: syntax error at or near "NOT"
LINE 121: 	jsonb NOT NULL DEFAULT '{}'::jsonb,

I'll try to figure it out in the meantime.

Vercel deploy error: Cannot read properties of undefined (reading 'vendor')

Trying to deploy on vercel but getting the following error on browser:

Application error: a client-side exception has occurred (see the browser console for more information).

the console has the following erors:

Section personalization not found
Cannot read properties of undefined (reading 'vendor')

This last error seems to be related to model...

env vars defined (Checked correct values):
GOOGLE_CLIENT_SECRET
GOOGLE_CLIENT_ID
NEXTAUTH_URL
NEXTAUTH_SECRET
NEXT_PUBLIC_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY
SUPABASE_SERVICE_ROLE_KEY
SUPABASE_JWT_SECRET

try adding DEFAULT_MODE and still not working...

Any ideas how to solve this?

Access to other model params?

Would it be possible to add these model parameter options as well? (Currently it seems to only expose the temperature setting.)

image

[Help Needed] Transition from NextAuth to Supabase Auth for User Authentication

Objective

The project is looking to migrate from NextAuth to Supabase Auth for handling user authentication. This change aims to leverage Supabase Auth's features and streamline our backend services.

Key Deliverables

  • Remove NextAuth and integrate Supabase Auth as the sole authentication solution.
  • Update all authentication-related code to work with Supabase Auth API.
  • Ensure that the authentication flow is fully functional with Supabase Auth, including login, registration, and session management.

Success Criteria

  • A seamless authentication experience similar to or better than the current system.
  • No regression in performance or user experience.
  • Clear documentation on the migration process and changes made.

Contribution Instructions

  1. Indicate your interest by commenting on this issue.
  2. Fork the repository and create a new branch from the main for this migration task.
  3. Implement Supabase Auth, ensuring all features currently using NextAuth are updated accordingly.
  4. Perform thorough testing to confirm that the authentication processes are working without issues.
  5. Commit your changes and submit a Pull Request with a detailed summary of modifications, including any necessary setup instructions or environment variable changes.

Notes for Contributors

  • Prior experience with Supabase Auth is highly recommended.
  • Ensure that any sensitive credentials are handled securely and not included in the PR.
  • Maintain code readability and adhere to the project’s coding standards.

We appreciate your interest and contributions to this important update for our project. A smooth transition to Supabase Auth will set the foundation for more robust user management and open up new possibilities for our application.

"No storage option exists to persist the session" error with Supabase

Getting the following error when running locally:

No storage option exists to persist the session, which may result in unexpected behavior when using auth.
If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning

LaTeX support please!

Hi Jorge! Great job on this project! It's my favorite way to access GPT-4. One thing that I am missing, however, is the ability to have LaTeX support. It just helps so much with math and makes it much easier to view.
Thanks!

[BUG] Section personalization not found

Describe the bug
When I login I got stuck to the loading screen "Loading Conversations..."
Console is showing the error "Section personalization not found"

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser chrome
  • Browser version latest

Hope apis are safe here

Kindly am requesting whoever has used this if u are not getting abnormal open ai charges, am having fear of using my api here despite the goodness of unsaged

[BUG] Rate limit reached for gpt-4 in organization

Describe the bug
For any reason IΒ΄m getting the following error when using GPT-4. After 4-5 Messages IΒ΄m getting a rate limit error on the server. Any idea why this is coming?

Additional context
{
message: 'Rate limit reached for gpt-4 in organization ***** on tokens per min. Limit: 10000 / min. Please try again in 6ms. Visit https://platform.openai.com/account/rate-limits to learn more.',
type: 'tokens',
param: null,
code: 'rate_limit_exceeded'
}

Default behaviors not respected?

Hi there! First off, thanks for building this project! It's super cool and I'm using it extensively <3

I'm planning to roll this out to some colleagues at my organization and ran into an issue. In my case we have a few different environment variables provided with API credentials so that we have a number of models users can access.

I've set the environment variable NEXT_PUBLIC_DEFAULT_MODEL to the specified model I'd like to use as the default (gpt-4-32k), but the setting doesn't appear to be respected. The same is true for NEXT_PUBLIC_DEFAULT_TEMPERATURE when set to 1, which is the default value ChatGPT uses and what I'd like to default temperature to for my users.

Any ideas what I may be doing incorrectly here? Thanks again! <3

Missing OpenAI models

Several useful OpenAI models are missing from the types. For example gpt-3.5-turbo-16k as well as the dated models.

[Feature] Add Ollama URL input in the settings tab

Sometimes I like to spin up different ollama servers for testing so I thought it would be nice to have a settings page that lets you set the ollama url so you don't have to edit the .env.local and redeploy.

Not sure if anyone would find that useful but figured I would put it out there. Also nice for when you forget to set it in the .env as well.

Blank Page Issue with Latest Build in Docker Environment

Hi Jorge,

I encountered an issue with the latest build: it compiles and runs in Docker, but accessing the server only loads the database and conversations partially before showing a blank page. No login screen appears. The logs indicate all models as "Not implemented."

Could this be a configuration miss on my end or a bug in the code?

Thanks for your help,

Mario

[Feature] Update Image generation

Image generation will be or was added in PR #122.
There are still some optimizations needed:

  • Update styles to make the image smaller and more responsive
  • Optional persist image on supabase (url return is only available for aber 1 or 2 hours)
  • Add additional params for Dall-E
  • Update ai.models.ts to reflect the correct settings for dall-e 2/3
  • Remove the image modules from the system_prompt modals
  • Add documentation

Current Example:
image
image

[BUG] npm dependency issue

npm dependency issue on vitest
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the Installation Guide https://unsaged.com/docs/getting-started/installation
  2. When running "npm i" in ~/unSAGED/apps/unsaged, error reported as follow
# npm resolution error report 

While resolving: [email protected]
Found: [email protected]
node_modules/vitest
  dev vitest@"^1.0.4" from [email protected]
  apps/unsaged
    [email protected]
    node_modules/unsaged
      workspace apps/unsaged from the root project
  peer vitest@"^1.0.0" from @vitest/[email protected]
  node_modules/@vitest/browser
    peerOptional @vitest/browser@"^1.0.0" from [email protected]
  peer vitest@"^1.0.0" from @vitest/[email protected]
  node_modules/@vitest/ui
    peerOptional @vitest/ui@"^1.0.0" from [email protected]

Could not resolve dependency:
peer vitest@">=0.30.0 <1" from @vitest/[email protected]
node_modules/@vitest/coverage-c8
  dev @vitest/coverage-c8@"^0.33.0" from [email protected]
  apps/unsaged
    [email protected]
    node_modules/unsaged
      workspace apps/unsaged from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Screenshots

Desktop (please complete the following information):

  • OS: Debian 12

Additional context
Running "docker build -t unsaged -f apps/unsaged/Dockerfile . --rm" in ~/unSAGED hung as well.

How to export all data as json?

Thanks for making this very useful ChatGPT frontend!

But I only see a button to import data.

How to export all data as json? :)
(Especially the custom prompts & system prompts.)
So that it can be edited and re-imported later.

[Question] - 401 on access to conversation table in Supabase

Hi,

I'm using a docker self-hosted install of supabase. have done the setup, created a user with email address in supabase and connected unsaged with all the Keys to the supabase instance.

I can login via email authentication, will get redirected back to unsaged and I'm getting a black screen.
It looks like I'm getting a 401 on trying to get to the conversation resource.

Do I need to assign the supabase user to these tables, or maybe there needs to be an project API key defined in the unsaged config ?

image

I used the generation script
https://github.com/jorge-menjivar/unSAGED/blob/dev/packages/unsaged/db/GenerationScript.sql
via the SQL Editor.

Thanks for any advise.

Development branch

I think it would be great to create a develop branch and maybe stick to something like Gitflow so each update can be created in a feature branch, will be merged and tested in develop and then is merged working in main.

[Help Needed] Implement Dual Authentication Support for Supabase Auth and Clerk in Next.js

Goal

The objective is to extend our authentication capabilities to include Clerk as an alternative to Suppabase. This integration should allow for seamless switching between the two services through environment variable configurations.

Requirements

  • Complete #91 first
  • Integrate Clerk alongside Suppabase in the authentication flow.
  • Ensure that the authentication helpers are adaptable for use with both Supabase Auth and Clerk.
  • The switch between Supabase Auth and Clerk should be manageable by setting the appropriate .env variables.
  • Document the changes comprehensively in a single feature branch PR.

Expected Outcome

A successful contribution will result in a flexible authentication setup where either Supabase Auth or Clerk can be used interchangeably based on simple environment variable toggles, without affecting the existing authentication functionality.

Contribution Process

  1. Express your interest by commenting on this issue to prevent overlapping work.
  2. Fork the repository, and create a feature branch for this task.
  3. Implement the integration while ensuring that both authentication systems can coexist and are selectable via .env variables.
  4. Thoroughly test the implementation to ensure that both systems work independently when chosen.
  5. Open a Pull Request with a detailed list of changes and testing procedures for review.

Additional Notes

  • The implementation should not break the current default authentication method.
  • Keep changes minimal and modular to facilitate easy review and potential rollback.
  • Ensure backward compatibility for existing users who might not switch to Clerk immediately.

This feature is critical for users who prefer Clerk or require its specific functionalities, and your contributions towards this dual authentication capability will significantly enhance the flexibility of our application.

Thank you for considering this contribution; we are excited to see your innovative solutions!

[BUG] Can't resolve '@/node_modules/next-auth/providers/email'

When running locally I'm seeing this error

./utils/app/auth/providers.ts:97:27
Module not found: Can't resolve '@/node_modules/next-auth/providers/email'
   95 |   }
   96 |   if (EMAIL_FROM) {
>  97 |     const provider = await import('@/node_modules/next-auth/providers/email');
      |                           ^
   98 |     const EmailProvider = provider.default;
   99 |     providers.push(
  100 |       EmailProvider({

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./app/api/auth/[...nextauth]/route.ts

Unsupported URL Type "workspace:": workspace:*

In order to build the project I'm adding npm i into the Dockerfile. Otherwise this doesn't work on a host without npm.
This approach worked yesterday.

# ---- Dependencies ----
FROM base AS dependencies
RUN npm i
RUN npm ci

Today looks like it's breaking when I get the latest version form main.

npm notice
npm notice New major version of npm available! 9.6.3 -> 10.2.4
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.4>
npm notice Run `npm install -g [email protected]` to update!
npm notice
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-11-23T11_47_26_971Z-debug-0.log

I can see commits have been made to the package.json file.

High API usage?

I noticed using unsaged.com does a lot of API requests even with very short conversations which shouldn't cost as much. I can see $0.10 increase after 10-30 mins of having used the tool (1 or 2 messages only).

google auth doesn't work

Hi, I'm trying to setup the google auth SSO using supabase:

but when i click on the login button i got redirect to this url:
https://xxxxxxxxx.supabase.co/api/auth/signin/google

with an error message saying : {"message":"No API key found in request","hint":"No apikey request header or url param was found."}

my env file look like this:

OPENAI_API_KEY=xxxx
NEXT_PUBLIC_AUTH_ENABLED=true

NEXT_PUBLIC_SUPABASE_URL=https://xxxxxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=xxxxxxxx

SUPABASE_SERVICE_ROLE_KEY=xxxxxxx
SUPABASE_JWT_SECRET=xxxxxxxxxx
NEXTAUTH_SECRET=xxxxxxxx
NEXTAUTH_URL=https://xxxxxx.supabase.co

GOOGLE_CLIENT_ID=xxxxxxx-xxxxxxxx.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=xxxxxxxx
GOOGLE_API_KEY=xxxxxxxx

[Not longer needed] Integrate Custom Sign-In Page with NextAuth Using New Next.js /app Structure

Overview

We aim to implement a custom sign-in page compatible with the new /app structure in Next.js. The current documentation for NextAuth.js appears outdated and doesn't align well with the latest Next.js updates, leading to integration issues.

Objective

Successfully migrate the authentication flow to utilize a custom auth/signin page, replacing the default one provided by NextAuth.js. This page should be fully functional and modifiable according to our project's requirements.

Current Behavior

The default sign-in page provided by NextAuth.js is currently in use, as attempts to implement a custom page have not been successful.

Encountered Issues

While attempting to set up the custom sign-in page, I ran into several problems that I believe might require a more in-depth look, possibly from one of the project's paid contributors.

Request for Contribution

We are looking for contributors who can take on this task. If you have experience with Next.js and NextAuth.js, especially with the new /app structure, your expertise would be highly valuable.

Steps to Contribute

  1. Leave a comment if you're interested in tackling this issue to avoid duplicate efforts.
  2. Fork the repository and set up the project locally.
  3. Make the necessary changes to integrate a custom sign-in page with NextAuth.js.
  4. Test the functionality to ensure compatibility with the /app structure.
  5. Submit a Pull Request with a detailed description of your changes.

Definition of Done

  • The custom auth/signin page is implemented and functional.
  • Compatibility with the latest Next.js /app structure is confirmed.
  • The page can be easily modified for further customization.

Your contributions are greatly appreciated, and we look forward to collaborating on this enhancement!

Error when DEFAULT_MODEL not defined in .env.local and running locally

Title says it all. The readme says it defaults to GPT-3.5-Turbo but in my case it threw an error. When I defined it explicitly it worked fine.

Error: Error serializing .defaultModelId returned from getServerSideProps in "/".
Reason: undefined cannot be serialized as JSON. Please use null or omit this value.

Google Auth

When using google auth what do we use as the redirect url?

Ollama Code code block syntax issue

unSAGED does not seem to identify the code blocks correctly for vba code.

It looks to use \begin{code} and \end{code} which is not recognized maybe?

See attached screenshot of the issue

image

[BUG] Ollama long running generate error

Describe the bug
When using Ollama server and a Vercel deployment IΒ΄m running into some timeouts

Screenshots
image

Error
Error: Your function was stopped as it did not return an initial response within 25s

Additional context
Ollama server running on Hetzner Cloud with a Nginx Proxy Manager in front to proxy the ollama server to https and enable Access Lists for HTTP Basic Auth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.