This repository has been archived by the owner on Feb 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Utilize OpenAI for backend (#553)
- Changes naming convention to use threads instead of conversations - Refactors to use OpenAI types for threads, messages, and assistants - Refactor to no longer save threads, messages, and assistants directly to Supabase, but instead uses OpenAI - endpoints - Bug fixes for AssistantTile text, Assistant Avatar uploading - Adds new mocking setups for testsport --------- Co-authored-by: John Alling <john.alling@defenseunicorns.com> Co-authored-by: Jon Perry <yrrepnoj@gmail.com>
- Loading branch information
1 parent
840f49a
commit 5371956
Showing
96 changed files
with
3,153 additions
and
2,204 deletions.
There are no files selected for viewing
115 changes: 23 additions & 92 deletions
115
packages/supabase/migrations/20240322174521_ui_sql_schema.sql
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
17 changes: 17 additions & 0 deletions
17
packages/supabase/migrations/20240522134301_profile_0.8_migration.sql
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,17 @@ | ||
-- First, rename the existing table to keep a backup | ||
ALTER TABLE profiles RENAME TO profiles_old; | ||
|
||
-- Create the new table with the required structure | ||
CREATE TABLE public.profiles ( | ||
id uuid REFERENCES auth.users NOT NULL PRIMARY KEY, | ||
full_name text, | ||
thread_ids text[] DEFAULT '{}' | ||
); | ||
|
||
-- Insert data from the old table to the new one (only the required columns) | ||
INSERT INTO public.profiles (id, full_name) | ||
SELECT id, full_name | ||
FROM profiles_old; | ||
|
||
-- Drop the old table if the data transfer is successful | ||
-- DROP TABLE profiles_old; |
30 changes: 30 additions & 0 deletions
30
packages/supabase/migrations/20240523233951_0.8_ui_migration.sql
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,30 @@ | ||
DO $$ | ||
BEGIN | ||
BEGIN | ||
DROP TABLE IF EXISTS messages; | ||
END; | ||
BEGIN | ||
DROP TABLE IF EXISTS conversations; | ||
END; | ||
END $$; | ||
|
||
-- Drop the existing trigger | ||
drop trigger if exists on_auth_user_created on auth.users; | ||
|
||
-- Drop the existing function | ||
drop function if exists public.handle_new_user(); | ||
|
||
-- Create the new function without the avatar_url field | ||
create function public.handle_new_user() | ||
returns trigger as $$ | ||
begin | ||
insert into public.profiles (id, full_name) | ||
values (new.id, new.raw_user_meta_data->>'full_name'); | ||
return new; | ||
end; | ||
$$ language plpgsql security definer; | ||
|
||
-- Recreate the trigger | ||
create trigger on_auth_user_created | ||
after insert on auth.users | ||
for each row execute procedure public.handle_new_user(); |
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
Oops, something went wrong.