-
Notifications
You must be signed in to change notification settings - Fork 11
Feature/no ref/workspace tools and context #201
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
Closed
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6d28536
feat: sources
urjitc 13e044e
fix: sources
urjitc b6dc404
feat: iteration 1
urjitc 3fb038d
feat: use our db for chat
urjitc fdee92a
fix: thread adapter
urjitc 50103fa
feat: show ui for added context
urjitc bce5355
feat: remove old context
urjitc 456a0d8
more changes
urjitc 279fa5a
feat: diff based updating
urjitc f7e8ab1
fix: more features
urjitc d3baa75
feat: thread loading skeleton
urjitc 56bfeff
chore: use searchWorkspace over grepWorkspace; exclude tmp from tsconfig
urjitc c5460fa
fix: image instructions
urjitc 870a3d0
fix: dialog click events
urjitc 0f581fd
fix: system prompt
urjitc 0be89c8
fix: ui
urjitc bcf2873
fix: ui
urjitc e7cfad3
fix: truncate file output
urjitc b66914a
feat: nice anim
urjitc f439cd6
fix: build error
urjitc 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
This file contains hidden or 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 hidden or 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 hidden or 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,35 @@ | ||
| CREATE TABLE "chat_messages" ( | ||
| "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
| "thread_id" uuid NOT NULL, | ||
| "message_id" text NOT NULL, | ||
| "parent_id" text, | ||
| "format" text NOT NULL, | ||
| "content" jsonb NOT NULL, | ||
| "created_at" timestamp with time zone DEFAULT now() | ||
| ); | ||
| --> statement-breakpoint | ||
| CREATE TABLE "chat_threads" ( | ||
| "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
| "workspace_id" uuid NOT NULL, | ||
| "user_id" text NOT NULL, | ||
| "title" text, | ||
| "is_archived" boolean DEFAULT false, | ||
| "external_id" text, | ||
| "created_at" timestamp with time zone DEFAULT now(), | ||
| "updated_at" timestamp with time zone DEFAULT now(), | ||
| "last_message_at" timestamp with time zone DEFAULT now() | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "chat_threads" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint | ||
| ALTER TABLE "chat_messages" ADD CONSTRAINT "chat_messages_thread_id_chat_threads_id_fk" FOREIGN KEY ("thread_id") REFERENCES "public"."chat_threads"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "chat_threads" ADD CONSTRAINT "chat_threads_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint | ||
| ALTER TABLE "chat_threads" ADD CONSTRAINT "chat_threads_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint | ||
| CREATE INDEX "idx_chat_messages_thread" ON "chat_messages" USING btree ("thread_id" uuid_ops);--> statement-breakpoint | ||
| CREATE INDEX "idx_chat_messages_thread_created" ON "chat_messages" USING btree ("thread_id" uuid_ops,"created_at" timestamptz_ops);--> statement-breakpoint | ||
| CREATE INDEX "idx_chat_threads_workspace" ON "chat_threads" USING btree ("workspace_id" uuid_ops);--> statement-breakpoint | ||
| CREATE INDEX "idx_chat_threads_user" ON "chat_threads" USING btree ("user_id" text_ops);--> statement-breakpoint | ||
| CREATE INDEX "idx_chat_threads_last_message" ON "chat_threads" USING btree ("workspace_id" uuid_ops,"last_message_at" timestamptz_ops);--> statement-breakpoint | ||
| CREATE POLICY "Users can manage threads in their workspaces" ON "chat_threads" AS PERMISSIVE FOR ALL TO "authenticated" USING ((EXISTS ( SELECT 1 FROM workspaces w | ||
| WHERE ((w.id = chat_threads.workspace_id) AND (w.user_id = (auth.jwt() ->> 'sub'::text))))) | ||
| OR (EXISTS ( SELECT 1 FROM workspace_collaborators c | ||
| WHERE ((c.workspace_id = chat_threads.workspace_id) AND (c.user_id = (auth.jwt() ->> 'sub'::text)))))); | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
P1: Security:
chat_messagestable is missing Row Level Security. Every other user-data table in this project has RLS enabled, butchat_messages(which stores sensitive conversation content) does not. Without RLS, any authenticated user can directly read/write messages in any thread, bypassing thechat_threadsRLS policy. AddALTER TABLE "chat_messages" ENABLE ROW LEVEL SECURITYand a corresponding policy that restricts access to messages whose thread belongs to an authorized workspace.Prompt for AI agents