-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for Supabase Sync #554
Open
joelmnz
wants to merge
35
commits into
enricoros:v1-dev
Choose a base branch
from
joelmnz:main
base: v1-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+797
−4
Open
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
5bfc29f
wip on settings
joelmnz f719ace
settings saving
joelmnz 3ec5482
wip on supabase connection
joelmnz 9a0c165
wip on sync
joelmnz eaa2b4c
Merge remote-tracking branch 'origin/main' into main-supabase
joelmnz 7aafb73
.
joelmnz 0f623bb
sync wip
joelmnz a1c41b0
save to db working
joelmnz cf36e31
wip on import from server
joelmnz b6f78c3
added docs
joelmnz 4c1b65f
better messages
joelmnz 1ab20f0
Merge remote-tracking branch 'origin/main' into main-supabase
joelmnz da8c26e
publish fixes
joelmnz f4be5dc
PR tidy up
joelmnz 9823cb8
Merge remote-tracking branch 'origin/main' into main-supabase
joelmnz 460068b
improve sync + support sync from Module settings (e.g. first sync)
joelmnz 319a33c
Merge pull request #1 from joelmnz/main-supabase
joelmnz 1b3f193
Merge branch 'enricoros:main' into main
joelmnz 002c650
wip not working, but might be close. need to put session info in app …
joelmnz 67303e4
Merge branch 'enricoros:main' into main-supabaseUserAuth
joelmnz 649ddc0
Merge branch 'enricoros:main' into main
joelmnz 23afb25
doc: supabase db schema
joelmnz ade4299
wip: so close yet so far
joelmnz 93ad2dd
Merge branch 'enricoros:main' into main
joelmnz cc69d20
Merge branch 'enricoros:main' into main-supabaseUserAuth
joelmnz 72d61f5
Merge branch 'enricoros:main' into main
joelmnz ba1c7c1
Merge branch 'enricoros:main' into main
joelmnz 161b104
enh: use Supabase user auth
joelmnz 2121bcc
Merge branch 'main' into main-supabaseUserAuth
joelmnz bf97301
tidy: fix up code for PR, login consistency + db table check
joelmnz 96dd36f
doc: update documentation
joelmnz dd7a344
fix: " vs ' for import
joelmnz 58eff5e
fix: " vs ' in imports
joelmnz 9457b2c
Merge pull request #2 from joelmnz/main-supabaseUserAuth
joelmnz 7b30214
Merge branch 'main' into main
joelmnz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Supabase Sync - Experimental | ||
|
||
## Module Goal | ||
|
||
> To sync all conversations from big-agi's localDb to a server and back allowing use on multiple devices while preserving big-agi's private and local approach. | ||
|
||
Supabase supports multi user authentication so this module assumes you will have users setup and users can save their own data/chats to this database and they will not be accessable by other users (e.g. not used for team conversation sharing, if that is desired then get all team members to use same user account) | ||
|
||
## Module Status | ||
|
||
**Whats working:** | ||
|
||
- Sync "Chat Conversations" to Supabase | ||
|
||
**Planned:** | ||
|
||
- Sync Conversation folders | ||
- Sync other shared user settings like theme, what the "Enter" key does etc | ||
|
||
## Supabase Setup | ||
|
||
- Supabase project setup (free account is fine), you will need your url & anon-key | ||
- Table called `user_conversation` with the following schema | ||
- Row Level Security (RLS) turned on for this table and policies setup | ||
- One or more supabase user accounts with access to the `user_conversation` table | ||
|
||
```sql | ||
|
||
create table user_conversation ( | ||
id uuid not null, | ||
"systemPurposeId" character varying(255) null, | ||
"folderId" uuid null, | ||
created bigint not null, | ||
updated bigint not null, | ||
"userTitle" character varying(255) null, | ||
"autoTitle" character varying(255) null, | ||
messages json null, | ||
user_id uuid null default auth.uid (), | ||
constraint user_conversation_pkey primary key (id) | ||
); | ||
|
||
create policy "Users can mange their own data" | ||
on "public"."user_conversation" | ||
to public | ||
using ( | ||
(auth.uid() = user_id) | ||
); | ||
|
||
``` | ||
|
||
## Big-Agi Setup | ||
|
||
Navigate to your hosted instance and set your Supabase URL & KEY under the `Preferences -> Tools -> Supabase Sync` then login with your supabase user | ||
|
||
NOTE: the `Last Synced` is a way of tracking what chnages you need to get. To do a full sync (possibly loosing any un-synced data) reset this value to 0. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@enricoros I wasn't able to get the supabase auth UI working nicely, I think these might be able to be removed, thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look at the default components provided by the package, I shall be able to integrate this. Worst case we drop this package and code a manual UI.